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

View File

@ -27,14 +27,8 @@ uses
cxVariants, CtlToRTF, Clipbrd, DB, cxExport, cxGridExportLink, cxCustomData, cxVariants, CtlToRTF, Clipbrd, DB, cxExport, cxGridExportLink, cxCustomData,
uSistemaFunc, ClipboardUtils, cxDBData, cxGridLevel, uStringsUtils, uSistemaFunc, ClipboardUtils, cxDBData, cxGridLevel, uStringsUtils,
cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView, cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGridDBDataDefinitions, uGridStatusUtils; cxGridTableView, cxGridDBTableView, cxGridDBDataDefinitions, uGridStatusUtils,
uDADataTable, uCalculosUtils, uControllerDetallesBase;
const
TIPO_DETALLE_CONCEPTO = 'Concepto';
CAMPO_ID = 'ID';
CAMPO_POSICION = 'POSICION';
CAMPO_TIPO = 'TIPO_DETALLE';
CAMPO_CONCEPTO = 'CONCEPTO';
type type
TTipoAnadir = (taAnadir, taInsertar); TTipoAnadir = (taAnadir, taInsertar);
@ -55,165 +49,6 @@ begin
end; 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; function _BuscarColumna (AView: TcxGridDBTableView;
const AName, ATypeValue : String; var AIndex : Integer) : Boolean; const AName, ATypeValue : String; var AIndex : Integer) : Boolean;
var var
@ -246,7 +81,6 @@ procedure LoadGridRowsFromStream(AView : TcxGridDBTableView; AStream: TStream;
var var
AValueNameList: TStringList; AValueNameList: TStringList;
AValueTypeList: TStringList; AValueTypeList: TStringList;
ADataSet : TDataSet;
ARecordID : Integer; ARecordID : Integer;
ARecordIndex : Integer; ARecordIndex : Integer;
bEstabaVacia : Boolean; bEstabaVacia : Boolean;
@ -259,6 +93,10 @@ var
AValue : Variant; AValue : Variant;
AIndex : integer; AIndex : integer;
//Se adapta para que se utilicen las mismas funciones que en el controllerbase
AControllerDetallesBase: IControllerDetallesBase;
ADataTable: IDAStronglyTypedDataTable;
begin begin
if not Assigned(AView) then if not Assigned(AView) then
raise Exception.Create('Vista no asignada (SaveGridViewToStream)'); raise Exception.Create('Vista no asignada (SaveGridViewToStream)');
@ -266,12 +104,15 @@ begin
if not Assigned(AStream) then if not Assigned(AStream) then
raise Exception.Create('Stream no asignado (SaveGridViewToStream)'); 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); AReader := TcxReader.Create(AStream);
AValueNameList := TStringList.Create; AValueNameList := TStringList.Create;
AValueTypeList := TStringList.Create; AValueTypeList := TStringList.Create;
try try
AControllerDetallesBase:= TControllerDetallesBase.Create;
AIndex := -1; AIndex := -1;
ACaption := AReader.ReadAnsiString; ACaption := AReader.ReadAnsiString;
NumCols := AReader.ReadInteger; // de columnas NumCols := AReader.ReadInteger; // de columnas
@ -285,7 +126,7 @@ begin
end; end;
NumFilas := AReader.ReadInteger; NumFilas := AReader.ReadInteger;
bEstabaVacia := ADataSet.IsEmpty; bEstabaVacia := ADataTable.IsEmpty;
AView.DataController.BeginUpdate; AView.DataController.BeginUpdate;
try try
@ -297,7 +138,7 @@ begin
if ARecordIndex >= 0 then if ARecordIndex >= 0 then
begin begin
ARecordID := AView.DataController.GetRecordId(ARecordIndex); ARecordID := AView.DataController.GetRecordId(ARecordIndex);
ADataSet.Locate(AView.DataController.KeyFieldNames, ARecordID, []); ADataTable.Locate(AView.DataController.KeyFieldNames, ARecordID, []);
end; end;
end; end;
@ -305,16 +146,16 @@ begin
begin begin
// Insertar una tupla de la forma adecuada // Insertar una tupla de la forma adecuada
if bEstabaVacia then if bEstabaVacia then
_NuevaTupla(ADataSet, taAnadir) begin
AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO);
ADataTable.Edit;
end
else begin else begin
if iContador = 0 then if iContador = 0 then
ADataSet.Edit ADataTable.Edit
else begin else begin
ADataSet.Next; AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO);
if ADataSet.EOF then ADataTable.Edit;
_NuevaTupla(ADataSet, taAnadir)
else
_NuevaTupla(ADataSet, taInsertar)
end; end;
end; end;
@ -324,23 +165,18 @@ begin
AValue := AReader.ReadVariant; AValue := AReader.ReadVariant;
if (Pos(AValueNameList[iCols], AView.DataController.KeyFieldNames) = 0) then if (Pos(AValueNameList[iCols], AView.DataController.KeyFieldNames) = 0) then
begin begin
if (AValueNameList[iCols] = 'POSICION') then if (AValueNameList[iCols] <> CAMPO_POSICION) then
ADataSet.FieldByName('POSICION').Value := ADataSet.RecNo if _BuscarColumna(AView, AValueNameList[iCols], AValueTypeList[iCols], AIndex) then
else begin
if _BuscarColumna(AView, AValueNameList[iCols], AValueTypeList[iCols], AIndex) then if AIndex <> -1 then
begin ADataTable.DataTable.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue;
if AIndex <> -1 then end;
ADataSet.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue;
end;
end; end;
end; end;
finally finally
ADataSet.Post; ADataTable.Post;
end; end;
end; end;
_Renumerar(ADataSet);
finally finally
AView.DataController.EndUpdate; AView.DataController.EndUpdate;
end; end;
@ -348,6 +184,7 @@ begin
FreeANDNIL(AReader); FreeANDNIL(AReader);
FreeANDNIL(AValueNameList); FreeANDNIL(AValueNameList);
FreeANDNIL(AValueTypeList); FreeANDNIL(AValueTypeList);
AControllerDetallesBase := Nil;
end; end;
end; end;
{$ENDREGION} {$ENDREGION}
@ -629,13 +466,23 @@ end;
procedure CortarSeleccionGridAlPortapapeles (AGrid : TcxGrid); procedure CortarSeleccionGridAlPortapapeles (AGrid : TcxGrid);
var
//Se adapta para que se utilicen las mismas funciones que en el controllerbase
AControllerDetallesBase: IControllerDetallesBase;
ADataTable : TDADataTable;
begin begin
if Assigned(AGrid) then
ADataTable := ((AGrid.ActiveView as TcxGridDBTableView).DataController.DataSource as TDADataSource).DataTable;
ShowHourglassCursor; ShowHourglassCursor;
try try
AControllerDetallesBase := TControllerDetallesBase.Create;
CopiarSeleccionGridAlPortapapeles(AGrid); CopiarSeleccionGridAlPortapapeles(AGrid);
AGrid.ActiveView.DataController.DeleteSelection; AGrid.ActiveView.DataController.DeleteSelection;
_Renumerar(TcxGridDBTableView(AGrid.ActiveView).DataController.DataSet); AControllerDetallesBase.Renumerar(ADataTable, ADataTable.FieldByName(CAMPO_POSICION).AsInteger);
finally finally
AControllerDetallesBase := Nil;
HideHourglassCursor; HideHourglassCursor;
end; end;
end; end;
@ -678,18 +525,25 @@ var
AGridStatus : TcxGridStatus; AGridStatus : TcxGridStatus;
ATextList : TStringList; ATextList : TStringList;
ADataSet : TDataSet;
ARecordID : Integer; ARecordID : Integer;
ARecordIndex : Integer; ARecordIndex : Integer;
bEstabaVacia : Boolean; bEstabaVacia : Boolean;
AView : TcxGridDBTableView; AView : TcxGridDBTableView;
iContador : Integer; iContador : Integer;
//Se adapta para que se utilicen las mismas funciones que en el controllerbase
AControllerDetallesBase: IControllerDetallesBase;
ADataTable: IDAStronglyTypedDataTable;
begin begin
if not Assigned(AGrid) then if not Assigned(AGrid) then
raise Exception.Create('Grid no asignado (PegarTextoDesdePortapapeles)'); 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; RegistrarFormatos;
if not Clipboard.HasFormat(CF_TEXT) then if not Clipboard.HasFormat(CF_TEXT) then
@ -703,8 +557,8 @@ begin
ATextList := TStringList.Create; ATextList := TStringList.Create;
try try
CopyStringsFromClipboard(CF_TEXT, ATextList); CopyStringsFromClipboard(CF_TEXT, ATextList);
ADataSet := AView.DataController.DataSource.DataSet; AControllerDetallesBase := TControllerDetallesBase.Create;
bEstabaVacia := ADataSet.IsEmpty; bEstabaVacia := ADataTable.IsEmpty;
AView.DataController.BeginUpdate; AView.DataController.BeginUpdate;
try try
// Localizar el punto donde se empieza a insertar // Localizar el punto donde se empieza a insertar
@ -714,7 +568,7 @@ begin
if ARecordIndex >= 0 then if ARecordIndex >= 0 then
begin begin
ARecordID := AView.DataController.GetRecordId(ARecordIndex); ARecordID := AView.DataController.GetRecordId(ARecordIndex);
ADataSet.Locate(AView.DataController.KeyFieldNames, ARecordID, []); ADataTable.Locate(AView.DataController.KeyFieldNames, ARecordID, []);
end; end;
end; end;
@ -722,28 +576,27 @@ begin
begin begin
// Insertar una tupla de la forma adecuada // Insertar una tupla de la forma adecuada
if bEstabaVacia then if bEstabaVacia then
_NuevaTupla(ADataSet, taAnadir) begin
AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO);
ADataTable.Edit;
end
else begin else begin
if iContador = 0 then if iContador = 0 then
ADataSet.Edit ADataTable.Edit
else begin else begin
ADataSet.Next; AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO);
if ADataSet.EOF then ADataTable.Edit;
_NuevaTupla(ADataSet, taAnadir)
else
_NuevaTupla(ADataSet, taInsertar)
end; end;
end; end;
try try
ADataSet.Edit; ADataTable.Edit;
ADataSet.FieldByName('CONCEPTO').AsString := ATextList[iContador]; ADataTable.DataTable.FieldByName('CONCEPTO').AsString := ATextList[iContador];
finally finally
ADataSet.Post; ADataTable.Post;
end; end;
end; end;
_Renumerar(ADataSet);
finally finally
AView.DataController.EndUpdate; AView.DataController.EndUpdate;
end; end;
@ -754,6 +607,7 @@ begin
Clipboard.Close; Clipboard.Close;
AGridStatus.Restore(TcxGridDBTableView(AGrid.ActiveView)); AGridStatus.Restore(TcxGridDBTableView(AGrid.ActiveView));
FreeAndNil(AGridStatus); FreeAndNil(AGridStatus);
AControllerDetallesBase := Nil;
end; end;
end; end;

