Tarea #372 (se adapta la unidad uGridClipBoardUtils para que tire de las funciones de controllerdetallesbase y no se produzca duplicidad de funciones.

Tarea #293
Tarea #366


git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@988 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
roberto 2010-02-08 17:38:24 +00:00
parent c8e17b32f3
commit 26314b07a2
35 changed files with 696 additions and 610 deletions

View File

@ -144,33 +144,36 @@ var
AsignarDtoPosicion: Integer;
begin
AsignarDtoPosicion := 0;
AField := ADataTable.DataTable.FindField(CAMPO_POSICION);
if not Assigned(AField) then
raise Exception.Create('Campo ' + CAMPO_POSICION + ' no encontrado (AsignarDescuento)');
if ADescuento >= 0 then
begin
AsignarDtoPosicion := 0;
AField := ADataTable.DataTable.FindField(CAMPO_POSICION);
if not Assigned(AField) then
raise Exception.Create('Campo ' + CAMPO_POSICION + ' no encontrado (AsignarDescuento)');
BeginUpdate(ADataTable);
try
with ADataTable do
begin
for i := 0 to High(POSICION) do
BeginUpdate(ADataTable);
try
with ADataTable do
begin
DataTable.First;
AsignarDtoPosicion := POSICION[i];
if DataTable.Locate(CAMPO_POSICION, AsignarDtoPosicion, []) then
for i := 0 to High(POSICION) do
begin
if (DataTable.FieldByName(CAMPO_TIPO).AsString = TIPO_DETALLE_CONCEPTO) then
begin
DataTable.Edit;
DataTable.FieldByName(CAMPO_DESCUENTO).AsVariant := ADescuento;
DataTable.Post;
end;
DataTable.First;
AsignarDtoPosicion := POSICION[i];
if DataTable.Locate(CAMPO_POSICION, AsignarDtoPosicion, []) then
begin
if (DataTable.FieldByName(CAMPO_TIPO).AsString = TIPO_DETALLE_CONCEPTO) then
begin
DataTable.Edit;
DataTable.FieldByName(CAMPO_DESCUENTO).AsVariant := ADescuento;
DataTable.Post;
end;
end;
end;
Renumerar(DataTable, AsignarDtoPosicion);
end;
Renumerar(DataTable, AsignarDtoPosicion);
finally
EndUpdate(ADataTable);
end;
finally
EndUpdate(ADataTable);
end;
end;

View File

