diff --git a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj index 3f3303c..7623b2b 100644 --- a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj +++ b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj @@ -59,10 +59,6 @@ - - - - @@ -78,16 +74,16 @@ MainSource - - - - - - - - - - + + + + + + + + + +
frDialogOpcionesImpresionAlbaranesCliente
diff --git a/Source/Modulos/Albaranes de cliente/Views/uViewDetallesAlbaranCliente.dfm b/Source/Modulos/Albaranes de cliente/Views/uViewDetallesAlbaranCliente.dfm index f78c1b2..c4c2263 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uViewDetallesAlbaranCliente.dfm +++ b/Source/Modulos/Albaranes de cliente/Views/uViewDetallesAlbaranCliente.dfm @@ -2,7 +2,6 @@ inherited frViewDetallesAlbaranCliente: TfrViewDetallesAlbaranCliente inherited cxGrid: TcxGrid inherited cxGridView: TcxGridDBTableView inherited cxGridViewVISIBLE: TcxGridDBColumn [4] - Visible = True end inherited cxGridViewVALORADO: TcxGridDBColumn [5] Visible = True @@ -30,6 +29,16 @@ inherited frViewDetallesAlbaranCliente: TfrViewDetallesAlbaranCliente end end end + inherited TBXDock1: TTBXDock + inherited TBXToolbar1: TTBXToolbar + DockPos = 0 + object BAnadirCapitulo: TTBXSubmenuItem [0] + Caption = 'A'#241'adir Cap'#237'tulo' + object TBXItem14: TTBXItem + end + end + end + end object cxRichEdit1: TcxRichEdit [3] Left = 78 Top = 225 @@ -48,4 +57,11 @@ inherited frViewDetallesAlbaranCliente: TfrViewDetallesAlbaranCliente Height = 25 Width = 145 end + inherited ActionListContenido: TActionList + object actCapituloVarios: TAction + Category = 'Operaciones' + Caption = 'Cap'#237'tulo de varios' + OnExecute = actCapituloVariosExecute + end + end end diff --git a/Source/Modulos/Albaranes de cliente/Views/uViewDetallesAlbaranCliente.pas b/Source/Modulos/Albaranes de cliente/Views/uViewDetallesAlbaranCliente.pas index f1ed23a..c04d671 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uViewDetallesAlbaranCliente.pas +++ b/Source/Modulos/Albaranes de cliente/Views/uViewDetallesAlbaranCliente.pas @@ -25,16 +25,24 @@ type TfrViewDetallesAlbaranCliente = class(TfrViewDetallesArticulos, IViewDetallesAlbaranCliente) cxRichEdit1: TcxRichEdit; + BAnadirCapitulo: TTBXSubmenuItem; + TBXItem14: TTBXItem; + actCapituloVarios: TAction; procedure cxGridViewDESCRIPCIONGetPropertiesForEdit( Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AProperties: TcxCustomEditProperties); + procedure actCapituloVariosExecute(Sender: TObject); + + private + procedure AnadirCapitulo(const Tipo: String;const Descripcion: String; const Descuento:Boolean = false); + protected FAlbaran: IBizAlbaranCliente; function GetAlbaran: IBizAlbaranCliente; procedure SetAlbaran(const Value: IBizAlbaranCliente); procedure AnadirArticulosInterno; override; - procedure RellenarArticulosInterno; override; + procedure RellenarArticulosInterno; override; function AnadirArticulo(pReferencia: String; TipoReferencia: TEnumReferencia): Boolean; override; public @@ -48,6 +56,13 @@ uses uDetallesAlbaranClienteController, uViewDetallesBase; { TfrViewDetallesAlbaranProveedor } +procedure TfrViewDetallesAlbaranCliente.actCapituloVariosExecute( + Sender: TObject); +begin + inherited; +// AnadirCapitulo(TIPO_CAPITULO_V, 'VARIOS '); +end; + function TfrViewDetallesAlbaranCliente.AnadirArticulo(pReferencia: String; TipoReferencia: TEnumReferencia): Boolean; begin if (Albaran.TIPO = CTE_TIPO_ALBARAN_DEV) then @@ -64,6 +79,36 @@ begin (Controller as IDetallesAlbaranClienteController).AnadirArticulos(Detalles, Albaran.Cliente); end; +procedure TfrViewDetallesAlbaranCliente.AnadirCapitulo(const Tipo, Descripcion: String; const Descuento: Boolean); +var + bEsMultiSelect : Boolean; +begin +{ + // Debo quitar el multiselect porque provoca que se quede seleccionado + // el registro actual y no el nuevo registro que voy a añadir + bEsMultiSelect := _FocusedView.OptionsSelection.MultiSelect; + if bEsMultiSelect then + _FocusedView.OptionsSelection.MultiSelect := False; + + ShowHourglassCursor; + _FocusedView.BeginUpdate; + try + if _FocusedView.Controller.EditingController.IsEditing then + _FocusedView.Controller.EditingController.Edit.PostEditValue; + + if Assigned(Controller) and Assigned(Detalles) then + (Controller as IDetallesContratoClienteController).AnadirCapitulo(Tipo, Descripcion, Descuento, Detalles) + finally + _FocusedView.EndUpdate; + HideHourglassCursor; + + // Dejo la propiedad MultiSelect como estaba + if bEsMultiSelect then + _FocusedView.OptionsSelection.MultiSelect := bEsMultiSelect; + end; +} +end; + procedure TfrViewDetallesAlbaranCliente.cxGridViewDESCRIPCIONGetPropertiesForEdit( Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AProperties: TcxCustomEditProperties); diff --git a/Source/Modulos/Contratos de cliente/Controller/uContratosClienteController.pas b/Source/Modulos/Contratos de cliente/Controller/uContratosClienteController.pas index 4459627..3a99e16 100644 --- a/Source/Modulos/Contratos de cliente/Controller/uContratosClienteController.pas +++ b/Source/Modulos/Contratos de cliente/Controller/uContratosClienteController.pas @@ -29,6 +29,7 @@ type property GestorDocumentosController: IGestorDocumentosController read GetGestorDocumentosController write SetGestorDocumentosController; procedure RecuperarCliente(AContrato : IBizContratoCliente); + procedure ActualizarFormaDePago(AContrato : IBizContratoCliente; ID_FORMA_PAGO: Integer); function Buscar(const ID: Integer): IBizContratoCliente; overload; function Buscar(const ListaID: TIntegerList): IBizContratoCliente; overload; function BuscarTodos: IBizContratoCliente; overload; @@ -106,6 +107,7 @@ type function Localizar(AContratos: IBizContratoCliente; const ID : Integer): Boolean; procedure RecuperarCliente(AContrato : IBizContratoCliente); + procedure ActualizarFormaDePago(AContrato : IBizContratoCliente; ID_FORMA_PAGO: Integer); function Eliminar(const ID : Integer): Boolean; overload; function Eliminar(AContrato : IBizContratoCliente; AllItems: Boolean = false): Boolean; overload; function Guardar(AContrato : IBizContratoCliente): Boolean; @@ -159,6 +161,31 @@ uses { TContratosClienteController } +procedure TContratosClienteController.ActualizarFormaDePago( + AContrato: IBizContratoCliente; ID_FORMA_PAGO: Integer); +var + AFormasPago : IBizFormaPago; + AFormasPagoController : IFormasPagoController; + bEnEdicion : Boolean; +begin + AFormasPagoController := TFormasPagoController.Create; + AFormasPago := AFormasPagoController.Buscar(ID_FORMA_PAGO); + AFormasPago.Open; + + bEnEdicion := (AContrato.DataTable.State in dsEditModes); + if not bEnEdicion then + AContrato.Edit; + + AContrato.ID_FORMA_PAGO := AFormasPago.ID; + AContrato.DataTable.FieldByName(fld_ContratosClienteFORMA_PAGO).AsString := AFormasPago.DESCRIPCION; + + if not bEnEdicion then + AContrato.Post; + + AFormasPago := NIL; + AFormasPagoController := NIL; +end; + function TContratosClienteController.Anadir(AContrato : IBizContratoCliente; const ATipo: TEnumTiposContrato = teVarios) : Boolean; begin diff --git a/Source/Modulos/Contratos de cliente/Views/uEditorContratoCliente.dfm b/Source/Modulos/Contratos de cliente/Views/uEditorContratoCliente.dfm index 7284336..71a4a99 100644 --- a/Source/Modulos/Contratos de cliente/Views/uEditorContratoCliente.dfm +++ b/Source/Modulos/Contratos de cliente/Views/uEditorContratoCliente.dfm @@ -209,51 +209,45 @@ inherited fEditorContratoCliente: TfEditorContratoCliente inherited ToolBar1: TToolBar Width = 831 ExplicitWidth = 831 - inherited FontSize: TEdit [5] - Left = 0 - Width = 90 - ExplicitLeft = 0 - ExplicitWidth = 90 + inherited FontSize: TEdit + Width = 108 + ExplicitWidth = 108 end - inherited UpDown1: TUpDown [6] - Left = 90 - ExplicitLeft = 90 - end - inherited FontName: TJvFontComboBox [7] - Left = 107 - ExplicitLeft = 107 + inherited UpDown1: TUpDown + Left = 253 + ExplicitLeft = 253 end inherited ToolButton13: TToolButton - Left = 252 - ExplicitLeft = 252 + Left = 270 + ExplicitLeft = 270 end inherited ToolButton6: TToolButton - Left = 260 - ExplicitLeft = 260 + Left = 278 + ExplicitLeft = 278 end inherited ToolButton7: TToolButton - Left = 294 - ExplicitLeft = 294 + Left = 312 + ExplicitLeft = 312 end inherited ToolButton8: TToolButton - Left = 328 - ExplicitLeft = 328 + Left = 346 + ExplicitLeft = 346 end inherited ToolButton12: TToolButton - Left = 362 - ExplicitLeft = 362 + Left = 380 + ExplicitLeft = 380 end inherited ToolButton9: TToolButton - Left = 370 - ExplicitLeft = 370 + Left = 388 + ExplicitLeft = 388 end inherited ToolButton10: TToolButton - Left = 404 - ExplicitLeft = 404 + Left = 422 + ExplicitLeft = 422 end inherited ToolButton11: TToolButton - Left = 438 - ExplicitLeft = 438 + Left = 456 + ExplicitLeft = 456 end end inherited cxGrid: TcxGrid diff --git a/Source/Modulos/Contratos de cliente/Views/uEditorContratoCliente.pas b/Source/Modulos/Contratos de cliente/Views/uEditorContratoCliente.pas index 5f44ce5..5150f4f 100644 --- a/Source/Modulos/Contratos de cliente/Views/uEditorContratoCliente.pas +++ b/Source/Modulos/Contratos de cliente/Views/uEditorContratoCliente.pas @@ -308,13 +308,26 @@ begin end; procedure TfEditorContratoCliente.OnClienteChanged(Sender: TObject); +var + APrimerCliente : Boolean; begin if Assigned(FContrato) then begin + APrimerCliente := (FContrato.Cliente.ID = 0); FContrato.Cliente := ViewContrato.ViewClienteContrato.Cliente; - if (FContrato.Detalles.RecordCount > 0) then - FController.DetallesController.ActualizarDetalles(FContrato.Detalles, FContrato.Cliente); + if (ShowConfirmMessage('Cambio forma de pago', '¿Desea actualizar la forma de pago a la asignada en la ficha del cliente seleccionado?') = IDYES) then + FController.ActualizarFormaDePago(FContrato, FContrato.Cliente.ID_FORMA_PAGO); + + if (not APrimerCliente) and (FContrato.Detalles.RecordCount > 0) then begin + if (ShowConfirmMessage('Actualizar los descuentos de las líneas', + '¿Desea actualizar las líneas de detalle con el descuento del cliente?' + #10#13 + + 'Sólo se cambiarán las líneas que tengan cantidades.') = IDYES) then + begin + FController.DetallesController.ActualizarDetalles(FContrato.Detalles, FContrato.Cliente); + ShowInfoMessage('Se han actualizado las líneas con el descuento del cliente seleccionado'); + end; + end; end; end; diff --git a/Source/Modulos/Contratos de cliente/Views/uViewDetallesContratoCliente.pas b/Source/Modulos/Contratos de cliente/Views/uViewDetallesContratoCliente.pas index 7260d2b..0b82d05 100644 --- a/Source/Modulos/Contratos de cliente/Views/uViewDetallesContratoCliente.pas +++ b/Source/Modulos/Contratos de cliente/Views/uViewDetallesContratoCliente.pas @@ -296,10 +296,11 @@ begin if (AItem.Index in [cxGridViewDESCUENTO.Index]) then begin //Esto es para que solo sea editable la columna dto en las lineas de tipo descuento (para hacer descuento por capitulo), -//al comentarlo permitimos que se pueda añadir además descuentos a nivel de lineas -// IndiceCol := cxGridView.GetColumnByFieldName(CAMPO_TIPO).Index; -// if (AItem.GridView.Items[IndiceCol].EditValue <> TIPO_DETALLE_DESCUENTO) then -// Result := False +//además descuentos a nivel de lineas de detalle + IndiceCol := cxGridView.GetColumnByFieldName(CAMPO_TIPO).Index; + if (AItem.GridView.Items[IndiceCol].EditValue <> TIPO_DETALLE_DESCUENTO) + and (AItem.GridView.Items[IndiceCol].EditValue <> TIPO_DETALLE_CONCEPTO) then + Result := False end else if (AItem.Index in [cxGridViewPROPIEDAD.Index, cxGridViewTIPO_ARTICULO.Index]) then begin diff --git a/Source/Modulos/Facturas de cliente/Controller/FacturasCliente_controller.dproj b/Source/Modulos/Facturas de cliente/Controller/FacturasCliente_controller.dproj index f309cba..8d6ad1a 100644 --- a/Source/Modulos/Facturas de cliente/Controller/FacturasCliente_controller.dproj +++ b/Source/Modulos/Facturas de cliente/Controller/FacturasCliente_controller.dproj @@ -49,19 +49,19 @@ MainSource + + + + + + + + + - - - - - - - - - diff --git a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas index 23e3a44..a71c14f 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas @@ -36,6 +36,7 @@ type procedure DescartarCambios(AFactura : IBizFacturaCliente); function Existe(const ID: Integer) : Boolean; procedure RecuperarCliente(AFactura : IBizFacturaCliente); + procedure ActualizarFormaDePago(AFactura : IBizFacturaCliente; ID_FORMA_PAGO: Integer); function Duplicar(AFactura: IBizFacturaCliente): IBizFacturaCliente; function GenerarAbono(AFactura: IBizFacturaCliente): IBizFacturaCliente; @@ -101,6 +102,7 @@ type function Duplicar(AFactura: IBizFacturaCliente): IBizFacturaCliente; function GenerarAbono(AFactura: IBizFacturaCliente): IBizFacturaCliente; procedure RecuperarCliente(AFactura : IBizFacturaCliente); + procedure ActualizarFormaDePago(AFactura : IBizFacturaCliente; ID_FORMA_PAGO: Integer); procedure Preview(AFactura : IBizFacturaCliente; AllItems: Boolean = false; VerLogotipo: Boolean = true); procedure Print(AFactura : IBizFacturaCliente; AllItems: Boolean = false; VerLogotipo: Boolean = true); @@ -202,6 +204,23 @@ begin Result := True; end; +procedure TFacturasClienteController.ActualizarFormaDePago( + AFactura: IBizFacturaCliente; ID_FORMA_PAGO: Integer); +var + AFormasPago : IBizFormaPago; + AFormasPagoController : IFormasPagoController; +begin + AFormasPagoController := TFormasPagoController.Create; + AFormasPago := AFormasPagoController.Buscar(ID_FORMA_PAGO); + AFormasPago.Open; + + AFactura.ID_FORMA_PAGO := AFormasPago.ID; +// AFactura.DataTable.FieldByName(fld_FacturasClienteFORMA_PAGO).AsString := AFormasPago.DESCRIPCION; + + AFormasPago := NIL; + AFormasPagoController := NIL; +end; + function TFacturasClienteController.Anadir(AFacturas: IBizFacturaCliente; AListaAlbaranes: IBizAlbaranCliente): Boolean; var diff --git a/Source/Modulos/Facturas de cliente/FacturasCliente_Group.groupproj b/Source/Modulos/Facturas de cliente/FacturasCliente_Group.groupproj index 1299099..b81a759 100644 --- a/Source/Modulos/Facturas de cliente/FacturasCliente_Group.groupproj +++ b/Source/Modulos/Facturas de cliente/FacturasCliente_Group.groupproj @@ -16,11 +16,15 @@ + + + + @@ -231,14 +235,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + \ No newline at end of file diff --git a/Source/Modulos/Facturas de cliente/Model/uBizFacturasCliente.pas b/Source/Modulos/Facturas de cliente/Model/uBizFacturasCliente.pas index c2a77a3..87283bb 100644 --- a/Source/Modulos/Facturas de cliente/Model/uBizFacturasCliente.pas +++ b/Source/Modulos/Facturas de cliente/Model/uBizFacturasCliente.pas @@ -69,9 +69,9 @@ type procedure DESCUENTOOnChange(Sender: TDACustomField); procedure IVAOnChange(Sender: TDACustomField); procedure REOnChange(Sender: TDACustomField); - procedure SetID_TIENDAValue(const aValue: Integer); + procedure SetID_TIENDAValue(const aValue: Integer); procedure SetID_SUBCUENTAValue(const aValue: Integer); - + procedure OnNewRecord(Sender: TDADataTable); override; function GetSITUACIONValue: String; override; @@ -338,8 +338,9 @@ begin CODIGO_POSTAL := FCliente.CODIGO_POSTAL; PROVINCIA := FCliente.PROVINCIA; POBLACION := FCliente.POBLACION; - if FCliente.ID_FORMA_PAGO > 0 then - ID_FORMA_PAGO := FCliente.ID_FORMA_PAGO; +// La forma de pago se establece desde el tipo de documento y aunque cambie de cliente no se cambia la formade pago ya que desde la vista se pregunta y se cambia si el usuario lo desea +// if FCliente.ID_FORMA_PAGO > 0 then +// ID_FORMA_PAGO := FCliente.ID_FORMA_PAGO; if FCliente.ID_TIPO_IVA > 0 then ID_TIPO_IVA := FCliente.ID_TIPO_IVA; RECARGO_EQUIVALENCIA := FCliente.RECARGO_EQUIVALENCIA; diff --git a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm index 2c44334..1a53ea1 100644 --- a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm +++ b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm @@ -1088,11 +1088,11 @@ object RptFacturasCliente: TRptFacturasCliente Connection = 'IBX' TargetTable = 'FACTURAS_CLIENTE_DETALLES' SQL = - 'SELECT'#10' ID, ID_FACTURA, POSICION, TIPO_DETALLE, F_RTFTOTEXT(C' + - 'ONCEPTO) AS CONCEPTO,'#10' CONCEPTO AS CONCEPTO_RTF, CANTIDAD,'#10' ' + - ' IMPORTE_UNIDAD, DESCUENTO, IMPORTE_TOTAL, VISIBLE, VALORADO'#10'FR' + - 'OM FACTURAS_CLIENTE_DETALLES'#10'WHERE ID_FACTURA = :ID_FACTURA'#10'ORDE' + - 'R BY POSICION;'#10 + 'SELECT'#10' ID, ID_FACTURA, POSICION, TIPO_DETALLE,'#10' CONCEPTO,' + + #10'/*'#10' F_RTFTOTEXT(CONCEPTO) AS CONCEPTO,'#10' CONCEPTO AS CONC' + + 'EPTO_RTF,'#10'*/'#10' CANTIDAD,'#10' IMPORTE_UNIDAD, DESCUENTO, IMPORT' + + 'E_TOTAL, VISIBLE, VALORADO'#10'FROM FACTURAS_CLIENTE_DETALLES'#10'WHERE ' + + 'ID_FACTURA = :ID_FACTURA'#10'ORDER BY POSICION;'#10 StatementType = stSQL ColumnMappings = < item @@ -1135,11 +1135,6 @@ object RptFacturasCliente: TRptFacturasCliente DatasetField = 'DESCUENTO' TableField = 'DESCUENTO' end - item - DatasetField = 'CONCEPTO_RTF' - TableField = 'CONCEPTO' - SQLOrigin = 'CONCEPTO_RTF' - end item DatasetField = 'VALORADO' TableField = 'VALORADO' @@ -1147,10 +1142,6 @@ object RptFacturasCliente: TRptFacturasCliente end> Name = 'InformeFacturasCliente_Detalles' Fields = < - item - Name = 'VALORADO' - DataType = datSmallInt - end item Name = 'ID' DataType = datAutoInc @@ -1176,14 +1167,8 @@ object RptFacturasCliente: TRptFacturasCliente item Name = 'CONCEPTO' DataType = datString - Size = 32765 - DictionaryEntry = 'FacturasCliente_Detalles_CONCEPTO' - end - item - Name = 'CONCEPTO_RTF' - DataType = datString Size = 2000 - BlobType = dabtMemo + DictionaryEntry = 'FacturasCliente_Detalles_CONCEPTO' end item Name = 'CANTIDAD' @@ -1208,6 +1193,10 @@ object RptFacturasCliente: TRptFacturasCliente Name = 'VISIBLE' DataType = datSmallInt DictionaryEntry = 'FacturasCliente_Detalles_VISIBLE' + end + item + Name = 'VALORADO' + DataType = datSmallInt end> end item diff --git a/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.dproj b/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.dproj index d02f015..07a1721 100644 --- a/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.dproj +++ b/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.dproj @@ -49,48 +49,48 @@ MainSource - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fEditorElegirArticulosFacturaCliente
TForm diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.dfm b/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.dfm index e4fd42a..0bbff8c 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.dfm +++ b/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.dfm @@ -246,7 +246,7 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente ExplicitHeight = 228 inherited memObservaciones: TcxDBMemo DataBinding.DataSource = frViewFacturaCliente1.DADataSource - ExplicitWidth = 783 + ExplicitHeight = 228 Height = 228 Width = 521 end @@ -387,6 +387,9 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente ExplicitWidth = 622 end end + inherited cxRichEdit1: TcxRichEdit + Style.IsFontAssigned = True + end end end object pagContabilidad: TTabSheet diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.pas b/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.pas index 26fed49..32f49a0 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.pas +++ b/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.pas @@ -310,8 +310,9 @@ var AVerLogotipo: Boolean; begin inherited; - AVerLogotipo:= True; - AVerLogotipo := (Application.MessageBox('¿Desea imprimir el documento con logotipo?', 'Atención', MB_YESNO) = IDYES); + AVerLogotipo:= False; + if(AppFactuGES.EmpresaActiva.IVA > 0) then + AVerLogotipo := (Application.MessageBox('¿Desea imprimir el documento con logotipo?', 'Atención', MB_YESNO) = IDYES); FController.Print(FFactura, False, aVerLogotipo); end; @@ -320,6 +321,8 @@ var // FDetallesController : IDetallesFacturaClienteController; AClientesController : IClientesController; ADireccion : IBizDireccionesContacto; + APrimerCliente : Boolean; + begin FFactura.Cliente := frViewFacturaCliente1.frViewClienteFactura1.Cliente; @@ -359,11 +362,23 @@ begin AClientesController := Nil; end; + if Assigned(FFactura) then + begin + APrimerCliente := (FFactura.Cliente.ID = 0); - // Si la factura tiene detalles hay que mirar si los descuentos y otros campos - // para los artículos hay que cambiarlos. - if (FFactura.Detalles.RecordCount > 0) then - FController.DetallesController.ActualizarDetalles(FFactura.Detalles, FFactura.Cliente); + if (ShowConfirmMessage('Cambio forma de pago', '¿Desea actualizar la forma de pago a la asignada en la ficha del cliente seleccionado?') = IDYES) then + FController.ActualizarFormaDePago(FFactura, FFactura.Cliente.ID_FORMA_PAGO); + + if (not APrimerCliente) and (FFactura.Detalles.RecordCount > 0) then begin + if (ShowConfirmMessage('Actualizar los descuentos de las líneas', + '¿Desea actualizar las líneas de detalle con el descuento del cliente?' + #10#13 + + 'Sólo se cambiarán las líneas que tengan cantidades.') = IDYES) then + begin + FController.DetallesController.ActualizarDetalles(FFactura.Detalles, FFactura.Cliente); + ShowInfoMessage('Se han actualizado las líneas con el descuento del cliente seleccionado'); + end; + end; + end; end; procedure TfEditorFacturaCliente.pgPaginasChanging(Sender: TObject; @@ -418,8 +433,9 @@ var AVerLogotipo: Boolean; begin inherited; - AverLogotipo:= True; - AVerLogotipo := (Application.MessageBox('¿Desea previsualizar el documento con logotipo?', 'Atención', MB_YESNO) = IDYES); + AVerLogotipo:= False; + if(AppFactuGES.EmpresaActiva.IVA > 0) then + AVerLogotipo := (Application.MessageBox('¿Desea previsualizar el documento con logotipo?', 'Atención', MB_YESNO) = IDYES); FController.Preview(FFactura, False, AVerLogotipo); end; diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.dfm b/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.dfm index 31ae7b6..dc55b5f 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.dfm +++ b/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.dfm @@ -3,7 +3,7 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente ClientHeight = 666 ClientWidth = 640 ExplicitWidth = 648 - ExplicitHeight = 700 + ExplicitHeight = 704 PixelsPerInch = 96 TextHeight = 13 inherited JvNavPanelHeader: TJvNavPanelHeader @@ -38,7 +38,7 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente Width = 640 ExplicitWidth = 640 inherited tbxMain: TTBXToolbar - ExplicitWidth = 632 + ExplicitWidth = 640 object TBXSubmenuItem2: TTBXSubmenuItem [0] Caption = 'Nuevo' DisplayMode = nbdmImageAndText @@ -58,7 +58,7 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente end end inherited tbxFiltro: TTBXToolbar - ExplicitWidth = 431 + ExplicitWidth = 454 inherited lblAno: TTBXLabelItem Visible = True end @@ -73,10 +73,10 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente ExplicitWidth = 640 end inherited TBXTMain2: TTBXToolbar - Left = 431 + Left = 454 Visible = True - ExplicitLeft = 431 - ExplicitWidth = 83 + ExplicitLeft = 454 + ExplicitWidth = 91 object TBXItem40: TTBXItem Action = actInformes DisplayMode = nbdmImageAndText @@ -91,9 +91,9 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente end inline frViewFacturasCliente1: TfrViewFacturasCliente [3] Left = 0 - Top = 102 + Top = 106 Width = 640 - Height = 545 + Height = 541 Align = alClient Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -103,14 +103,14 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente ParentFont = False TabOrder = 3 ReadOnly = False - ExplicitTop = 102 + ExplicitTop = 106 ExplicitWidth = 640 - ExplicitHeight = 545 + ExplicitHeight = 541 inherited cxGrid: TcxGrid Width = 640 - Height = 417 + Height = 413 ExplicitWidth = 640 - ExplicitHeight = 417 + ExplicitHeight = 413 inherited cxGridView: TcxGridDBTableView DataController.Summary.DefaultGroupSummaryItems = < item @@ -225,8 +225,8 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente end end inherited pnlAgrupaciones: TTBXDockablePanel - Top = 519 - ExplicitTop = 519 + Top = 515 + ExplicitTop = 515 ExplicitWidth = 640 inherited TBXAlignmentPanel1: TTBXAlignmentPanel Width = 640 diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.pas b/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.pas index 9afbf7c..613eefb 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.pas +++ b/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.pas @@ -328,7 +328,10 @@ begin if Assigned(AFacturas) then begin - AVerLogotipo := (Application.MessageBox('¿Desea imprimir el/los documento/s con logotipo?', 'Atención', MB_YESNO) = IDYES); + if(AppFactuGES.EmpresaActiva.IVA > 0) then + AVerLogotipo := (Application.MessageBox('¿Desea imprimir el/los documento/s con logotipo?', 'Atención', MB_YESNO) = IDYES) + else + AVerLogotipo := False; FController.Print(AFacturas, AllItems, AVerLogotipo); end; end; @@ -440,7 +443,10 @@ begin if Assigned(AFacturas) then begin - AVerLogotipo := (Application.MessageBox('¿Desea previsualizar el/los documento/s con logotipo?', 'Atención', MB_YESNO) = IDYES); + if(AppFactuGES.EmpresaActiva.IVA > 0) then + AVerLogotipo := (Application.MessageBox('¿Desea previsualizar el/los documento/s con logotipo?', 'Atención', MB_YESNO) = IDYES) + else + AVerLogotipo := False; FController.Preview(AFacturas, AllItems, AVerLogotipo); end; end; diff --git a/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.pas b/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.pas index 1d514f3..a19a0e5 100644 --- a/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.pas +++ b/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.pas @@ -82,10 +82,11 @@ begin if (AItem.Index in [cxGridViewDESCUENTO.Index]) then begin //Esto es para que solo sea editable la columna dto en las lineas de tipo descuento (para hacer descuento por capitulo), -//al comentarlo permitimos que se pueda añadir además descuentos a nivel de lineas -// IndiceCol := cxGridView.GetColumnByFieldName(CAMPO_TIPO).Index; -// if (AItem.GridView.Items[IndiceCol].EditValue <> TIPO_DETALLE_DESCUENTO) then -// Result := False +//además descuentos a nivel de lineas de detalle + IndiceCol := cxGridView.GetColumnByFieldName(CAMPO_TIPO).Index; + if (AItem.GridView.Items[IndiceCol].EditValue <> TIPO_DETALLE_DESCUENTO) + and (AItem.GridView.Items[IndiceCol].EditValue <> TIPO_DETALLE_CONCEPTO) then + Result := False end else Result := inherited EsTipoEditable(AItem); diff --git a/Source/Modulos/Facturas de cliente/Views/uViewFacturaCliente.dfm b/Source/Modulos/Facturas de cliente/Views/uViewFacturaCliente.dfm index 850d9cc..47f6584 100644 --- a/Source/Modulos/Facturas de cliente/Views/uViewFacturaCliente.dfm +++ b/Source/Modulos/Facturas de cliente/Views/uViewFacturaCliente.dfm @@ -1,6 +1,6 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente - Width = 451 - Height = 304 + Width = 870 + Height = 396 Align = alClient OnCreate = CustomViewCreate OnDestroy = CustomViewDestroy @@ -9,17 +9,19 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente object dxLayoutControl1: TdxLayoutControl Left = 0 Top = 0 - Width = 451 - Height = 304 + Width = 870 + Height = 396 Align = alClient ParentBackground = True TabOrder = 0 TabStop = False AutoContentSizes = [acsWidth, acsHeight] LookAndFeel = dxLayoutOfficeLookAndFeel1 + ExplicitWidth = 451 + ExplicitHeight = 304 DesignSize = ( - 451 - 304) + 870 + 396) object eReferencia: TcxDBTextEdit Left = 135 Top = 30 @@ -95,7 +97,7 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente Width = 78 end object bFormasPago: TButton - Left = 241 + Left = 301 Top = 135 Width = 132 Height = 23 @@ -133,7 +135,7 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente end end inline frViewClienteFactura1: TfrViewClienteFactura - Left = 401 + Left = 461 Top = 30 Width = 398 Height = 265 @@ -145,7 +147,7 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente ParentFont = False TabOrder = 8 ReadOnly = False - ExplicitLeft = 401 + ExplicitLeft = 461 ExplicitTop = 30 ExplicitWidth = 398 ExplicitHeight = 265 @@ -175,12 +177,12 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente Width = 276 end inherited edtCodigoPostal: TcxDBTextEdit - Left = 192 - ExplicitLeft = 192 + Left = 295 + ExplicitLeft = 295 end inherited Button3: TBitBtn - Left = 82 - ExplicitLeft = 82 + Left = 185 + ExplicitLeft = 185 end inherited cxDBTextEdit1: TcxDBTextEdit ExplicitWidth = 283 diff --git a/Source/Modulos/Formas de pago/Model/schFormasPagoClient_Intf.pas b/Source/Modulos/Formas de pago/Model/schFormasPagoClient_Intf.pas index 5f4b493..3ca80b6 100644 --- a/Source/Modulos/Formas de pago/Model/schFormasPagoClient_Intf.pas +++ b/Source/Modulos/Formas de pago/Model/schFormasPagoClient_Intf.pas @@ -3,19 +3,31 @@ unit schFormasPagoClient_Intf; interface uses - Classes, DB, schBase_Intf, SysUtils, uROClasses, uDADataTable, FmtBCD, uROXMLIntf; + Classes, DB, schBase_Intf, SysUtils, uROClasses, uDAInterfaces, uDADataTable, FmtBCD, uROXMLIntf; const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_FormasPago = '{0AC9176F-E9B6-43BA-B03E-0973D7074140}'; - RID_FormasPagoPlazos = '{F02E8B61-F06F-48FE-B705-0C42FB672FB5}'; + RID_ListaFormasPago = '{776235FF-CAC6-4218-B48B-F7A65098B388}'; + RID_FormasPago = '{E1CB03E0-E72D-4BEE-8D75-1CC2365CD175}'; + RID_FormasPagoPlazos = '{1F15DCA8-B016-457C-B9BF-C2FCC23C753E}'; { Data table names } + nme_ListaFormasPago = 'ListaFormasPago'; nme_FormasPago = 'FormasPago'; nme_FormasPagoPlazos = 'FormasPagoPlazos'; + { ListaFormasPago fields } + fld_ListaFormasPagoID = 'ID'; + fld_ListaFormasPagoREFERENCIA = 'REFERENCIA'; + fld_ListaFormasPagoDESCRIPCION = 'DESCRIPCION'; + + { ListaFormasPago field indexes } + idx_ListaFormasPagoID = 0; + idx_ListaFormasPagoREFERENCIA = 1; + idx_ListaFormasPagoDESCRIPCION = 2; + { FormasPago fields } fld_FormasPagoID = 'ID'; fld_FormasPagoREFERENCIA = 'REFERENCIA'; @@ -49,9 +61,68 @@ const idx_FormasPagoPlazosPORCENTAJE = 3; type + { IListaFormasPago } + IListaFormasPago = interface(IDAStronglyTypedDataTable) + ['{3E5CAFA1-B90A-4306-A6C8-383E34D67F4E}'] + { Property getters and setters } + function GetIDValue: Integer; + procedure SetIDValue(const aValue: Integer); + function GetIDIsNull: Boolean; + procedure SetIDIsNull(const aValue: Boolean); + function GetREFERENCIAValue: String; + procedure SetREFERENCIAValue(const aValue: String); + function GetREFERENCIAIsNull: Boolean; + procedure SetREFERENCIAIsNull(const aValue: Boolean); + function GetDESCRIPCIONValue: String; + procedure SetDESCRIPCIONValue(const aValue: String); + function GetDESCRIPCIONIsNull: Boolean; + procedure SetDESCRIPCIONIsNull(const aValue: Boolean); + + + { Properties } + property ID: Integer read GetIDValue write SetIDValue; + property IDIsNull: Boolean read GetIDIsNull write SetIDIsNull; + property REFERENCIA: String read GetREFERENCIAValue write SetREFERENCIAValue; + property REFERENCIAIsNull: Boolean read GetREFERENCIAIsNull write SetREFERENCIAIsNull; + property DESCRIPCION: String read GetDESCRIPCIONValue write SetDESCRIPCIONValue; + property DESCRIPCIONIsNull: Boolean read GetDESCRIPCIONIsNull write SetDESCRIPCIONIsNull; + end; + + { TListaFormasPagoDataTableRules } + TListaFormasPagoDataTableRules = class(TIntfObjectDADataTableRules, IListaFormasPago) + private + protected + { Property getters and setters } + function GetIDValue: Integer; virtual; + procedure SetIDValue(const aValue: Integer); virtual; + function GetIDIsNull: Boolean; virtual; + procedure SetIDIsNull(const aValue: Boolean); virtual; + function GetREFERENCIAValue: String; virtual; + procedure SetREFERENCIAValue(const aValue: String); virtual; + function GetREFERENCIAIsNull: Boolean; virtual; + procedure SetREFERENCIAIsNull(const aValue: Boolean); virtual; + function GetDESCRIPCIONValue: String; virtual; + procedure SetDESCRIPCIONValue(const aValue: String); virtual; + function GetDESCRIPCIONIsNull: Boolean; virtual; + procedure SetDESCRIPCIONIsNull(const aValue: Boolean); virtual; + + { Properties } + property ID: Integer read GetIDValue write SetIDValue; + property IDIsNull: Boolean read GetIDIsNull write SetIDIsNull; + property REFERENCIA: String read GetREFERENCIAValue write SetREFERENCIAValue; + property REFERENCIAIsNull: Boolean read GetREFERENCIAIsNull write SetREFERENCIAIsNull; + property DESCRIPCION: String read GetDESCRIPCIONValue write SetDESCRIPCIONValue; + property DESCRIPCIONIsNull: Boolean read GetDESCRIPCIONIsNull write SetDESCRIPCIONIsNull; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + { IFormasPago } IFormasPago = interface(IDAStronglyTypedDataTable) - ['{2906012F-51D2-4722-A42A-1A1F0B5F5DA3}'] + ['{F6F3FFFE-3ED4-465A-BB14-6C9C1DF460C6}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -170,7 +241,7 @@ type { IFormasPagoPlazos } IFormasPagoPlazos = interface(IDAStronglyTypedDataTable) - ['{6C99169B-3B96-4E95-9886-BFBDAF1C5836}'] + ['{B722C361-945E-46B3-B72A-4BACAA99DDF1}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -243,6 +314,81 @@ implementation uses Variants, uROBinaryHelpers; +{ TListaFormasPagoDataTableRules } +constructor TListaFormasPagoDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TListaFormasPagoDataTableRules.Destroy; +begin + inherited; +end; + +function TListaFormasPagoDataTableRules.GetIDValue: Integer; +begin + result := DataTable.Fields[idx_ListaFormasPagoID].AsInteger; +end; + +procedure TListaFormasPagoDataTableRules.SetIDValue(const aValue: Integer); +begin + DataTable.Fields[idx_ListaFormasPagoID].AsInteger := aValue; +end; + +function TListaFormasPagoDataTableRules.GetIDIsNull: boolean; +begin + result := DataTable.Fields[idx_ListaFormasPagoID].IsNull; +end; + +procedure TListaFormasPagoDataTableRules.SetIDIsNull(const aValue: Boolean); +begin + if aValue then + DataTable.Fields[idx_ListaFormasPagoID].AsVariant := Null; +end; + +function TListaFormasPagoDataTableRules.GetREFERENCIAValue: String; +begin + result := DataTable.Fields[idx_ListaFormasPagoREFERENCIA].AsString; +end; + +procedure TListaFormasPagoDataTableRules.SetREFERENCIAValue(const aValue: String); +begin + DataTable.Fields[idx_ListaFormasPagoREFERENCIA].AsString := aValue; +end; + +function TListaFormasPagoDataTableRules.GetREFERENCIAIsNull: boolean; +begin + result := DataTable.Fields[idx_ListaFormasPagoREFERENCIA].IsNull; +end; + +procedure TListaFormasPagoDataTableRules.SetREFERENCIAIsNull(const aValue: Boolean); +begin + if aValue then + DataTable.Fields[idx_ListaFormasPagoREFERENCIA].AsVariant := Null; +end; + +function TListaFormasPagoDataTableRules.GetDESCRIPCIONValue: String; +begin + result := DataTable.Fields[idx_ListaFormasPagoDESCRIPCION].AsString; +end; + +procedure TListaFormasPagoDataTableRules.SetDESCRIPCIONValue(const aValue: String); +begin + DataTable.Fields[idx_ListaFormasPagoDESCRIPCION].AsString := aValue; +end; + +function TListaFormasPagoDataTableRules.GetDESCRIPCIONIsNull: boolean; +begin + result := DataTable.Fields[idx_ListaFormasPagoDESCRIPCION].IsNull; +end; + +procedure TListaFormasPagoDataTableRules.SetDESCRIPCIONIsNull(const aValue: Boolean); +begin + if aValue then + DataTable.Fields[idx_ListaFormasPagoDESCRIPCION].AsVariant := Null; +end; + + { TFormasPagoDataTableRules } constructor TFormasPagoDataTableRules.Create(aDataTable: TDADataTable); begin @@ -520,6 +666,7 @@ end; initialization + RegisterDataTableRules(RID_ListaFormasPago, TListaFormasPagoDataTableRules); RegisterDataTableRules(RID_FormasPago, TFormasPagoDataTableRules); RegisterDataTableRules(RID_FormasPagoPlazos, TFormasPagoPlazosDataTableRules); diff --git a/Source/Modulos/Formas de pago/Model/schFormasPagoServer_Intf.pas b/Source/Modulos/Formas de pago/Model/schFormasPagoServer_Intf.pas index 874b45c..8c9c407 100644 --- a/Source/Modulos/Formas de pago/Model/schFormasPagoServer_Intf.pas +++ b/Source/Modulos/Formas de pago/Model/schFormasPagoServer_Intf.pas @@ -9,13 +9,72 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_FormasPagoDelta = '{3B5575C3-8103-4890-A2BF-8B93698E666B}'; - RID_FormasPagoPlazosDelta = '{E0326434-91CF-4E0E-B620-9C98B3FF28EA}'; + RID_ListaFormasPagoDelta = '{2D79A54B-D803-456A-B1FB-A117125F8A37}'; + RID_FormasPagoDelta = '{2DDDC640-410D-490A-AA85-63CEC195FA66}'; + RID_FormasPagoPlazosDelta = '{41A8A08A-EDF1-4D3E-8657-597F555EFCF5}'; type + { IListaFormasPagoDelta } + IListaFormasPagoDelta = interface(IListaFormasPago) + ['{2D79A54B-D803-456A-B1FB-A117125F8A37}'] + { Property getters and setters } + function GetOldIDValue : Integer; + function GetOldREFERENCIAValue : String; + function GetOldDESCRIPCIONValue : String; + + { Properties } + property OldID : Integer read GetOldIDValue; + property OldREFERENCIA : String read GetOldREFERENCIAValue; + property OldDESCRIPCION : String read GetOldDESCRIPCIONValue; + end; + + { TListaFormasPagoBusinessProcessorRules } + TListaFormasPagoBusinessProcessorRules = class(TDABusinessProcessorRules, IListaFormasPago, IListaFormasPagoDelta) + private + protected + { Property getters and setters } + function GetIDValue: Integer; virtual; + function GetIDIsNull: Boolean; virtual; + function GetOldIDValue: Integer; virtual; + function GetOldIDIsNull: Boolean; virtual; + procedure SetIDValue(const aValue: Integer); virtual; + procedure SetIDIsNull(const aValue: Boolean); virtual; + function GetREFERENCIAValue: String; virtual; + function GetREFERENCIAIsNull: Boolean; virtual; + function GetOldREFERENCIAValue: String; virtual; + function GetOldREFERENCIAIsNull: Boolean; virtual; + procedure SetREFERENCIAValue(const aValue: String); virtual; + procedure SetREFERENCIAIsNull(const aValue: Boolean); virtual; + function GetDESCRIPCIONValue: String; virtual; + function GetDESCRIPCIONIsNull: Boolean; virtual; + function GetOldDESCRIPCIONValue: String; virtual; + function GetOldDESCRIPCIONIsNull: Boolean; virtual; + procedure SetDESCRIPCIONValue(const aValue: String); virtual; + procedure SetDESCRIPCIONIsNull(const aValue: Boolean); virtual; + + { Properties } + property ID : Integer read GetIDValue write SetIDValue; + property IDIsNull : Boolean read GetIDIsNull write SetIDIsNull; + property OldID : Integer read GetOldIDValue; + property OldIDIsNull : Boolean read GetOldIDIsNull; + property REFERENCIA : String read GetREFERENCIAValue write SetREFERENCIAValue; + property REFERENCIAIsNull : Boolean read GetREFERENCIAIsNull write SetREFERENCIAIsNull; + property OldREFERENCIA : String read GetOldREFERENCIAValue; + property OldREFERENCIAIsNull : Boolean read GetOldREFERENCIAIsNull; + property DESCRIPCION : String read GetDESCRIPCIONValue write SetDESCRIPCIONValue; + property DESCRIPCIONIsNull : Boolean read GetDESCRIPCIONIsNull write SetDESCRIPCIONIsNull; + property OldDESCRIPCION : String read GetOldDESCRIPCIONValue; + property OldDESCRIPCIONIsNull : Boolean read GetOldDESCRIPCIONIsNull; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + { IFormasPagoDelta } IFormasPagoDelta = interface(IFormasPago) - ['{3B5575C3-8103-4890-A2BF-8B93698E666B}'] + ['{2DDDC640-410D-490A-AA85-63CEC195FA66}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldREFERENCIAValue : String; @@ -133,7 +192,7 @@ type { IFormasPagoPlazosDelta } IFormasPagoPlazosDelta = interface(IFormasPagoPlazos) - ['{E0326434-91CF-4E0E-B620-9C98B3FF28EA}'] + ['{41A8A08A-EDF1-4D3E-8657-597F555EFCF5}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_FORMA_PAGOValue : Integer; @@ -206,6 +265,111 @@ implementation uses Variants, uROBinaryHelpers, uDAInterfaces; +{ TListaFormasPagoBusinessProcessorRules } +constructor TListaFormasPagoBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TListaFormasPagoBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TListaFormasPagoBusinessProcessorRules.GetIDValue: Integer; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoID]; +end; + +function TListaFormasPagoBusinessProcessorRules.GetIDIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoID]); +end; + +function TListaFormasPagoBusinessProcessorRules.GetOldIDValue: Integer; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaFormasPagoID]; +end; + +function TListaFormasPagoBusinessProcessorRules.GetOldIDIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_ListaFormasPagoID]); +end; + +procedure TListaFormasPagoBusinessProcessorRules.SetIDValue(const aValue: Integer); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoID] := aValue; +end; + +procedure TListaFormasPagoBusinessProcessorRules.SetIDIsNull(const aValue: Boolean); +begin + if aValue then + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoID] := Null; +end; + +function TListaFormasPagoBusinessProcessorRules.GetREFERENCIAValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoREFERENCIA]; +end; + +function TListaFormasPagoBusinessProcessorRules.GetREFERENCIAIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoREFERENCIA]); +end; + +function TListaFormasPagoBusinessProcessorRules.GetOldREFERENCIAValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaFormasPagoREFERENCIA]; +end; + +function TListaFormasPagoBusinessProcessorRules.GetOldREFERENCIAIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_ListaFormasPagoREFERENCIA]); +end; + +procedure TListaFormasPagoBusinessProcessorRules.SetREFERENCIAValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoREFERENCIA] := aValue; +end; + +procedure TListaFormasPagoBusinessProcessorRules.SetREFERENCIAIsNull(const aValue: Boolean); +begin + if aValue then + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoREFERENCIA] := Null; +end; + +function TListaFormasPagoBusinessProcessorRules.GetDESCRIPCIONValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoDESCRIPCION]; +end; + +function TListaFormasPagoBusinessProcessorRules.GetDESCRIPCIONIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoDESCRIPCION]); +end; + +function TListaFormasPagoBusinessProcessorRules.GetOldDESCRIPCIONValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaFormasPagoDESCRIPCION]; +end; + +function TListaFormasPagoBusinessProcessorRules.GetOldDESCRIPCIONIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_ListaFormasPagoDESCRIPCION]); +end; + +procedure TListaFormasPagoBusinessProcessorRules.SetDESCRIPCIONValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoDESCRIPCION] := aValue; +end; + +procedure TListaFormasPagoBusinessProcessorRules.SetDESCRIPCIONIsNull(const aValue: Boolean); +begin + if aValue then + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaFormasPagoDESCRIPCION] := Null; +end; + + { TFormasPagoBusinessProcessorRules } constructor TFormasPagoBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); begin @@ -603,6 +767,7 @@ end; initialization + RegisterBusinessProcessorRules(RID_ListaFormasPagoDelta, TListaFormasPagoBusinessProcessorRules); RegisterBusinessProcessorRules(RID_FormasPagoDelta, TFormasPagoBusinessProcessorRules); RegisterBusinessProcessorRules(RID_FormasPagoPlazosDelta, TFormasPagoPlazosBusinessProcessorRules); diff --git a/Source/Modulos/Formas de pago/Servidor/srvFormasPago_Impl.dfm b/Source/Modulos/Formas de pago/Servidor/srvFormasPago_Impl.dfm index 71af1d7..4d103e1 100644 --- a/Source/Modulos/Formas de pago/Servidor/srvFormasPago_Impl.dfm +++ b/Source/Modulos/Formas de pago/Servidor/srvFormasPago_Impl.dfm @@ -14,8 +14,8 @@ object srvFormasPago: TsrvFormasPago DiagramData = ''#13#10' '#13#10' '#13#10' '#13#10' '#13#10''#13#10 + '00" Top="0,00" />'#13#10' '#13#10' '#13#10''#13#10 end object DataDictionary: TDADataDictionary Fields = < @@ -108,7 +108,9 @@ object srvFormasPago: TsrvFormasPago ConnectionType = 'Interbase' Default = True Name = 'IBX' - SQL = 'Select ID, DESCRIPCION'#10'from FORMAS_PAGO'#10'order by DESCRIPCION'#10 + SQL = + 'Select ID, REFERENCIA, DESCRIPCION'#10'from FORMAS_PAGO'#10'order by DES' + + 'CRIPCION'#10 StatementType = stSQL ColumnMappings = < item @@ -118,6 +120,10 @@ object srvFormasPago: TsrvFormasPago item DatasetField = 'DESCRIPCION' TableField = 'DESCRIPCION' + end + item + DatasetField = 'REFERENCIA' + TableField = 'REFERENCIA' end> end> Name = 'ListaFormasPago' @@ -126,6 +132,11 @@ object srvFormasPago: TsrvFormasPago Name = 'ID' DataType = datInteger end + item + Name = 'REFERENCIA' + DataType = datString + Size = 255 + end item Name = 'DESCRIPCION' DataType = datString diff --git a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas index 6b6cf13..cc305b2 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas @@ -68,6 +68,7 @@ type property GestorDocumentosController: IGestorDocumentosController read GetGestorDocumentosController write SetGestorDocumentosController; procedure RecuperarCliente(APresupuesto : IBizPresupuestoCliente); + procedure ActualizarFormaDePago(APresupuesto : IBizPresupuestoCliente; ID_FORMA_PAGO: Integer); function Buscar(const ID: Integer): IBizPresupuestoCliente; overload; function Buscar(const ListaID: TIntegerList): IBizPresupuestoCliente; overload; function BuscarTodos: IBizPresupuestoCliente; overload; @@ -150,6 +151,7 @@ type function Localizar(APresupuestos: IBizPresupuestoCliente; const ID : Integer): Boolean; procedure RecuperarCliente(APresupuesto : IBizPresupuestoCliente); + procedure ActualizarFormaDePago(APresupuesto : IBizPresupuestoCliente; ID_FORMA_PAGO: Integer); function Eliminar(const ID : Integer): Boolean; overload; function Eliminar(APresupuesto : IBizPresupuestoCliente; AllItems: Boolean = false): Boolean; overload; function Guardar(APresupuesto : IBizPresupuestoCliente): Boolean; @@ -204,6 +206,22 @@ uses { TPresupuestosClienteController } +procedure TPresupuestosClienteController.ActualizarFormaDePago(APresupuesto: IBizPresupuestoCliente; ID_FORMA_PAGO: Integer); +var + AFormasPago : IBizFormaPago; + AFormasPagoController : IFormasPagoController; +begin + AFormasPagoController := TFormasPagoController.Create; + AFormasPago := AFormasPagoController.Buscar(ID_FORMA_PAGO); + AFormasPago.Open; + + APresupuesto.ID_FORMA_PAGO := AFormasPago.ID; + APresupuesto.DataTable.FieldByName(fld_PresupuestosClienteFORMA_PAGO).AsString := AFormasPago.DESCRIPCION; + + AFormasPago := NIL; + AFormasPagoController := NIL; +end; + function TPresupuestosClienteController.Anadir(APresupuesto: IBizPresupuestoCliente; const ATipo: TEnumTiposPresupuesto): Boolean; begin if not Assigned(APresupuesto) then @@ -904,13 +922,13 @@ begin teCocina: begin APresupuesto.TIPO_PRESUPUESTO := CTE_COCINA; - APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_COCINA)); + APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_COCINA, AppFactuGES.EmpresaActiva.ID)); AFormasPago := AFormasPagoController.Buscar(APresupuesto.ID_FORMA_PAGO); AFormasPago.Open; APresupuesto.FORMA_PAGO.Add(AFormasPago.DESCRIPCION); - APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_COCINA)); - APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_COCINA)); + APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_COCINA, AppFactuGES.EmpresaActiva.ID)); + APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_COCINA, AppFactuGES.EmpresaActiva.ID)); (Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_C, 'MUEBLES DE COCINA ', False, APresupuesto.Detalles); (Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'ENCIMERA ', True, APresupuesto.Detalles); (Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'ELECTRODOMÉSTICOS ', True, APresupuesto.Detalles); @@ -921,51 +939,51 @@ begin teArmario: begin APresupuesto.TIPO_PRESUPUESTO := CTE_ARMARIO; - APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_ARMARIO)); + APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_ARMARIO, AppFactuGES.EmpresaActiva.ID)); AFormasPago := AFormasPagoController.Buscar(APresupuesto.ID_FORMA_PAGO); AFormasPago.Open; APresupuesto.FORMA_PAGO.Add(AFormasPago.DESCRIPCION); - APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_ARMARIO)); - APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_ARMARIO)); + APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_ARMARIO, AppFactuGES.EmpresaActiva.ID)); + APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_ARMARIO, AppFactuGES.EmpresaActiva.ID)); (Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_AF, 'FRENTE DE ARMARIO Nº ', False, APresupuesto.Detalles); (Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_AI, 'INTERIOR DE ARMARIO Nº ', False, APresupuesto.Detalles); end; teBano: begin APresupuesto.TIPO_PRESUPUESTO := CTE_BANO; - APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_BANO)); + APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_BANO, AppFactuGES.EmpresaActiva.ID)); AFormasPago := AFormasPagoController.Buscar(APresupuesto.ID_FORMA_PAGO); AFormasPago.Open; APresupuesto.FORMA_PAGO.Add(AFormasPago.DESCRIPCION); - APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_BANO)); - APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_BANO)); + APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_BANO, AppFactuGES.EmpresaActiva.ID)); + APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_BANO, AppFactuGES.EmpresaActiva.ID)); (Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_B, 'MUEBLE DE BAÑO Nº ', False, APresupuesto.Detalles); (Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'IMPORTES ', True, APresupuesto.Detalles); end; teElectrodomestico: begin APresupuesto.TIPO_PRESUPUESTO := CTE_ELECTRODOMESTICO; - APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_ELECTRODOMESTICO)); + APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_ELECTRODOMESTICO, AppFactuGES.EmpresaActiva.ID)); AFormasPago := AFormasPagoController.Buscar(APresupuesto.ID_FORMA_PAGO); AFormasPago.Open; APresupuesto.FORMA_PAGO.Add(AFormasPago.DESCRIPCION); - APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_ELECTRODOMESTICO)); - APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_ELECTRODOMESTICO)); + APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_ELECTRODOMESTICO, AppFactuGES.EmpresaActiva.ID)); + APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_ELECTRODOMESTICO, AppFactuGES.EmpresaActiva.ID)); (Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_E, 'ELECTRODOMÉSTICOS ', False, APresupuesto.Detalles); end; teVarios: begin APresupuesto.TIPO_PRESUPUESTO := CTE_VARIOS; - APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_VARIOS)); + APresupuesto.ID_FORMA_PAGO := StrToInt(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_VARIOS, AppFactuGES.EmpresaActiva.ID)); AFormasPago := AFormasPagoController.Buscar(APresupuesto.ID_FORMA_PAGO); AFormasPago.Open; APresupuesto.FORMA_PAGO.Add(AFormasPago.DESCRIPCION); - APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_VARIOS)); - APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_VARIOS)); + APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_VARIOS, AppFactuGES.EmpresaActiva.ID)); + APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_VARIOS, AppFactuGES.EmpresaActiva.ID)); (Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'VARIOS ', False, APresupuesto.Detalles); end; end; diff --git a/Source/Modulos/Presupuestos de cliente/Model/uBizPresupuestosCliente.pas b/Source/Modulos/Presupuestos de cliente/Model/uBizPresupuestosCliente.pas index ada51d3..d26cae6 100644 --- a/Source/Modulos/Presupuestos de cliente/Model/uBizPresupuestosCliente.pas +++ b/Source/Modulos/Presupuestos de cliente/Model/uBizPresupuestosCliente.pas @@ -99,7 +99,7 @@ type implementation uses - SysUtils, Variants, uDataModuleConfiguracion, uDataModuleUsuarios, Dialogs, + uDialogUtils, Windows, SysUtils, Variants, uDataModuleConfiguracion, uDataModuleUsuarios, Dialogs, uDataTableUtils, DateUtils, uDateUtils, DB, uFactuGES_App, uTiposIVAController, uBizTiposIVA, uVendedoresController; @@ -260,7 +260,7 @@ procedure TBizPresupuestoCliente.IniciarValoresPresupuestoNuevo; begin ID_EMPRESA := AppFactuGES.EmpresaActiva.ID; USUARIO := AppFactuGES.UsuarioActivo.UserName; -// ID_FORMA_PAGO := AppFactuGES.EmpresaActiva.ID_FORMA_PAGO; +// ID_FORMA_PAGO := AppFactuGES.EmpresaActiva.ID_FORMA_PAGO; //En abeto la forma de pago por defecto la da la configuración de tipo de documento ID_TIPO_IVA := AppFactuGES.EmpresaActiva.ID_TIPO_IVA; FECHA_PRESUPUESTO := DateOf(Date); @@ -275,9 +275,6 @@ begin ID_TIENDA := AppFactuGES.TiendaActiva.ID; TIENDA := AppFactuGES.TiendaActiva.NOMBRE; - Self.DataTable.FieldByName(fld_PresupuestosClienteFORMA_PAGO).AsString := AppFactuGES.FormaPagoDocumentos; - Self.DataTable.FieldByName(fld_PresupuestosClienteOBSERVACIONES).AsString := AppFactuGES.ObservacionesDocumentos; - AsignarVendedor; end; @@ -333,9 +330,10 @@ begin DataTable.Edit; ID_CLIENTE := FCliente.ID; -// La forma de pago se establece desde el tipo de documento y aunque cambie de cliente no se cambia la formade pago -// if FCliente.ID_FORMA_PAGO > 0 then -// ID_FORMA_PAGO := FCliente.ID_FORMA_PAGO; + +// La forma de pago se establece desde el tipo de documento y aunque cambie de cliente no se cambia la formade pago ya que desde la vista se pregunta y se cambia si el usuario lo desea +// if FCliente.ID_FORMA_PAGO > 0 then +// ID_FORMA_PAGO := FCliente.ID_FORMA_PAGO; // Se establece un descuento especial general a petición de angelica DESCUENTO := FCliente.DESCUENTO; diff --git a/Source/Modulos/Presupuestos de cliente/PresupuestosCliente_Group.groupproj b/Source/Modulos/Presupuestos de cliente/PresupuestosCliente_Group.groupproj index 766beaa..05677b2 100644 --- a/Source/Modulos/Presupuestos de cliente/PresupuestosCliente_Group.groupproj +++ b/Source/Modulos/Presupuestos de cliente/PresupuestosCliente_Group.groupproj @@ -19,7 +19,6 @@ - @@ -222,23 +221,14 @@ - - - - - - - - - - + - + - + \ No newline at end of file diff --git a/Source/Modulos/Presupuestos de cliente/Views/PresupuestosCliente_view.dproj b/Source/Modulos/Presupuestos de cliente/Views/PresupuestosCliente_view.dproj index 5dd96bb..95a5b9e 100644 --- a/Source/Modulos/Presupuestos de cliente/Views/PresupuestosCliente_view.dproj +++ b/Source/Modulos/Presupuestos de cliente/Views/PresupuestosCliente_view.dproj @@ -49,43 +49,49 @@ MainSource - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
frDialogOpcionesImpresionPresupuestosCliente
T @@ -177,12 +183,6 @@
frViewTotalesPresupuesto
TFrame
- - - - - -