diff --git a/Source/ApplicationBase/Idiomas/Controller/uIdiomasController.dcu b/Source/ApplicationBase/Idiomas/Controller/uIdiomasController.dcu index 7f1e1c6..a73042b 100644 Binary files a/Source/ApplicationBase/Idiomas/Controller/uIdiomasController.dcu and b/Source/ApplicationBase/Idiomas/Controller/uIdiomasController.dcu differ diff --git a/Source/ApplicationBase/Idiomas/Model/uBizIdiomas.dcu b/Source/ApplicationBase/Idiomas/Model/uBizIdiomas.dcu index ff53be9..8bd5315 100644 Binary files a/Source/ApplicationBase/Idiomas/Model/uBizIdiomas.dcu and b/Source/ApplicationBase/Idiomas/Model/uBizIdiomas.dcu differ diff --git a/Source/Cliente/FactuGES.dproj b/Source/Cliente/FactuGES.dproj index 9b58ab9..c10decf 100644 --- a/Source/Cliente/FactuGES.dproj +++ b/Source/Cliente/FactuGES.dproj @@ -52,8 +52,7 @@ Delphi.Personality VCLApplication -FalseTrueFalseC:\Archivos de programa\Borland\Delphi7\Bin\TrueFalse4610FalseFalseFalseFalseFalse30821252Rodax Software S.L.4.6.1.0FactuGESFactuGES4.6.1.0 - +FalseTrueFalseC:\Archivos de programa\Borland\Delphi7\Bin\TrueFalse4620FalseFalseFalseFalseFalse30821252Rodax Software S.L.4.6.2.0FactuGESFactuGES4.6.2.0 File C:\Documents and Settings\All Users\Documentos\RAD Studio\5.0\Bpl\dxPScxScheduler2LnkD11.bpl not found FactuGES.dprFalse diff --git a/Source/Cliente/FactuGES.res b/Source/Cliente/FactuGES.res index 09131fa..f9cbe26 100644 Binary files a/Source/Cliente/FactuGES.res and b/Source/Cliente/FactuGES.res differ diff --git a/Source/GUIBase/GUIBase.dproj b/Source/GUIBase/GUIBase.dproj index f44e3be..28783a4 100644 --- a/Source/GUIBase/GUIBase.dproj +++ b/Source/GUIBase/GUIBase.dproj @@ -58,34 +58,34 @@ MainSource - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fDialogBase
diff --git a/Source/Modulos/Contratos de cliente/ContratosCliente_Group.groupproj b/Source/Modulos/Contratos de cliente/ContratosCliente_Group.groupproj index 03a4fca..42d2a21 100644 --- a/Source/Modulos/Contratos de cliente/ContratosCliente_Group.groupproj +++ b/Source/Modulos/Contratos de cliente/ContratosCliente_Group.groupproj @@ -33,6 +33,7 @@ + @@ -281,15 +282,6 @@ - - - - - - - - - @@ -299,6 +291,24 @@ + + + + + + + + + + + + + + + + + + @@ -372,13 +382,13 @@ - + - + - + \ No newline at end of file diff --git a/Source/Modulos/Contratos de cliente/Views/uEditorContratosCliente.pas b/Source/Modulos/Contratos de cliente/Views/uEditorContratosCliente.pas index 07abc45..d412a74 100644 --- a/Source/Modulos/Contratos de cliente/Views/uEditorContratosCliente.pas +++ b/Source/Modulos/Contratos de cliente/Views/uEditorContratosCliente.pas @@ -411,11 +411,12 @@ end; procedure TfEditorContratosCliente.actGenerarFacturaExecute(Sender: TObject); begin inherited; - if (Length(Contratos.FACTURA_ASOCIADA) = 0) or (Application.MessageBox('El contrato ya tiene asociada al menos una factura. ¿Desea continuar?', 'Atención', MB_YESNO) = IDYES) then - begin - GenerarFacturaCli(Contratos.ID); - actRefrescar.Execute; - end; + if (Length(Contratos.FACTURA_ASOCIADA) = 0) or (Application.MessageBox('El contrato ya tiene asociada al menos una factura. ¿Desea tener en cuenta dicha/as factura/as al generar la nueva?', 'Atención', MB_YESNO) = IDNO) then + GenerarFacturaCli(Contratos.ID) + else + GenerarFacturaCli(Contratos.ID, true); + + actRefrescar.Execute; end; procedure TfEditorContratosCliente.actGenerarFacturaUpdate(Sender: TObject); diff --git a/Source/Modulos/Contratos de cliente/Views/uViewContratosCliente.pas b/Source/Modulos/Contratos de cliente/Views/uViewContratosCliente.pas index adadf5f..8d350aa 100644 --- a/Source/Modulos/Contratos de cliente/Views/uViewContratosCliente.pas +++ b/Source/Modulos/Contratos de cliente/Views/uViewContratosCliente.pas @@ -355,6 +355,8 @@ procedure TfrViewContratosCliente.ConfigView; begin inherited; + cxGridLevelPendientesRevisar.Visible := False; + cxGridViewTIENDA.Visible := True; cxGridViewTIENDA.VisibleForCustomization := True; actTienda.Visible := True; @@ -374,6 +376,8 @@ begin //FILTRO DE EMPRESAS TIENDA if (AppFactuGES.EmpresaActiva.ID = CTE_EMPRESA_ABETO) then begin + cxGridLevelPendientesRevisar.Visible := True; + cxGridViewTIENDA.Visible := False; cxGridViewTIENDA.VisibleForCustomization := False; actTienda.Visible := False; diff --git a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas index 4178897..cb89f98 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas @@ -25,6 +25,8 @@ type function BuscarTodasPendientesComision(IdAgente: Integer; IdComision: Integer; IdFacturasAsociadas: String): IBizFacturaCliente; procedure Ver(AFactura : IBizFacturaCliente); procedure VerTodos(AFacturas: IBizFacturaCliente); + function BuscarTodasDelContrato(const ID_CONTRATO: Integer): IBizFacturaCliente; + function Nuevo (WithInsert: Boolean = True) : IBizFacturaCliente; function Anadir(AFactura : IBizFacturaCliente) : Boolean; overload; function AnadirAbono(AFactura : IBizFacturaCliente) : Boolean; @@ -100,9 +102,12 @@ type function AnadirAbono(AFactura : IBizFacturaCliente) : Boolean; function AnadirProforma(AFactura : IBizFacturaCliente) : Boolean; function Anadir(ATipo: String; AFacturas : IBizFacturaCliente; AListaAlbaranes : IBizAlbaranCliente): Boolean; overload; + function Buscar(const ID: Integer): IBizFacturaCliente; function BuscarTodos: IBizFacturaCliente; function BuscarTodasPendientesComision(IdAgente: Integer; IdComision: Integer; IdFacturasAsociadas: String): IBizFacturaCliente; + function BuscarTodasDelContrato(const ID_CONTRATO: Integer): IBizFacturaCliente; + function Nuevo (WithInsert: Boolean = True) : IBizFacturaCliente; procedure Ver(AFactura : IBizFacturaCliente); procedure VerTodos(AFacturas: IBizFacturaCliente); @@ -557,6 +562,31 @@ begin FiltrarEmpresa(Result); end; +function TFacturasClienteController.BuscarTodasDelContrato(const ID_CONTRATO: Integer): IBizFacturaCliente; +var + Condicion: TDAWhereExpression; + +begin + ShowHourglassCursor; + try + Result := BuscarTodos; + + with Result.DataTable.DynamicWhere do + begin + //Todas las facturas del contrato ID_CONTRATO + Condicion := NewBinaryExpression(NewField('', fld_FacturasClienteID_CONTRATO), NewConstant(ID_CONTRATO, datInteger), dboEqual); + + if IsEmpty then + Expression := Condicion + else + Expression := NewBinaryExpression(Expression, Condicion, dboAnd); + end; + + finally + HideHourglassCursor; + end; +end; + function TFacturasClienteController.BuscarTodasPendientesComision(IdAgente:Integer; IdComision: Integer; IdFacturasAsociadas: String): IBizFacturaCliente; var Condicion: TDAWhereExpression; @@ -1238,6 +1268,10 @@ begin AFactura.IMPORTE_NETO := FDetallesController.DarTotalImporteTotal(AFactura.Detalles); AFactura.IMPORTE_PORTE := FDetallesController.DarTotalPorteTotal(AFactura.Detalles); + //En el caso de ser importe neto negativo y no ser una factura de tipo Abono la asignamos (Solicitado por EVA) + if (AFactura.BASE_IMPONIBLE < 0) then + AFactura.TIPO := CTE_TIPO_ABONO; + if not bEnEdicion then AFactura.Post; finally diff --git a/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.dproj b/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.dproj index 6625cd0..e679e0b 100644 --- a/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.dproj +++ b/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.dproj @@ -49,50 +49,50 @@ MainSource - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fEditorElegirArticulosFacturaCliente
TForm diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorElegirFacturasCliente.dfm b/Source/Modulos/Facturas de cliente/Views/uEditorElegirFacturasCliente.dfm index b280d90..26ca9c7 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorElegirFacturasCliente.dfm +++ b/Source/Modulos/Facturas de cliente/Views/uEditorElegirFacturasCliente.dfm @@ -211,14 +211,12 @@ inherited fEditorElegirFacturasCliente: TfEditorElegirFacturasCliente Width = 343 end inherited txtFiltroTodo2: TcxTextEdit - Left = 528 + Left = 519 Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - ExplicitLeft = 528 - ExplicitWidth = 223 - Width = 223 + ExplicitLeft = 519 end end inherited TBXAlignmentPanel1: TTBXAlignmentPanel @@ -284,16 +282,14 @@ inherited fEditorElegirFacturasCliente: TfEditorElegirFacturasCliente Margins.Right = 0 Margins.Bottom = 8 Align = alTop - Caption = - 'Seleccione las facturas de cliente que desea liquidar su comisi'#243 + - 'n' + Caption = 'Seleccione las facturas de cliente que desea para:' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [fsBold] ParentFont = False - ExplicitWidth = 362 + ExplicitWidth = 280 end object lblComments: TLabel AlignWithMargins = True @@ -356,6 +352,8 @@ inherited fEditorElegirFacturasCliente: TfEditorElegirFacturasCliente end inherited JSInformesDialog: TJSDialog [20] end + inherited JsNuevaProformaDialog: TJSDialog [21] + end object EditorSeleccionActionList: TActionList Images = SmallImages Left = 152 diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorElegirFacturasCliente.pas b/Source/Modulos/Facturas de cliente/Views/uEditorElegirFacturasCliente.pas index bd51c52..d268bd5 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorElegirFacturasCliente.pas +++ b/Source/Modulos/Facturas de cliente/Views/uEditorElegirFacturasCliente.pas @@ -89,9 +89,10 @@ procedure TfEditorElegirFacturasCliente.FormShow(Sender: TObject); begin inherited; EditorActionList.State := asSuspended; - +{ frViewFacturasCliente1.frViewFiltroBase1.edtFechaIniFiltro.EditValue := darFechaPrimerDia(now); frViewFacturasCliente1.frViewFiltroBase1.edtFechaFinFiltro.EditValue := darFechaUltimoDia(now); +} end; procedure TfEditorElegirFacturasCliente.frViewBarraSeleccion1actCancelarExecute( diff --git a/Source/Modulos/Relaciones/Contratos de cliente - Facturas de cliente/uGenerarFacturasCliUtils.pas b/Source/Modulos/Relaciones/Contratos de cliente - Facturas de cliente/uGenerarFacturasCliUtils.pas index c9e6628..c223e7e 100644 --- a/Source/Modulos/Relaciones/Contratos de cliente - Facturas de cliente/uGenerarFacturasCliUtils.pas +++ b/Source/Modulos/Relaciones/Contratos de cliente - Facturas de cliente/uGenerarFacturasCliUtils.pas @@ -12,8 +12,8 @@ type JsListaFacturasAsignadasAContrato: TJSDialog; end; - function GenerarFacturaCli(const IDContrato : Integer) : Boolean; overload; - function GenerarFacturaCli(AContrato : IBizContratoCliente; var AFactura: IBizFacturaCliente) : Boolean; overload; + function GenerarFacturaCli(const IDContrato : Integer; const TenerEnCuentaFacturasExistentes: Boolean = false) : Boolean; overload; + function GenerarFacturaCli(AContrato : IBizContratoCliente; var AFactura: IBizFacturaCliente; const AFacturasATenerEnCuenta: IBizFacturaCliente) : Boolean; overload; // function ElegirPedidoYGenerarAlbaranCli(var IDAlbaran: Integer) : Boolean; function AsignarContratoAFacturas(AContrato : IBizContratoCliente; var AFacturas: IBizFacturaCliente): Boolean; @@ -168,29 +168,41 @@ begin end; -function GenerarFacturaCli(const IDContrato : Integer) : Boolean; overload; +function GenerarFacturaCli(const IDContrato : Integer; const TenerEnCuentaFacturasExistentes: Boolean = false) : Boolean; overload; var AContrato : IBizContratoCliente; AFactura : IBizFacturaCliente; + AFacturasRelacionadas : IBizFacturaCliente; begin Result := False; + AFacturasRelacionadas := Nil; try if not Assigned(AContratosClienteController) then Inicializar; + + if TenerEnCuentaFacturasExistentes then + begin + AFacturasRelacionadas := AFacturasClienteController.ElegirFacturas(AFacturasClienteController.BuscarTodasDelContrato(IDContrato), + 'Elija la/s factura/s de cliente que desea tener en cuenta para dar de alta la nueva factura.' + , True); + end; + + AContrato := AContratosClienteController.Buscar(IDContrato); if Assigned(AContrato) then - Result := GenerarFacturaCli(AContrato, AFactura); + Result := GenerarFacturaCli(AContrato, AFactura, AFacturasRelacionadas); finally if Assigned(AContratosClienteController) then Finalizar; end; end; -function GenerarFacturaCli(AContrato : IBizContratoCliente; var AFactura: IBizFacturaCliente) : Boolean; overload; +function GenerarFacturaCli(AContrato : IBizContratoCliente; var AFactura: IBizFacturaCliente; const AFacturasATenerEnCuenta: IBizFacturaCliente) : Boolean; overload; var ARespuesta : Integer; + ACadena : String; begin AFactura := NIL; @@ -200,7 +212,7 @@ begin if not AContrato.DataTable.Active then AContrato.DataTable.Active := True; - if not Assigned(AContratosClienteController) then + if not Assigned(AFacturasClienteController) then Inicializar; try @@ -213,6 +225,54 @@ begin // AFactura.ID_TIPO_IVA := AppFactuGES.EmpresaActiva.ID_TIPO_IVA; //SIEMPRE SE ASIGNARÄ EL IVA DE LA EMPRESA ACTIVA CopiarContratoAFactura(AContrato, AFactura); CopiarDetallesAFactura(AContrato, AFactura, AContrato.Detalles); + + +//Añadir lineas descuento con las facturas seleccionadas si las hubiera Solicitado por EVA +//Presupuesto aceptado 5 de marzo 2024 + if Assigned(AFacturasATenerEnCuenta) then + begin + if not AFacturasATenerEnCuenta.DataTable.Active then + AFacturasATenerEnCuenta.DataTable.Active := True; + try + //OJO IMPORTANTE + //Siempre que vayamos a trabajar con los detalles debemos hacer un beginupdate de los mismos y un endupdate para + //obligarle siempre a recalcular los detalles una sola vez + AFacturasClienteController.DetallesController.BeginUpdate(AFactura.Detalles); + + AFacturasATenerEnCuenta.DataTable.First; + while not AFacturasATenerEnCuenta.DataTable.EOF do + begin + ACadena := 'Pago a cuenta incluido en '; + AFacturasClienteController.DetallesController.Add(AFactura.Detalles, TIPO_DETALLE_CONCEPTO); + AFactura.Detalles.Edit; + //ADetalles.REFERENCIA := AArticulos.REFERENCIA; + //ADetalles.ID_ARTICULO := AArticulos.ID_ARTICULO; + + if AFacturasATenerEnCuenta.TIPO = CTE_TIPO_FACTURA then + begin + AFactura.Detalles.CANTIDAD := -1; + ACadena := ACadena + 'Factura '; + end + else + begin + AFactura.Detalles.CANTIDAD := 1; + ACadena := ACadena + 'Abono ' + end; + + AFactura.Detalles.CONCEPTO := ACadena + AFacturasATenerEnCuenta.REFERENCIA + ' con fecha ' + DateToStr(AFacturasATenerEnCuenta.FECHA_FACTURA); + if not AFacturasATenerEnCuenta.BASE_IMPONIBLEIsNull then + AFactura.Detalles.IMPORTE_UNIDAD := AFacturasATenerEnCuenta.BASE_IMPONIBLE; + AFactura.Detalles.Post; + AFacturasATenerEnCuenta.DataTable.Next; + end; + + finally + AFacturasClienteController.DetallesController.EndUpdate(AFactura.Detalles); + AFacturasClienteController.RecalcularImportes(AFactura); + end; + end; + + AFacturasClienteController.Ver(AFactura); //Sustituir por if de guardar diff --git a/Source/Modulos/Tarifas/Controller/Tarifas_controller.dcu b/Source/Modulos/Tarifas/Controller/Tarifas_controller.dcu index bbf4240..66a70f3 100644 Binary files a/Source/Modulos/Tarifas/Controller/Tarifas_controller.dcu and b/Source/Modulos/Tarifas/Controller/Tarifas_controller.dcu differ diff --git a/Source/Servidor/FactuGES_Server.dproj b/Source/Servidor/FactuGES_Server.dproj index 3041424..99ae726 100644 --- a/Source/Servidor/FactuGES_Server.dproj +++ b/Source/Servidor/FactuGES_Server.dproj @@ -28,7 +28,7 @@ Delphi.Personality - FalseTrueFalseTrueFalse4610FalseFalseFalseFalseFalse30821252Rodax Software S.L.4.6.1.0FactuGES (Servidor)4.6.1.0jueves, 11 de abril de 2024 21:43 + FalseTrueFalseTrueFalse4620FalseFalseFalseFalseFalse30821252Rodax Software S.L.4.6.2.0FactuGES (Servidor)4.6.2.0martes, 23 de abril de 2024 17:43 Express Cross Platform Library by Developer Express Inc. ExpressPrinting System by Developer Express Inc. RemObjects Data Abstract - CoreLabs SDAC Driver diff --git a/Source/Servidor/FactuGES_Server.res b/Source/Servidor/FactuGES_Server.res index 4d145b9..da9bb8f 100644 Binary files a/Source/Servidor/FactuGES_Server.res and b/Source/Servidor/FactuGES_Server.res differ