@ -27,14 +27,8 @@ uses
cxVariants, CtlToRTF, Clipbrd, DB, cxExport, cxGridExportLink, cxCustomData,
uSistemaFunc, ClipboardUtils, cxDBData, cxGridLevel, uStringsUtils,
cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGridDBDataDefinitions, uGridStatusUtils;
const
TIPO_DETALLE_CONCEPTO = 'Concepto';
CAMPO_ID = 'ID';
CAMPO_POSICION = 'POSICION';
CAMPO_TIPO = 'TIPO_DETALLE';
CAMPO_CONCEPTO = 'CONCEPTO';
cxGridTableView, cxGridDBTableView, cxGridDBDataDefinitions, uGridStatusUtils,
uDADataTable, uCalculosUtils, uControllerDetallesBase;
type
TTipoAnadir = (taAnadir, taInsertar);
@ -55,165 +49,6 @@ begin
end;
function _DesplazarNPosiciones(ADataSet: TDataSet; NumOrdenIni: Variant; NPosiciones: Variant): Integer;
{
Función que desplaza NPosiciones el numero de orden a partir del elemento con el
número de orden dado. Devuelve el numero de orden del primer elemento del hueco
generado
}
var
AuxNumOrden: Integer;
AuxNumPos: Integer;
AField: TField;
begin
AField := ADataSet.FindField(CAMPO_POSICION);
if not Assigned(AField) then
raise Exception.Create('Campo ' + CAMPO_POSICION + ' no encontrado (DesplazarNPosiciones)');
if VarIsNull(NPosiciones) then
AuxNumPos := 1
else
AuxNumPos := NPosiciones;
if VarIsNull(NumOrdenIni) then
AuxNumOrden := 0
else
AuxNumOrden := NumOrdenIni + 1; //Añadimos por abajo siempre
Result := AuxNumOrden;
with ADataSet do
begin
First;
while not EOF do
begin
if (FieldByName(CAMPO_POSICION).AsInteger >= AuxNumOrden) then
begin
if not (State in dsEditModes) then
Edit;
FieldByName(CAMPO_POSICION).AsInteger := FieldByName(CAMPO_POSICION).AsInteger + AuxNumPos;
Post;
end;
Next;
end;
end;
end;
procedure _NuevaTupla(ADataSet: TDataSet; ATipoAnadir: TTipoAnadir = taInsertar);
var
AuxNumOrden : Integer;
begin
ADataSet.DisableControls;
try
with ADataSet do
begin
AuxNumOrden := _DesplazarNPosiciones(ADataSet, FieldByName(CAMPO_POSICION).AsVariant, 1);
case ATipoAnadir of
taAnadir: Append;
taInsertar: Insert;
end;
FieldByName(CAMPO_POSICION).AsInteger := AuxNumOrden;
FieldByName(CAMPO_TIPO).AsVariant := TIPO_DETALLE_CONCEPTO;
end;
finally
ADataSet.EnableControls;
end;
end;
procedure _Renumerar(ADataSet: TDataSet);
{
procedimiento que renumera todos los conceptos de la tabla dada por parametro
}
var
i, j : Integer;
AField: TField;
begin
AField := ADataSet.FindField(CAMPO_POSICION);
if not Assigned(AField) then
raise Exception.Create('Campo ' + CAMPO_POSICION + ' no encontrado (renumerar)');
with ADataSet do
begin
for i:=0 to RecordCount-1 do
begin
First;
if not Locate(CAMPO_POSICION, i, []) then
begin
j := i;
First;
while not Locate(CAMPO_POSICION, j, []) do
begin
Inc(j);
First;
end;
if not (State in dsEditModes) then
Edit;
FieldByName(CAMPO_POSICION).AsInteger := i;
Post;
end;
end;
end;
end;
{procedure RenumerarCampoPosicion(ADataSet : TDataSet);
var
i, j : Integer;
AField : TField;
AList : TStringList;
begin
AList := TStringList.Create;
try
ADataSet.First;
for i:=0 to ADataSet.RecordCount-1 do
begin
AList.Add(ADataSet.FieldByName('POSICION').AsString);
ADataSet.Next;
end;
ShowMessage(AList.Text);
finally
FreeANDNIL(AList);
end;
AField := ADataSet.FindField('POSICION');
if Assigned(AField) and not (ADataSet.IsEmpty) then
begin
with ADataSet do
begin
for i:=0 to RecordCount-1 do
begin
First;
if not Locate('POSICION', i, []) then
begin
j := i;
First;
while not Locate('POSICION', j, []) do
begin
Inc(j);
First;
end;
end;
Edit;
FieldByName('POSICION').AsInteger := i;
Post;
end;
end;
end;
end;}
function _BuscarColumna (AView: TcxGridDBTableView;
const AName, ATypeValue : String; var AIndex : Integer) : Boolean;
var
@ -246,7 +81,6 @@ procedure LoadGridRowsFromStream(AView : TcxGridDBTableView; AStream: TStream;
var
AValueNameList: TStringList;
AValueTypeList: TStringList;
ADataSet : TDataSet;
ARecordID : Integer;
ARecordIndex : Integer;
bEstabaVacia : Boolean;
@ -259,6 +93,10 @@ var
AValue : Variant;
AIndex : integer;
//Se adapta para que se utilicen las mismas funciones que en el controllerbase
AControllerDetallesBase: IControllerDetallesBase;
ADataTable: IDAStronglyTypedDataTable;
begin
if not Assigned(AView) then
raise Exception.Create('Vista no asignada (SaveGridViewToStream)');
@ -266,12 +104,15 @@ begin
if not Assigned(AStream) then
raise Exception.Create('Stream no asignado (SaveGridViewToStream)');
ADataSet := AView.DataController.DataSource.DataSet;
if not Supports((AView.DataController.DataSource as TDADataSource).DataTable, IDAStronglyTypedDataTable, ADataTable) then
raise Exception.Create('DataTable asignado no soporta IDAStronglyTypedDataTable)');
AReader := TcxReader.Create(AStream);
AValueNameList := TStringList.Create;
AValueTypeList := TStringList.Create;
try
AControllerDetallesBase:= TControllerDetallesBase.Create;
AIndex := -1;
ACaption := AReader.ReadAnsiString;
NumCols := AReader.ReadInteger; // de columnas
@ -285,7 +126,7 @@ begin
end;
NumFilas := AReader.ReadInteger;
bEstabaVacia := ADataSet.IsEmpty;
bEstabaVacia := ADataTable.IsEmpty;
AView.DataController.BeginUpdate;
try
@ -297,7 +138,7 @@ begin
if ARecordIndex >= 0 then
begin
ARecordID := AView.DataController.GetRecordId(ARecordIndex);
ADataSet.Locate(AView.DataController.KeyFieldNames, ARecordID, []);
ADataTable.Locate(AView.DataController.KeyFieldNames, ARecordID, []);
end;
end;
@ -305,16 +146,16 @@ begin
begin
// Insertar una tupla de la forma adecuada
if bEstabaVacia then
_NuevaTupla(ADataSet, taAnadir)
begin
AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO);
ADataTable.Edit;
end
else begin
if iContador = 0 then
ADataSet.Edit
ADataTable.Edit
else begin
ADataSet.Next;
if ADataSet.EOF then
_NuevaTupla(ADataSet, taAnadir)
else
_NuevaTupla(ADataSet, taInsertar)
AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO);
ADataTable.Edit;
end;
end;
@ -324,23 +165,18 @@ begin
AValue := AReader.ReadVariant;
if (Pos(AValueNameList[iCols], AView.DataController.KeyFieldNames) = 0) then
begin
if (AValueNameList[iCols] = 'POSICION') then
ADataSet.FieldByName('POSICION').Value := ADataSet.RecNo
else
if _BuscarColumna(AView, AValueNameList[iCols], AValueTypeList[iCols], AIndex) then
begin
if AIndex <> -1 then
ADataSet.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue;
end;
if (AValueNameList[iCols] <> CAMPO_POSICION) then
if _BuscarColumna(AView, AValueNameList[iCols], AValueTypeList[iCols], AIndex) then
begin
if AIndex <> -1 then
ADataTable.DataTable.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue;
end;
end;
end;
finally
ADataSet.Post;
ADataTable.Post;
end;
end;
_Renumerar(ADataSet);
finally
AView.DataController.EndUpdate;
end;
@ -348,6 +184,7 @@ begin
FreeANDNIL(AReader);
FreeANDNIL(AValueNameList);
FreeANDNIL(AValueTypeList);
AControllerDetallesBase := Nil;
end;
end;
{$ENDREGION}
@ -629,13 +466,23 @@ end;
procedure CortarSeleccionGridAlPortapapeles (AGrid : TcxGrid);
var
//Se adapta para que se utilicen las mismas funciones que en el controllerbase
AControllerDetallesBase: IControllerDetallesBase;
ADataTable : TDADataTable;
begin
if Assigned(AGrid) then
ADataTable := ((AGrid.ActiveView as TcxGridDBTableView).DataController.DataSource as TDADataSource).DataTable;
ShowHourglassCursor;
try
AControllerDetallesBase := TControllerDetallesBase.Create;
CopiarSeleccionGridAlPortapapeles(AGrid);
AGrid.ActiveView.DataController.DeleteSelection;
_Renumerar(TcxGridDBTableView(AGrid.ActiveView).DataController.DataSet);
AControllerDetallesBase.Renumerar(ADataTable, ADataTable.FieldByName(CAMPO_POSICION).AsInteger);
finally
AControllerDetallesBase := Nil;
HideHourglassCursor;
end;
end;
@ -678,18 +525,25 @@ var
AGridStatus : TcxGridStatus;
ATextList : TStringList;
ADataSet : TDataSet;
ARecordID : Integer;
ARecordIndex : Integer;
bEstabaVacia : Boolean;
AView : TcxGridDBTableView;
iContador : Integer;
//Se adapta para que se utilicen las mismas funciones que en el controllerbase
AControllerDetallesBase: IControllerDetallesBase;
ADataTable: IDAStronglyTypedDataTable;
begin
if not Assigned(AGrid) then
raise Exception.Create('Grid no asignado (PegarTextoDesdePortapapeles)');
if not Supports(((AGrid.ActiveView as TcxGridDBTableView).DataController.DataSource as TDADataSource).DataTable, IDAStronglyTypedDataTable, ADataTable) then
raise Exception.Create('DataTable asignado no soporta IDAStronglyTypedDataTable)');
RegistrarFormatos;
if not Clipboard.HasFormat(CF_TEXT) then
@ -703,8 +557,8 @@ begin
ATextList := TStringList.Create;
try
CopyStringsFromClipboard(CF_TEXT, ATextList);
ADataSet := AView.DataController.DataSource.DataSet;
bEstabaVacia := ADataSet.IsEmpty;
AControllerDetallesBase := TControllerDetallesBase.Create;
bEstabaVacia := ADataTable.IsEmpty;
AView.DataController.BeginUpdate;
try
// Localizar el punto donde se empieza a insertar
@ -714,7 +568,7 @@ begin
if ARecordIndex >= 0 then
begin
ARecordID := AView.DataController.GetRecordId(ARecordIndex);
ADataSet.Locate(AView.DataController.KeyFieldNames, ARecordID, []);
ADataTable.Locate(AView.DataController.KeyFieldNames, ARecordID, []);
end;
end;
@ -722,28 +576,27 @@ begin
begin
// Insertar una tupla de la forma adecuada
if bEstabaVacia then
_NuevaTupla(ADataSet, taAnadir)
begin
AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO);
ADataTable.Edit;
end
else begin
if iContador = 0 then
ADataSet.Edit
ADataTable.Edit
else begin
ADataSet.Next;
if ADataSet.EOF then
_NuevaTupla(ADataSet, taAnadir)
else
_NuevaTupla(ADataSet, taInsertar)
AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO);
ADataTable.Edit;
end;
end;
try
ADataSet.Edit;
ADataSet.FieldByName('CONCEPTO').AsString := ATextList[iContador];
ADataTable.Edit;
ADataTable.DataTable.FieldByName('CONCEPTO').AsString := ATextList[iContador];
finally
ADataSet.Post;
ADataTable.Post;
end;
end;
_Renumerar(ADataSet);
finally
AView.DataController.EndUpdate;
end;
@ -754,6 +607,7 @@ begin
Clipboard.Close;
AGridStatus.Restore(TcxGridDBTableView(AGrid.ActiveView));
FreeAndNil(AGridStatus);
AControllerDetallesBase := Nil;
end;
end;