View File

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

View File

@ -1143,7 +1143,7 @@ procedure TfrViewDetallesBase.actDetallesCopiarExecute(Sender: TObject);
begin begin
ShowHourglassCursor; ShowHourglassCursor;
try try
CopiarSeleccionGridAlPortapapeles(_Grid); CopiarSeleccionGridAlPortapapeles(_Grid, True);
finally finally
HideHourglassCursor; HideHourglassCursor;
end; 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, Obras_controller,
PedProv_AlbProv_relation, PedProv_AlbProv_relation,
PedProv_FacProv_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 contains
uPedidosProveedorViewRegister in 'uPedidosProveedorViewRegister.pas', uPedidosProveedorViewRegister in 'uPedidosProveedorViewRegister.pas',
@ -57,6 +88,7 @@ contains
uViewProveedorPedido in 'uViewProveedorPedido.pas' {frViewProveedorPedido: TFrame}, uViewProveedorPedido in 'uViewProveedorPedido.pas' {frViewProveedorPedido: TFrame},
uEditorElegirPersonaContactoPedido in 'uEditorElegirPersonaContactoPedido.pas' {fEditorElegirPersonaContactoPedido: TfEditorSituacionPedidoProveedor}, uEditorElegirPersonaContactoPedido in 'uEditorElegirPersonaContactoPedido.pas' {fEditorElegirPersonaContactoPedido: TfEditorSituacionPedidoProveedor},
uViewObraReserva in 'uViewObraReserva.pas' {frViewObraReserva: TFrame}, 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. end.