View File

@ -77,6 +77,10 @@ inherited fEditorDBItem: TfEditorDBItem
TabOrder = 2
object pagGeneral: TTabSheet
Caption = 'General'
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 0
end
end
inherited StatusBar: TJvStatusBar

View File

@ -1143,7 +1143,7 @@ procedure TfrViewDetallesBase.actDetallesCopiarExecute(Sender: TObject);
begin
ShowHourglassCursor;
try
CopiarSeleccionGridAlPortapapeles(_Grid);
CopiarSeleccionGridAlPortapapeles(_Grid, True);
finally
HideHourglassCursor;
end;

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,38 @@ requires
Obras_controller,
PedProv_AlbProv_relation,
PedProv_FacProv_relation,
GestorInformes_controller;
GestorInformes_controller,
rtl,
vcl,
dbrtl,
vcldb,
PNG_D10,
PngComponentsD10,
vclactnband,
vclx,
cxLibraryD11,
dxThemeD11,
dxGDIPlusD11,
dxCoreD11,
cxExtEditorsD11,
cxDataD11,
cxEditorsD11,
vcljpg,
DataAbstract_Core_D11,
dsnap,
adortl,
RemObjects_Core_D11,
GUISDK_D11R,
designide,
xmlrtl,
dxLayoutControlD11,
dxComnD11,
JvStdCtrlsD11R,
JclVcl,
Jcl,
JvCoreD11R,
JvSystemD11R,
JvCtrlsD11R;
contains
uPedidosProveedorViewRegister in 'uPedidosProveedorViewRegister.pas',
@ -57,6 +88,7 @@ contains
uViewProveedorPedido in 'uViewProveedorPedido.pas' {frViewProveedorPedido: TFrame},
uEditorElegirPersonaContactoPedido in 'uEditorElegirPersonaContactoPedido.pas' {fEditorElegirPersonaContactoPedido: TfEditorSituacionPedidoProveedor},
uViewObraReserva in 'uViewObraReserva.pas' {frViewObraReserva: TFrame},
uDialogOpcionesImpresionPedidosProveedor in 'uDialogOpcionesImpresionPedidosProveedor.pas' {fDialogOpcionesImpresionPedidosProveedor: TForm};
uDialogOpcionesImpresionPedidosProveedor in 'uDialogOpcionesImpresionPedidosProveedor.pas' {fDialogOpcionesImpresionPedidosProveedor: TForm},
uViewDatosYSeleccionProveedorPedido in 'uViewDatosYSeleccionProveedorPedido.pas'{frViewDatosYSeleccionProveedorPedido: TFrame};
end.

View File

@ -49,20 +49,45 @@
<DelphiCompile Include="PedidosProveedor_view.dpk">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="adortl.dcp" />
<DCCReference Include="Almacenes_controller.dcp" />
<DCCReference Include="Almacenes_model.dcp" />
<DCCReference Include="Articulos_view.dcp" />
<DCCReference Include="Contactos_controller.dcp" />
<DCCReference Include="Contactos_model.dcp" />
<DCCReference Include="Contactos_view.dcp" />
<DCCReference Include="cxDataD11.dcp" />
<DCCReference Include="cxEditorsD11.dcp" />
<DCCReference Include="cxExtEditorsD11.dcp" />
<DCCReference Include="cxLibraryD11.dcp" />
<DCCReference Include="DataAbstract_Core_D11.dcp" />
<DCCReference Include="dbrtl.dcp" />
<DCCReference Include="designide.dcp" />
<DCCReference Include="dsnap.dcp" />
<DCCReference Include="dxComnD11.dcp" />
<DCCReference Include="dxCoreD11.dcp" />
<DCCReference Include="dxGDIPlusD11.dcp" />
<DCCReference Include="dxLayoutControlD11.dcp" />
<DCCReference Include="dxThemeD11.dcp" />
<DCCReference Include="GestorInformes_controller.dcp" />
<DCCReference Include="GUIBase.dcp" />
<DCCReference Include="GUISDK_D11R.dcp" />
<DCCReference Include="Jcl.dcp" />
<DCCReference Include="JclVcl.dcp" />
<DCCReference Include="JvCoreD11R.dcp" />
<DCCReference Include="JvCtrlsD11R.dcp" />
<DCCReference Include="JvStdCtrlsD11R.dcp" />
<DCCReference Include="JvSystemD11R.dcp" />
<DCCReference Include="Obras_controller.dcp" />
<DCCReference Include="Obras_model.dcp" />
<DCCReference Include="PedidosProveedor_controller.dcp" />
<DCCReference Include="PedidosProveedor_model.dcp" />
<DCCReference Include="PedProv_AlbProv_relation.dcp" />
<DCCReference Include="PedProv_FacProv_relation.dcp" />
<DCCReference Include="PngComponentsD10.dcp" />
<DCCReference Include="PNG_D10.dcp" />
<DCCReference Include="RemObjects_Core_D11.dcp" />
<DCCReference Include="rtl.dcp" />
<DCCReference Include="uDialogOpcionesImpresionPedidosProveedor.pas">
<Form>fDialogOpcionesImpresionPedidosProveedor</Form>
<DesignClass>TForm</DesignClass>
@ -100,6 +125,7 @@
<DesignClass>TfEditorSituacionPedidoProveedor</DesignClass>
</DCCReference>
<DCCReference Include="uPedidosProveedorViewRegister.pas" />
<DCCReference Include="uViewDatosYSeleccionProveedorPedido.pas" />
<DCCReference Include="uViewDetallesPedidoProveedor.pas">
<Form>frViewDetallesPedidoProveedor</Form>
<DesignClass>TFrame</DesignClass>
@ -128,6 +154,12 @@
<Form>frViewProveedorPedido</Form>
<DesignClass>TFrame</DesignClass>
</DCCReference>
<DCCReference Include="vcl.dcp" />
<DCCReference Include="vclactnband.dcp" />
<DCCReference Include="vcldb.dcp" />
<DCCReference Include="vcljpg.dcp" />
<DCCReference Include="vclx.dcp" />
<DCCReference Include="xmlrtl.dcp" />
</ItemGroup>
</Project>
<!-- EurekaLog First Line

View File

@ -1,22 +1,24 @@
inherited frViewObraReserva: TfrViewObraReserva
Width = 529
Height = 74
Width = 316
Height = 102
OnShow = CustomViewShow
ExplicitWidth = 529
ExplicitHeight = 74
ExplicitWidth = 316
ExplicitHeight = 102
object dxLayoutControl1: TdxLayoutControl
Left = 0
Top = 0
Width = 529
Height = 74
Width = 316
Height = 102
Align = alClient
ParentBackground = True
TabOrder = 0
TabStop = False
AutoContentSizes = [acsWidth, acsHeight]
ExplicitWidth = 529
ExplicitHeight = 74
DesignSize = (
529
74)
316
102)
object Label1: TLabel
Left = 10
Top = 10
@ -25,13 +27,13 @@ inherited frViewObraReserva: TfrViewObraReserva
Caption = 'El material de este pedido es para la obra:'
end
object Button3: TBitBtn
Left = 375
Top = 29
Left = 160
Top = 56
Width = 144
Height = 25
Action = actVerObra
Caption = 'Ver datos de la obra...'
TabOrder = 1
TabOrder = 2
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000000000000000000000000000000000000FF00FF00FF00
@ -95,6 +97,50 @@ inherited frViewObraReserva: TfrViewObraReserva
TabOrder = 0
Width = 581
end
object BitBtn1: TBitBtn
Left = 10
Top = 56
Width = 144
Height = 25
Action = actAnadirObra
Caption = 'A'#241'adir obra'
TabOrder = 1
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000000000000000000000000000000000000FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF002A54A50058339A00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00A87F7C00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF002491C6000E485F00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00A87F7C00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF000098C8000E485F00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00A87F7C00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF000098C8000E485F00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00A87F7C00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF000098C8000E485F00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00A87F7C00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF000098C8000E485F00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF0000C8F800279DFA004878F800FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF000098C8000E485F00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF004878F800FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF000098C8000E485F00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF0000C8F80008F3FF004878F800FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF000098C8000C496300FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF0000C8F80008F3FF004878F800FF00FF00E7E7E700847B7B00FF00
FF00FF00FF004E748700385E7100FF00FF007D736B005A5F5F00FF00FF00FF00
FF00FF00FF0000C8F80008F3FF004878F800FF00FF0086868400797777005D5D
5C00535452004F514F004B4F500064676700C9CCD000847B7B00FF00FF00FF00
FF00FF00FF0000C8F80008F3FF004878F800FF00FF00847B7B00EFEFEF00847B
7B0089898900EAECED00EAECED00EAECED00847B7B00FF00FF00FF00FF00FF00
FF00FF00FF0000C8F80000C8F80000C8F800FF00FF008B624F00847B7B00FF00
FF00847B7B00847B7B00847B7B00847B7B00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00}
end
object dxLayoutGroup1: TdxLayoutGroup
ShowCaption = False
Hidden = True
@ -109,7 +155,6 @@ inherited frViewObraReserva: TfrViewObraReserva
object dxLayoutControl1Group1: TdxLayoutGroup
ShowCaption = False
Hidden = True
LayoutDirection = ldHorizontal
ShowBorder = False
object dxLayoutControl1Item3: TdxLayoutItem
AutoAligns = [aaVertical]
@ -117,12 +162,22 @@ inherited frViewObraReserva: TfrViewObraReserva
Control = cbObraReserva
ControlOptions.ShowBorder = False
end
object dxLayoutControl1Item2: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahRight
object dxLayoutControl1Group2: TdxLayoutGroup
ShowCaption = False
Control = Button3
ControlOptions.ShowBorder = False
Hidden = True
LayoutDirection = ldHorizontal
ShowBorder = False
object dxLayoutControl1Item4: TdxLayoutItem
ShowCaption = False
Control = BitBtn1
ControlOptions.ShowBorder = False
end
object dxLayoutControl1Item2: TdxLayoutItem
AutoAligns = [aaVertical]
ShowCaption = False
Control = Button3
ControlOptions.ShowBorder = False
end
end
end
end
@ -242,5 +297,9 @@ inherited frViewObraReserva: TfrViewObraReserva
OnExecute = actVerObraExecute
OnUpdate = actVerObraUpdate
end
object actAnadirObra: TAction
Caption = 'A'#241'adir obra'
OnExecute = actAnadirObraExecute
end
end
end

View File

@ -29,9 +29,14 @@ type
dxLayoutControl1Item3: TdxLayoutItem;
cbObraReserva: TcxComboBox;
dxLayoutControl1Group1: TdxLayoutGroup;
actAnadirObra: TAction;
dxLayoutControl1Item4: TdxLayoutItem;
BitBtn1: TBitBtn;
dxLayoutControl1Group2: TdxLayoutGroup;
procedure actVerObraExecute(Sender: TObject);
procedure actVerObraUpdate(Sender: TObject);
procedure CustomViewShow(Sender: TObject);
procedure actAnadirObraExecute(Sender: TObject);
private
FObras : TStringList;
FObrasController: IObrasController;
@ -81,6 +86,17 @@ begin
(Sender as TAction).Enabled := (cbObraReserva.Properties.Items.Count > 0)
end;
procedure TfrViewObraReserva.actAnadirObraExecute(Sender: TObject);
var
AObra : IBizObra;
begin
inherited;
AObra := (ObrasController.Nuevo as IBizObra);
ObrasController.Ver(AObra);
Obras := ObrasController.DarListaObras;
end;
procedure TfrViewObraReserva.ActivarObra(const IDObra: Integer);
var
i : integer;

View File

@ -143,7 +143,7 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
end
inline frViewDireccionEntregaPedidoProv1: TfrViewDireccionEntregaPedidoProv
Left = 22
Top = 276
Top = 301
Width = 432
Height = 248
Font.Charset = DEFAULT_CHARSET
@ -155,7 +155,7 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
TabOrder = 7
ReadOnly = False
ExplicitLeft = 22
ExplicitTop = 276
ExplicitTop = 301
ExplicitWidth = 432
ExplicitHeight = 248
inherited dxLayoutControl1: TdxLayoutControl
@ -167,9 +167,9 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
432
248)
inherited Bevel1: TBevel
Top = 200
Top = 175
Width = 566
ExplicitTop = 200
ExplicitTop = 175
ExplicitWidth = 566
end
inherited lblObra: TLabel
@ -190,9 +190,9 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
end
inherited bModificar: TBitBtn
Left = 284
Top = 164
Top = 139
ExplicitLeft = 284
ExplicitTop = 164
ExplicitTop = 139
end
inherited txtDireccion: TStaticText
Width = 882
@ -205,12 +205,12 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
ExplicitWidth = 223
end
inherited edtEntregarA: TcxDBButtonEdit
Top = 231
Top = 206
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitTop = 231
ExplicitTop = 206
ExplicitWidth = 334
Width = 334
end
@ -332,8 +332,8 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
inline frViewObraReserva1: TfrViewObraReserva
Left = 22
Top = 168
Width = 432
Height = 72
Width = 422
Height = 97
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
@ -344,28 +344,21 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
ReadOnly = False
ExplicitLeft = 22
ExplicitTop = 168
ExplicitWidth = 432
ExplicitHeight = 72
ExplicitWidth = 422
ExplicitHeight = 97
inherited dxLayoutControl1: TdxLayoutControl
Width = 432
Height = 72
Width = 422
Height = 97
ExplicitWidth = 432
ExplicitHeight = 72
inherited Label1: TLabel
Width = 202
ExplicitWidth = 202
end
inherited Button3: TBitBtn
Left = 268
ExplicitLeft = 268
end
DesignSize = (
422
97)
inherited cbObraReserva: TcxComboBox
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 581
Width = 581
end
end
inherited PngImageList: TPngImageList
@ -397,7 +390,8 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
inherited dxLayoutControl1: TdxLayoutControl
Width = 480
Height = 201
ExplicitHeight = 171
ExplicitWidth = 480
ExplicitHeight = 201
inherited edtlNombre: TcxDBTextEdit
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''