View File

@ -49,20 +49,45 @@
<DelphiCompile Include="PedidosProveedor_view.dpk"> <DelphiCompile Include="PedidosProveedor_view.dpk">
<MainSource>MainSource</MainSource> <MainSource>MainSource</MainSource>
</DelphiCompile> </DelphiCompile>
<DCCReference Include="adortl.dcp" />
<DCCReference Include="Almacenes_controller.dcp" /> <DCCReference Include="Almacenes_controller.dcp" />
<DCCReference Include="Almacenes_model.dcp" /> <DCCReference Include="Almacenes_model.dcp" />
<DCCReference Include="Articulos_view.dcp" /> <DCCReference Include="Articulos_view.dcp" />
<DCCReference Include="Contactos_controller.dcp" /> <DCCReference Include="Contactos_controller.dcp" />
<DCCReference Include="Contactos_model.dcp" /> <DCCReference Include="Contactos_model.dcp" />
<DCCReference Include="Contactos_view.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="GestorInformes_controller.dcp" />
<DCCReference Include="GUIBase.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_controller.dcp" />
<DCCReference Include="Obras_model.dcp" /> <DCCReference Include="Obras_model.dcp" />
<DCCReference Include="PedidosProveedor_controller.dcp" /> <DCCReference Include="PedidosProveedor_controller.dcp" />
<DCCReference Include="PedidosProveedor_model.dcp" /> <DCCReference Include="PedidosProveedor_model.dcp" />
<DCCReference Include="PedProv_AlbProv_relation.dcp" /> <DCCReference Include="PedProv_AlbProv_relation.dcp" />
<DCCReference Include="PedProv_FacProv_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"> <DCCReference Include="uDialogOpcionesImpresionPedidosProveedor.pas">
<Form>fDialogOpcionesImpresionPedidosProveedor</Form> <Form>fDialogOpcionesImpresionPedidosProveedor</Form>
<DesignClass>TForm</DesignClass> <DesignClass>TForm</DesignClass>
@ -100,6 +125,7 @@
<DesignClass>TfEditorSituacionPedidoProveedor</DesignClass> <DesignClass>TfEditorSituacionPedidoProveedor</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="uPedidosProveedorViewRegister.pas" /> <DCCReference Include="uPedidosProveedorViewRegister.pas" />
<DCCReference Include="uViewDatosYSeleccionProveedorPedido.pas" />
<DCCReference Include="uViewDetallesPedidoProveedor.pas"> <DCCReference Include="uViewDetallesPedidoProveedor.pas">
<Form>frViewDetallesPedidoProveedor</Form> <Form>frViewDetallesPedidoProveedor</Form>
<DesignClass>TFrame</DesignClass> <DesignClass>TFrame</DesignClass>
@ -128,6 +154,12 @@
<Form>frViewProveedorPedido</Form> <Form>frViewProveedorPedido</Form>
<DesignClass>TFrame</DesignClass> <DesignClass>TFrame</DesignClass>
</DCCReference> </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> </ItemGroup>
</Project> </Project>
<!-- EurekaLog First Line <!-- EurekaLog First Line