View File

@ -59,13 +59,13 @@
<DCCReference Include="View\GUIBase.dcp" />
<DCCReference Include="View\PresupuestosCliente_data.dcp" />
<DCCReference Include="View\PresupuestosCliente_model.dcp" />
<DCCReference Include="View\uIEditorAsignarDescuento.pas" />
<DCCReference Include="View\uIEditorDireccionEntregaPresupuestoCliente.pas" />
<DCCReference Include="View\uIEditorElegirArticulosPresupuestosCliente.pas" />
<DCCReference Include="View\uIEditorElegirPresupuestosCliente.pas" />
<DCCReference Include="View\uIEditorPresupuestoCliente.pas" />
<DCCReference Include="View\uIEditorPresupuestosCliente.pas" />
<DCCReference Include="View\uIEditorPresupuestosClientePreview.pas" />
<DCCReference Include="View\uIEditorVariarPrecios.pas" />
</ItemGroup>
</Project>
<!-- EurekaLog First Line

View File

@ -1,18 +0,0 @@
unit uIEditorAsignarDescuento;
interface
uses
uEditorBasico;
type
IEditorAsignarDescuento = interface(IEditorBasico)
['{E814B4FE-F9EB-4002-83D9-7383A65F3F0D}']
function GetDescuento: Variant;
procedure SetDescuento(const Value: Variant);
property Descuento: Variant Read GetDescuento write SetDescuento;
end;
implementation
end.

View File

@ -0,0 +1,20 @@
unit uIEditorVariarPrecios;
interface
uses
uEditorBasico;
type
IEditorVariarPrecios = interface(IEditorBasico)
['{E814B4FE-F9EB-4002-83D9-7383A65F3F0D}']
function GetPorcentaje: Variant;
procedure SetPorcentaje(const Value: Variant);
property Porcentaje: Variant Read GetPorcentaje write SetPorcentaje;
function GetTipoOperacion: Integer;
property TipoOperacion: Integer Read GetTipoOperacion;
end;
implementation
end.

View File