View File

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

View File

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

View File

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

View File

@ -59,13 +59,13 @@
<DCCReference Include="View\GUIBase.dcp" /> <DCCReference Include="View\GUIBase.dcp" />
<DCCReference Include="View\PresupuestosCliente_data.dcp" /> <DCCReference Include="View\PresupuestosCliente_data.dcp" />
<DCCReference Include="View\PresupuestosCliente_model.dcp" /> <DCCReference Include="View\PresupuestosCliente_model.dcp" />
<DCCReference Include="View\uIEditorAsignarDescuento.pas" />
<DCCReference Include="View\uIEditorDireccionEntregaPresupuestoCliente.pas" /> <DCCReference Include="View\uIEditorDireccionEntregaPresupuestoCliente.pas" />
<DCCReference Include="View\uIEditorElegirArticulosPresupuestosCliente.pas" /> <DCCReference Include="View\uIEditorElegirArticulosPresupuestosCliente.pas" />
<DCCReference Include="View\uIEditorElegirPresupuestosCliente.pas" /> <DCCReference Include="View\uIEditorElegirPresupuestosCliente.pas" />
<DCCReference Include="View\uIEditorPresupuestoCliente.pas" /> <DCCReference Include="View\uIEditorPresupuestoCliente.pas" />
<DCCReference Include="View\uIEditorPresupuestosCliente.pas" /> <DCCReference Include="View\uIEditorPresupuestosCliente.pas" />
<DCCReference Include="View\uIEditorPresupuestosClientePreview.pas" /> <DCCReference Include="View\uIEditorPresupuestosClientePreview.pas" />
<DCCReference Include="View\uIEditorVariarPrecios.pas" />
</ItemGroup> </ItemGroup>
</Project> </Project>
<!-- EurekaLog First Line <!-- 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 interface
@ -13,7 +13,8 @@ type
procedure ActualizarDetalles(ADetalles: IDAStronglyTypedDataTable; ACliente: IBizCliente); overload; procedure ActualizarDetalles(ADetalles: IDAStronglyTypedDataTable; ACliente: IBizCliente); overload;
procedure DesglosarPorteDetalles(ImportePorte: Currency; ADetalles: IDAStronglyTypedDataTable); procedure DesglosarPorteDetalles(ImportePorte: Currency; ADetalles: IDAStronglyTypedDataTable);
function DarTotalPorteTotal(ADetalles: IDAStronglyTypedDataTable): Double; 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; end;
TDetallesPresupuestoClienteController = class(TControllerDetallesArticulos, IDetallesPresupuestoClienteController) TDetallesPresupuestoClienteController = class(TControllerDetallesArticulos, IDetallesPresupuestoClienteController)
@ -34,9 +35,10 @@ type
function DarTotalPorteTotal(ADetalles: IDAStronglyTypedDataTable): Double; function DarTotalPorteTotal(ADetalles: IDAStronglyTypedDataTable): Double;
public 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 AnadirArticulos(ADetalles: IDAStronglyTypedDataTable; ACliente: IBizCliente; const ANuevaFila :Boolean = True); reintroduce; overload;
procedure ActualizarDetalles(ADetalles: IDAStronglyTypedDataTable; ACliente: IBizCliente); overload; procedure ActualizarDetalles(ADetalles: IDAStronglyTypedDataTable; ACliente: IBizCliente); overload;
procedure AplicarAumento(ADataTable: IDAStronglyTypedDataTable; Posicion: TIntegerArray; APorcentaje: Variant);
constructor Create; override; constructor Create; override;
destructor Destroy; override; destructor Destroy; override;
end; end;
@ -44,7 +46,7 @@ type
implementation implementation
uses Controls, SysUtils, Dialogs, uDAInterfaces, uDialogUtils, Variants, uDataModulePresupuestosCliente, uArticulosPresupuestoClienteController, uses Controls, SysUtils, Dialogs, uDAInterfaces, uDialogUtils, Variants, uDataModulePresupuestosCliente, uArticulosPresupuestoClienteController,
uDataTableUtils, uCalculosUtils, uIEditorAsignarDescuento, uEditorRegistryUtils; uDataTableUtils, uCalculosUtils, uIEditorVariarPrecios, uEditorRegistryUtils;
{ TDetallesPresupuestoClienteController } { TDetallesPresupuestoClienteController }
@ -91,27 +93,52 @@ begin
end; end;
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; procedure TDetallesPresupuestoClienteController.AsignarController;
begin begin
FArticulosController := TArticulosPresupuestoClienteController.Create; FArticulosController := TArticulosPresupuestoClienteController.Create;
end; 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); procedure TDetallesPresupuestoClienteController.AsignarDatos(ADetalles: IDAStronglyTypedDataTable; IDCabecera: Integer);
begin begin
@ -175,6 +202,28 @@ begin
ValidarCamposLineaConcepto(DataTable); ValidarCamposLineaConcepto(DataTable);
end; 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); procedure TDetallesPresupuestoClienteController.RellenarImportes(ADetalles: IDAStronglyTypedDataTable; AArticulos: IBizArticulo);
begin begin
//Como en tecsitel no hay descuento por linea de detalle, solo recuperamos nuevamente el valor del articulo cuando el detalle no tenga niguno //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}, uViewDocumentosPresupuestoCliente in 'uViewDocumentosPresupuestoCliente.pas' {frViewDocumentosPresupuestoCliente: TFrame},
uViewDatosYSeleccionClientePresupuesto in 'uViewDatosYSeleccionClientePresupuesto.pas' {frViewDatosYSeleccionClientePresupuesto: TFrame}, uViewDatosYSeleccionClientePresupuesto in 'uViewDatosYSeleccionClientePresupuesto.pas' {frViewDatosYSeleccionClientePresupuesto: TFrame},
uViewTotalesPresupuesto in 'uViewTotalesPresupuesto.pas' {frViewTotalesPresupuesto: TFrame}, uViewTotalesPresupuesto in 'uViewTotalesPresupuesto.pas' {frViewTotalesPresupuesto: TFrame},
uEditorAsignarDescuento in 'uEditorAsignarDescuento.pas' {fEditorAsignarDescuento}; uEditorVariarPrecios in 'uEditorVariarPrecios.pas' {fEditorVariarPrecios};
end. end.

View File

@ -49,33 +49,27 @@
<DelphiCompile Include="PresupuestosCliente_view.dpk"> <DelphiCompile Include="PresupuestosCliente_view.dpk">
<MainSource>MainSource</MainSource> <MainSource>MainSource</MainSource>
</DelphiCompile> </DelphiCompile>
<DCCReference Include="..\..\Albaranes de cliente\adortl.dcp" /> <DCCReference Include="adortl.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\Articulos_view.dcp" /> <DCCReference Include="Articulos_view.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\Base.dcp" /> <DCCReference Include="Base.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\cxDataD11.dcp" /> <DCCReference Include="cxDataD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\cxEditorsD11.dcp" /> <DCCReference Include="cxEditorsD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\cxLibraryD11.dcp" /> <DCCReference Include="cxLibraryD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\DataAbstract_Core_D11.dcp" /> <DCCReference Include="DataAbstract_Core_D11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dbrtl.dcp" /> <DCCReference Include="dbrtl.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dsnap.dcp" /> <DCCReference Include="dsnap.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dxComnD11.dcp" /> <DCCReference Include="dxComnD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dxGDIPlusD11.dcp" /> <DCCReference Include="dxGDIPlusD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dxLayoutControlD11.dcp" /> <DCCReference Include="dxLayoutControlD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\dxThemeD11.dcp" /> <DCCReference Include="dxThemeD11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\GestorInformes_controller.dcp" /> <DCCReference Include="GestorInformes_controller.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\GUIBase.dcp" /> <DCCReference Include="GUIBase.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\PreCli_AlbCli_relation.dcp" /> <DCCReference Include="PreCli_AlbCli_relation.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\PreCli_FacCli_relation.dcp" /> <DCCReference Include="PreCli_FacCli_relation.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\PresupuestosCliente_controller.dcp" /> <DCCReference Include="PresupuestosCliente_controller.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\PresupuestosCliente_model.dcp" /> <DCCReference Include="PresupuestosCliente_model.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\RemObjects_Core_D11.dcp" /> <DCCReference Include="RemObjects_Core_D11.dcp" />
<DCCReference Include="..\..\Albaranes de cliente\rtl.dcp" /> <DCCReference Include="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="uEditorElegirArticulosPresupuestoCliente.pas"> <DCCReference Include="uEditorElegirArticulosPresupuestoCliente.pas">
<Form>fEditorElegirArticulosPresupuestoCliente</Form> <Form>fEditorElegirArticulosPresupuestoCliente</Form>
<DesignClass>TfEditorElegirArticulosPedidoCliente</DesignClass> <DesignClass>TfEditorElegirArticulosPedidoCliente</DesignClass>
@ -100,6 +94,9 @@
<Form>fEditorPresupuestosClientePreview</Form> <Form>fEditorPresupuestosClientePreview</Form>
<DesignClass>TfEditorPedidosClientePreview</DesignClass> <DesignClass>TfEditorPedidosClientePreview</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="uEditorVariarPrecios.pas">
<Form>fEditorVariarPrecios</Form>
</DCCReference>
<DCCReference Include="uPresupuestosClienteViewRegister.pas" /> <DCCReference Include="uPresupuestosClienteViewRegister.pas" />
<DCCReference Include="uViewDatosYSeleccionClientePresupuesto.pas"> <DCCReference Include="uViewDatosYSeleccionClientePresupuesto.pas">
<Form>frViewDatosYSeleccionClientePresupuesto</Form> <Form>frViewDatosYSeleccionClientePresupuesto</Form>
@ -133,6 +130,9 @@
<Form>frViewTotalesPresupuesto</Form> <Form>frViewTotalesPresupuesto</Form>
<DesignClass>TFrame</DesignClass> <DesignClass>TFrame</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="vcl.dcp" />
<DCCReference Include="vcldb.dcp" />
<DCCReference Include="vcljpg.dcp" />
</ItemGroup> </ItemGroup>
</Project> </Project>
<!-- EurekaLog First Line <!-- 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 uses
uEditorRegistryUtils, uEditorPresupuestosCliente, uEditorPresupuestoCliente, uEditorElegirPresupuestosCliente, uEditorRegistryUtils, uEditorPresupuestosCliente, uEditorPresupuestoCliente, uEditorElegirPresupuestosCliente,
uEditorElegirArticulosPresupuestoCliente, uEditorPresupuestosClienteReport, uEditorAsignarDescuento; uEditorElegirArticulosPresupuestoCliente, uEditorPresupuestosClienteReport, uEditorVariarPrecios;
procedure RegisterViews; procedure RegisterViews;
begin begin
@ -18,7 +18,7 @@ begin
EditorRegistry.RegisterClass(TfEditorElegirPresupuestosCliente, 'EditorElegirPresupuestosCliente'); EditorRegistry.RegisterClass(TfEditorElegirPresupuestosCliente, 'EditorElegirPresupuestosCliente');
EditorRegistry.RegisterClass(TfEditorElegirArticulosPresupuestoCliente, 'EditorElegirArticulosPresupuestosCliente'); EditorRegistry.RegisterClass(TfEditorElegirArticulosPresupuestoCliente, 'EditorElegirArticulosPresupuestosCliente');
EditorRegistry.RegisterClass(TfEditorPresupuestosClientePreview, 'EditorPresupuestosClientePreview'); EditorRegistry.RegisterClass(TfEditorPresupuestosClientePreview, 'EditorPresupuestosClientePreview');
EditorRegistry.RegisterClass(TfEditorAsignarDescuento, 'EditorAsignarDescuento'); EditorRegistry.RegisterClass(TfEditorVariarPrecios, 'EditorVariarPrecios');
end; end;
procedure UnregisterViews; procedure UnregisterViews;
@ -28,7 +28,7 @@ begin
EditorRegistry.UnRegisterClass(TfEditorElegirPresupuestosCliente); EditorRegistry.UnRegisterClass(TfEditorElegirPresupuestosCliente);
EditorRegistry.UnRegisterClass(TfEditorElegirArticulosPresupuestoCliente); EditorRegistry.UnRegisterClass(TfEditorElegirArticulosPresupuestoCliente);
EditorRegistry.UnRegisterClass(TfEditorPresupuestosClientePreview); EditorRegistry.UnRegisterClass(TfEditorPresupuestosClientePreview);
EditorRegistry.UnRegisterClass(TfEditorAsignarDescuento); EditorRegistry.UnRegisterClass(TfEditorVariarPrecios);
end; end;
end. end.

View File

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

View File

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