@ -1,4 +1,4 @@
unit uDetallesPresupuestoClienteController;
unit uDetallesPresupuestoClienteController;
interface
@ -13,7 +13,8 @@ type
procedure ActualizarDetalles(ADetalles: IDAStronglyTypedDataTable; ACliente: IBizCliente); overload;
procedure DesglosarPorteDetalles(ImportePorte: Currency; ADetalles: IDAStronglyTypedDataTable);
function DarTotalPorteTotal(ADetalles: IDAStronglyTypedDataTable): Double;
function PedirDescuento: Variant;
function VariarPrecios(var APorcentaje: Variant; var ATipoOperacion: Integer): Boolean;
procedure AplicarAumento(ADataTable: IDAStronglyTypedDataTable; Posicion: TIntegerArray; APorcentaje: Variant);
end;
TDetallesPresupuestoClienteController = class(TControllerDetallesArticulos, IDetallesPresupuestoClienteController)
@ -34,9 +35,10 @@ type
function DarTotalPorteTotal(ADetalles: IDAStronglyTypedDataTable): Double;
public
function PedirDescuento: Variant;
function VariarPrecios(var APorcentaje: Variant; var ATipoOperacion: Integer): Boolean;
procedure AnadirArticulos(ADetalles: IDAStronglyTypedDataTable; ACliente: IBizCliente; const ANuevaFila :Boolean = True); reintroduce; overload;
procedure ActualizarDetalles(ADetalles: IDAStronglyTypedDataTable; ACliente: IBizCliente); overload;
procedure AplicarAumento(ADataTable: IDAStronglyTypedDataTable; Posicion: TIntegerArray; APorcentaje: Variant);
constructor Create; override;
destructor Destroy; override;
end;
@ -44,7 +46,7 @@ type
implementation
uses Controls, SysUtils, Dialogs, uDAInterfaces, uDialogUtils, Variants, uDataModulePresupuestosCliente, uArticulosPresupuestoClienteController,
uDataTableUtils, uCalculosUtils, uIEditorAsignarDescuento, uEditorRegistryUtils;
uDataTableUtils, uCalculosUtils, uIEditorVariarPrecios, uEditorRegistryUtils;
{ TDetallesPresupuestoClienteController }
@ -91,27 +93,52 @@ begin
end;
end;
procedure TDetallesPresupuestoClienteController.AplicarAumento(ADataTable: IDAStronglyTypedDataTable; Posicion: TIntegerArray;
APorcentaje: Variant);
var
i: integer;
AField: TDAField;
AsignarDtoPosicion: Integer;
begin
if APorcentaje > 0 then
begin
AsignarDtoPosicion := 0;
AField := ADataTable.DataTable.FindField(CAMPO_POSICION);
if not Assigned(AField) then
raise Exception.Create('Campo ' + CAMPO_POSICION + ' no encontrado (AsignarDescuento)');
BeginUpdate(ADataTable);
try
with ADataTable do
begin
for i := 0 to High(POSICION) do
begin
DataTable.First;
AsignarDtoPosicion := POSICION[i];
if DataTable.Locate(CAMPO_POSICION, AsignarDtoPosicion, []) then
begin
if (DataTable.FieldByName(CAMPO_TIPO).AsString = TIPO_DETALLE_CONCEPTO) then
begin
DataTable.Edit;
DataTable.FieldByName(CAMPO_IMPORTE_UNIDAD).AsVariant := (DataTable.FieldByName(CAMPO_IMPORTE_UNIDAD).AsVariant * (APorcentaje/100)) + DataTable.FieldByName(CAMPO_IMPORTE_UNIDAD).AsVariant;
DataTable.Post;
end;
end;
end;
Renumerar(DataTable, AsignarDtoPosicion);
end;
finally
EndUpdate(ADataTable);
end;
end;
end;
procedure TDetallesPresupuestoClienteController.AsignarController;
begin
FArticulosController := TArticulosPresupuestoClienteController.Create;
end;
function TDetallesPresupuestoClienteController.PedirDescuento: Variant;
var
AEditor: IEditorAsignarDescuento;
begin
CreateEditor('EditorAsignarDescuento', IEditorAsignarDescuento, AEditor);
if Assigned(AEditor) then
try
if (AEditor.ShowModal = mrOk) then
Result := AEditor.Descuento;
finally
AEditor.Release;
AEditor := NIL;
end;
end;
{
procedure TDetallesPresupuestoClienteController.AsignarDatos(ADetalles: IDAStronglyTypedDataTable; IDCabecera: Integer);
begin
@ -175,6 +202,28 @@ begin
ValidarCamposLineaConcepto(DataTable);
end;
function TDetallesPresupuestoClienteController.VariarPrecios(var APorcentaje: Variant; var ATipoOperacion: Integer): Boolean;
var
AEditor: IEditorVariarPrecios;
begin
Result := False;
CreateEditor('EditorVariarPrecios', IEditorVariarPrecios, AEditor);
if Assigned(AEditor) then
try
if (AEditor.ShowModal = mrOk) then
begin
APorcentaje := AEditor.Porcentaje;
ATipoOperacion := AEditor.TipoOperacion;
Result := True;
end;
finally
AEditor.Release;
AEditor := NIL;
end;
end;
procedure TDetallesPresupuestoClienteController.RellenarImportes(ADetalles: IDAStronglyTypedDataTable; AArticulos: IBizArticulo);
begin
//Como en tecsitel no hay descuento por linea de detalle, solo recuperamos nuevamente el valor del articulo cuando el detalle no tenga niguno

View File

@ -66,6 +66,6 @@ contains
uViewDocumentosPresupuestoCliente in 'uViewDocumentosPresupuestoCliente.pas' {frViewDocumentosPresupuestoCliente: TFrame},
uViewDatosYSeleccionClientePresupuesto in 'uViewDatosYSeleccionClientePresupuesto.pas' {frViewDatosYSeleccionClientePresupuesto: TFrame},
uViewTotalesPresupuesto in 'uViewTotalesPresupuesto.pas' {frViewTotalesPresupuesto: TFrame},
uEditorAsignarDescuento in 'uEditorAsignarDescuento.pas' {fEditorAsignarDescuento};
uEditorVariarPrecios in 'uEditorVariarPrecios.pas' {fEditorVariarPrecios};
end.

View File

@ -49,33 +49,27 @@
<DelphiCompile Include="PresupuestosCliente_view.dpk">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\..\Albaranes de cliente\adortl.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\Articulos_view.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\Base.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\cxDataD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\cxEditorsD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\cxLibraryD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\DataAbstract_Core_D11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dbrtl.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dsnap.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dxComnD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dxGDIPlusD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dxLayoutControlD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dxThemeD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\GestorInformes_controller.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\GUIBase.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\PreCli_AlbCli_relation.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\PreCli_FacCli_relation.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\PresupuestosCliente_controller.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\PresupuestosCliente_model.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\RemObjects_Core_D11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\rtl.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\vcl.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\vcldb.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\vcljpg.dcp" />
<DCCReference Include="uEditorAsignarDescuento.pas">
<Form>fEditorAsignarDescuento</Form>
</DCCReference>
<DCCReference Include="adortl.dcp" />
<DCCReference Include="Articulos_view.dcp" />
<DCCReference Include="Base.dcp" />
<DCCReference Include="cxDataD11.dcp" />
<DCCReference Include="cxEditorsD11.dcp" />
<DCCReference Include="cxLibraryD11.dcp" />
<DCCReference Include="DataAbstract_Core_D11.dcp" />
<DCCReference Include="dbrtl.dcp" />
<DCCReference Include="dsnap.dcp" />
<DCCReference Include="dxComnD11.dcp" />
<DCCReference Include="dxGDIPlusD11.dcp" />
<DCCReference Include="dxLayoutControlD11.dcp" />
<DCCReference Include="dxThemeD11.dcp" />
<DCCReference Include="GestorInformes_controller.dcp" />
<DCCReference Include="GUIBase.dcp" />
<DCCReference Include="PreCli_AlbCli_relation.dcp" />
<DCCReference Include="PreCli_FacCli_relation.dcp" />
<DCCReference Include="PresupuestosCliente_controller.dcp" />
<DCCReference Include="PresupuestosCliente_model.dcp" />
<DCCReference Include="RemObjects_Core_D11.dcp" />
<DCCReference Include="rtl.dcp" />
<DCCReference Include="uEditorElegirArticulosPresupuestoCliente.pas">
<Form>fEditorElegirArticulosPresupuestoCliente</Form>
<DesignClass>TfEditorElegirArticulosPedidoCliente</DesignClass>
@ -100,6 +94,9 @@
<Form>fEditorPresupuestosClientePreview</Form>
<DesignClass>TfEditorPedidosClientePreview</DesignClass>
</DCCReference>
<DCCReference Include="uEditorVariarPrecios.pas">
<Form>fEditorVariarPrecios</Form>
</DCCReference>
<DCCReference Include="uPresupuestosClienteViewRegister.pas" />
<DCCReference Include="uViewDatosYSeleccionClientePresupuesto.pas">
<Form>frViewDatosYSeleccionClientePresupuesto</Form>
@ -133,6 +130,9 @@
<Form>frViewTotalesPresupuesto</Form>
<DesignClass>TFrame</DesignClass>
</DCCReference>
<DCCReference Include="vcl.dcp" />
<DCCReference Include="vcldb.dcp" />
<DCCReference Include="vcljpg.dcp" />
</ItemGroup>
</Project>
<!-- EurekaLog First Line

View File

@ -1,87 +0,0 @@
object fEditorAsignarDescuento: TfEditorAsignarDescuento
Left = 0
Top = 0
BorderStyle = bsDialog
Caption = 'Asignar descuento'
ClientHeight = 124
ClientWidth = 342
Color = clWindow
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 21
Top = 16
Width = 310
Height = 13
Caption =
'Inserte el descuento que desea asignar a las filas seleccionadas' +
'.'
end
object Label2: TLabel
Left = 45
Top = 45
Width = 55
Height = 13
Alignment = taRightJustify
Caption = 'Descuento:'
end
object Label3: TLabel
Left = 159
Top = 45
Width = 11
Height = 13
Alignment = taRightJustify
Caption = '%'
end
object Panel1: TPanel
Left = 0
Top = 83
Width = 342
Height = 41
Align = alBottom
TabOrder = 0
ExplicitWidth = 497
DesignSize = (
342
41)
object bAceptar: TButton
Left = 178
Top = 8
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = 'Aceptar'
ModalResult = 1
TabOrder = 0
ExplicitLeft = 333
end
object bCancelar: TButton
Left = 259
Top = 8
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = 'Cancelar'
ModalResult = 2
TabOrder = 1
ExplicitLeft = 414
end
end
object sDescuento: TcxSpinEdit
Left = 106
Top = 42
Style.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.NativeStyle = True
TabOrder = 1
Width = 47
end
end

View File

@ -1,47 +0,0 @@
unit uEditorAsignarDescuento;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit,
cxDropDownEdit, cxCalendar, ExtCtrls, uEditorBasico, uIEditorAsignarDescuento,
cxGraphics, DB, uDAInterfaces, uDADataTable, cxDBEdit, uEmpresasController,
cxSpinEdit;
type
TfEditorAsignarDescuento = class(TfEditorBasico, IEditorAsignarDescuento)
Label1: TLabel;
bAceptar: TButton;
bCancelar: TButton;
Label2: TLabel;
Panel1: TPanel;
sDescuento: TcxSpinEdit;
Label3: TLabel;
private
FDescuento: Variant;
function GetDescuento: Variant;
procedure SetDescuento(const Value: Variant);
public
property Descuento: Variant Read GetDescuento write SetDescuento;
end;
implementation
{$R *.dfm}
uses uFactuGES_App;
function TfEditorAsignarDescuento.GetDescuento: Variant;
begin
Result := sDescuento.EditValue;
end;
procedure TfEditorAsignarDescuento.SetDescuento(const Value: Variant);
begin
sDescuento.EditValue := Value;
end;
end.

View File

@ -0,0 +1,130 @@
object fEditorVariarPrecios: TfEditorVariarPrecios
Left = 0
Top = 0
BorderStyle = bsDialog
Caption = 'Variar precios'
ClientHeight = 184
ClientWidth = 387
Color = clWindow
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 21
Top = 16
Width = 354
Height = 13
Caption =
'Seleccione el tipo de variaci'#243'n que desea realizar a las filas s' +
'eleccionadas.'
end
object Label3: TLabel
Left = 263
Top = 53
Width = 11
Height = 13
Alignment = taRightJustify
Caption = '%'
end
object Label2: TLabel
Left = 263
Top = 93
Width = 11
Height = 13
Alignment = taRightJustify
Caption = '%'
FocusControl = bAceptar
end
object Panel1: TPanel
Left = 0
Top = 143
Width = 387
Height = 41
Align = alBottom
TabOrder = 0
ExplicitTop = 83
ExplicitWidth = 342
DesignSize = (
387
41)
object bAceptar: TButton
Left = 223
Top = 8
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = 'Aceptar'
ModalResult = 1
TabOrder = 0
ExplicitLeft = 178
end
object bCancelar: TButton
Left = 304
Top = 8
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = 'Cancelar'
ModalResult = 2
TabOrder = 1
ExplicitLeft = 259
end
end
object sDescuento: TcxSpinEdit
Left = 192
Top = 50
Properties.AssignedValues.MinValue = True
Style.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.NativeStyle = True
TabOrder = 1
Width = 65
end
object rdDescuento: TcxRadioButton
Left = 80
Top = 52
Width = 113
Height = 17
Action = actDescuento
TabOrder = 2
TabStop = True
end
object rdAumento: TcxRadioButton
Left = 80
Top = 92
Width = 113
Height = 17
Action = actAumento
TabOrder = 3
end
object sAumento: TcxSpinEdit
Left = 192
Top = 90
Style.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.NativeStyle = True
TabOrder = 4
Width = 65
end
object ActionListContenido: TActionList
Left = 24
Top = 56
object actDescuento: TAction
Caption = 'Descuento'
Checked = True
OnExecute = actDescuentoExecute
end
object actAumento: TAction
Caption = 'Aumento'
OnExecute = actAumentoExecute
end
end
end

View File

@ -0,0 +1,92 @@
unit uEditorVariarPrecios;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit,
cxDropDownEdit, cxCalendar, ExtCtrls, uEditorBasico, uIEditorVariarPrecios,
cxGraphics, DB, uDAInterfaces, uDADataTable, cxDBEdit, uEmpresasController,
cxSpinEdit, cxRadioGroup, ActnList;
type
TfEditorVariarPrecios = class(TfEditorBasico, IEditorVariarPrecios)
Label1: TLabel;
bAceptar: TButton;
bCancelar: TButton;
Panel1: TPanel;
sDescuento: TcxSpinEdit;
Label3: TLabel;
rdDescuento: TcxRadioButton;
rdAumento: TcxRadioButton;
sAumento: TcxSpinEdit;
Label2: TLabel;
ActionListContenido: TActionList;
actDescuento: TAction;
actAumento: TAction;
procedure actDescuentoExecute(Sender: TObject);
procedure actAumentoExecute(Sender: TObject);
private
FPorcentaje: Variant;
function GetPorcentaje: Variant;
procedure SetPorcentaje(const Value: Variant);
function GetTipoOperacion: Integer;
public
property TipoOperacion: Integer Read GetTipoOperacion;
property Porcentaje: Variant Read GetPorcentaje write SetPorcentaje;
end;
implementation
{$R *.dfm}
uses uFactuGES_App;
procedure TfEditorVariarPrecios.actAumentoExecute(Sender: TObject);
begin
if rdAumento.Checked then
begin
sDescuento.Clear;
sDescuento.Enabled := False;
sAumento.Enabled := True;
end;
end;
procedure TfEditorVariarPrecios.actDescuentoExecute(Sender: TObject);
begin
if rdDescuento.Checked then
begin
sAumento.Clear;
sAumento.Enabled := False;
sDescuento.Enabled := True;
end;
end;
function TfEditorVariarPrecios.GetPorcentaje: Variant;
begin
if rdDescuento.Checked then
Result := sDescuento.EditValue
else
Result := sAumento.EditValue
end;
function TfEditorVariarPrecios.GetTipoOperacion: Integer;
begin
if rdDescuento.Checked then
Result := -1
else if rdAumento.Checked then
Result := 1
else
Result := 0;
end;
procedure TfEditorVariarPrecios.SetPorcentaje(const Value: Variant);
begin
if rdDescuento.Checked then
sDescuento.EditValue := Value
else
sAumento.EditValue := Value;
end;
end.

View File

@ -9,7 +9,7 @@ implementation
uses
uEditorRegistryUtils, uEditorPresupuestosCliente, uEditorPresupuestoCliente, uEditorElegirPresupuestosCliente,
uEditorElegirArticulosPresupuestoCliente, uEditorPresupuestosClienteReport, uEditorAsignarDescuento;
uEditorElegirArticulosPresupuestoCliente, uEditorPresupuestosClienteReport, uEditorVariarPrecios;
procedure RegisterViews;
begin
@ -18,7 +18,7 @@ begin
EditorRegistry.RegisterClass(TfEditorElegirPresupuestosCliente, 'EditorElegirPresupuestosCliente');
EditorRegistry.RegisterClass(TfEditorElegirArticulosPresupuestoCliente, 'EditorElegirArticulosPresupuestosCliente');
EditorRegistry.RegisterClass(TfEditorPresupuestosClientePreview, 'EditorPresupuestosClientePreview');
EditorRegistry.RegisterClass(TfEditorAsignarDescuento, 'EditorAsignarDescuento');
EditorRegistry.RegisterClass(TfEditorVariarPrecios, 'EditorVariarPrecios');
end;
procedure UnregisterViews;
@ -28,7 +28,7 @@ begin
EditorRegistry.UnRegisterClass(TfEditorElegirPresupuestosCliente);
EditorRegistry.UnRegisterClass(TfEditorElegirArticulosPresupuestoCliente);
EditorRegistry.UnRegisterClass(TfEditorPresupuestosClientePreview);
EditorRegistry.UnRegisterClass(TfEditorAsignarDescuento);
EditorRegistry.UnRegisterClass(TfEditorVariarPrecios);
end;
end.

View File

@ -1,83 +1,34 @@
inherited frViewDetallesPresupuestoCliente: TfrViewDetallesPresupuestoCliente
inherited ToolBar1: TToolBar
Height = 73
ExplicitHeight = 73
inherited ToolButton3: TToolButton
Wrap = False
end
inherited ToolButton4: TToolButton
Left = 278
Top = 0
ExplicitLeft = 278
ExplicitTop = 0
end
inherited ToolButton14: TToolButton
Left = 334
Top = 0
ExplicitLeft = 334
ExplicitTop = 0
end
inherited FontName: TJvFontComboBox
Top = 22
ExplicitTop = 22
end
inherited FontSize: TEdit
Top = 22
ExplicitTop = 22
end
inherited UpDown1: TUpDown
Top = 22
ExplicitTop = 22
end
inherited ToolButton13: TToolButton
Top = 22
ExplicitTop = 22
end
inherited ToolButton6: TToolButton
Top = 22
ExplicitTop = 22
end
inherited ToolButton7: TToolButton
Top = 22
ExplicitTop = 22
end
inherited ToolButton8: TToolButton
Top = 22
ExplicitTop = 22
end
inherited ToolButton12: TToolButton
inherited ToolButton11: TToolButton [11]
Left = 0
Top = 22
Wrap = True
ExplicitLeft = 0
ExplicitTop = 22
ExplicitHeight = 27
end
inherited ToolButton9: TToolButton
Left = 0
Top = 49
ExplicitLeft = 0
ExplicitTop = 49
inherited ToolButton6: TToolButton [12]
Left = 141
ExplicitLeft = 141
end
inherited ToolButton10: TToolButton
Left = 145
Top = 49
ExplicitLeft = 145
ExplicitTop = 49
inherited ToolButton8: TToolButton [13]
Left = 207
ExplicitLeft = 207
end
inherited ToolButton11: TToolButton
Left = 270
Top = 49
ExplicitLeft = 270
ExplicitTop = 49
inherited FontSize: TEdit [14]
Left = 290
Width = 58
ExplicitLeft = 290
ExplicitWidth = 58
end
inherited UpDown1: TUpDown [15]
Left = 348
ExplicitLeft = 348
end
end
inherited cxGrid: TcxGrid
Top = 99
Height = 205
ExplicitTop = 99
ExplicitHeight = 205
ExplicitTop = 121
inherited cxGridView: TcxGridDBTableView
inherited cxGridViewPOSICION: TcxGridDBColumn
Visible = True
end
inherited cxGridViewREFERENCIA_PROVEEDOR: TcxGridDBColumn
DataBinding.FieldName = ''
end
@ -90,13 +41,11 @@ inherited frViewDetallesPresupuestoCliente: TfrViewDetallesPresupuestoCliente
end
end
inherited TBXDock1: TTBXDock
Top = 73
ExplicitTop = 73
inherited TBXToolbar1: TTBXToolbar
object TBXSeparatorItem9: TTBXSeparatorItem
end
object TBXItem18: TTBXItem
Action = actAsignarDescuento
Action = actVariarPrecios
end
end
end
@ -104,11 +53,11 @@ inherited frViewDetallesPresupuestoCliente: TfrViewDetallesPresupuestoCliente
inherited actAnadirDescuento: TAction
Caption = 'Linea de descuento'
end
object actAsignarDescuento: TAction
object actVariarPrecios: TAction
Category = 'Operaciones'
Caption = 'Asignar descuento'
OnExecute = actAsignarDescuentoExecute
OnUpdate = actAsignarDescuentoUpdate
Caption = 'Variar precios'
OnExecute = actVariarPreciosExecute
OnUpdate = actVariarPreciosUpdate
end
end
end

View File

@ -25,11 +25,11 @@ type
end;
TfrViewDetallesPresupuestoCliente = class(TfrViewDetallesArticulosParaVenta, IViewDetallesPresupuestoCliente)
actAsignarDescuento: TAction;
actVariarPrecios: TAction;
TBXItem18: TTBXItem;
TBXSeparatorItem9: TTBXSeparatorItem;
procedure actAsignarDescuentoExecute(Sender: TObject);
procedure actAsignarDescuentoUpdate(Sender: TObject);
procedure actVariarPreciosExecute(Sender: TObject);
procedure actVariarPreciosUpdate(Sender: TObject);
protected
FPresupuesto: IBizPresupuestoCliente;
function GetPresupuesto: IBizPresupuestoCliente;
@ -50,36 +50,40 @@ uses uControllerDetallesBase, uDetallesPresupuestoClienteController;
{ TfrViewDetallesPresupuestoProveedor }
procedure TfrViewDetallesPresupuestoCliente.actAsignarDescuentoExecute(Sender: TObject);
procedure TfrViewDetallesPresupuestoCliente.actVariarPreciosExecute(Sender: TObject);
var
AuxTop, AuxRow:Integer;
ADescuento: Variant;
APorcentaje: Variant;
ATipoOperacion: Integer;
begin
ADescuento := (Controller as IDetallesPresupuestoClienteController).PedirDescuento;
if (Controller as IDetallesPresupuestoClienteController).VariarPrecios(APorcentaje, ATipoOperacion) then
begin
ShowHourglassCursor;
_FocusedView.BeginUpdate;
try
ShowHourglassCursor;
_FocusedView.BeginUpdate;
try
if Assigned(Controller) and Assigned(FPresupuesto.Detalles) then
begin
AuxTop := cxGridView.Controller.TopRowIndex;
AuxRow := cxGridView.DataController.FocusedRowIndex;
if ATipoOperacion = -1 then
(Controller as IDetallesPresupuestoClienteController).AsignarDescuento(FPresupuesto.Detalles, darListaSeleccionados, APorcentaje)
else if ATipoOperacion = 1 then
(Controller as IDetallesPresupuestoClienteController).AplicarAumento(FPresupuesto.Detalles, darListaSeleccionados, APorcentaje);
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;
_FocusedView.DataController.SelectRows(AuxRow,AuxRow);
_FocusedView.Controller.TopRowIndex := AuxTop;
end
finally
_FocusedView.EndUpdate;
HideHourglassCursor;
end;
end;
end;
procedure TfrViewDetallesPresupuestoCliente.actAsignarDescuentoUpdate(Sender: TObject);
procedure TfrViewDetallesPresupuestoCliente.actVariarPreciosUpdate(Sender: TObject);
begin
inherited;