diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb
index 10d58a750..e9fd6f6d5 100644
--- a/App_Code/ClsContabilidad.vb
+++ b/App_Code/ClsContabilidad.vb
@@ -1004,11 +1004,13 @@ Public Class ClsContabilidad
If ex1.Message.Contains("50015;") Then
OnError("No se puede registrar una póliza en un ejercicio Cerrado", ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
ElseIf ex1.Message.Contains("50024; La Cuenta no fue detectada") Then
- Dim dtt As DataTable = ClsPaginas.GlobalDTContaConceptosContables(CveConceptoContable)
+ Dim dr As Data.DataRow = ClsPaginas.GlobalDTContaConceptosContables(CveConceptoContable).FiltroPrimero("")
Dim StrMsg As String = ""
- If dtt IsNot Nothing Then
+ If dr IsNot Nothing Then
+ If CveConceptoContable <> dr("CveConceptoContable").ToString.ToEntero Then 'si el concepto pareja no es principal, lo obtengo
+ dr = ClsPaginas.GlobalDTContaConceptosContables(dr("CveParejaContable").ToString.ToEntero).FiltroPrimero("")
+ End If
Dim tCveEmp As Integer = CType(HttpContext.Current.Session("UsuarioSIG"), Usuario).CveEmpresa
- Dim dr As Data.DataRow = dtt.FiltroPrimero("")
If dr IsNot Nothing Then
StrMsg = dr("ConceptoContable").ToString
If dr("AplicaClasificacion").ToString = "True" Then
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 0b524ae8f..277b6fbf5 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -10670,7 +10670,6 @@ Public Class ClsPaginas
PaginaDict.Add("/Sistemas/CatProcesos.aspx".ToUpper(), 69)
PaginaDict.Add("/Sistemas/CatParametros.aspx".ToUpper(), 143)
PaginaDict.Add("/Sistemas/PopUpCargaCertificados.aspx".ToUpper(), 144)
- PaginaDict.Add("/Sistemas/CatNotificaciones.aspx".ToUpper(), 146)
PaginaDict.Add("/Sistemas/EmpresasModulos.aspx".ToUpper(), 346)
PaginaDict.Add("/Sistemas/CatSesiones.aspx".ToUpper(), 374)
PaginaDict.Add("/Sistemas/CatFuncionalidades.aspx".ToUpper(), 568)
@@ -10789,10 +10788,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Ventas/CatEspecialidadesSubEspecialidades.aspx".ToUpper(), 1346)
PaginaDict.Add("/Ventas/FacturacionGlobal.aspx".ToUpper(), 546)
PaginaDict.Add("/Ventas/RepComisionesSMS.aspx".ToUpper(), 1347)
-
-
-
-
+ PaginaDict.Add("/Ventas/RepVencimientosCredito.aspx".ToUpper(), 146)
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index ab0b16d22..844dbb8db 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -5983,6 +5983,30 @@ Public Class ClsVentas
End Function
+ Public Function GetLineasAdicionalesVencimientos(CveCliente As Integer, TipoLinea As Integer, FechaInicio As Date, FechaFin As Date, CveMoneda As Integer, CveEmpresa As Integer) As Boolean
+
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Vta_LineasAdicionalesVencimientosGet")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
+ .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
+ .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
+ .Add("@TipoLinea", SqlDbType.Int).Value = TipoLinea
+ .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error obtener las lineas de adicionales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return Retorno
+
+
+ End Function
+
+
Public Function CambioClientesVendedor(CveCliente As Integer, CveVendedor As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
diff --git a/Contratos/RepPresupuestos.aspx b/Contratos/RepPresupuestos.aspx
index e62242dae..ebe5ac5bd 100644
--- a/Contratos/RepPresupuestos.aspx
+++ b/Contratos/RepPresupuestos.aspx
@@ -329,7 +329,8 @@
+
-
+
+
@@ -459,15 +463,19 @@
<%-- --%>
-
+
<%----%>
-
+
+
+
+
+
diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb
index 426f06023..40d6360bd 100644
--- a/OC/OC.aspx.vb
+++ b/OC/OC.aspx.vb
@@ -6,6 +6,7 @@ Imports System.Data.SqlClient
Imports System.IO
Imports Extensiones
Imports GemBox.Spreadsheet
+Imports Microsoft.Owin.Security.Provider
Imports Newtonsoft.Json
Partial Class OC_OC
@@ -925,7 +926,13 @@ Partial Class OC_OC
ChkEntregaDirecta.Checked = False
End If
-
+ If UsuarioActual.CveEmpresa.Contiene(13, 73) AndAlso CveOrdenCompra > 0 AndAlso Request("Conta") IsNot Nothing AndAlso Request("Conta").ToEntero = 1 Then
+ If GeneraPrePolizaPresupuesto(CveOrdenCompra, Nothing) Then
+ Alert("PrePoliza de Presupuesto Generada Correctamente")
+ Else
+ Alert("No Se Genero la PrePoliza de Presupuesto Generada Correctamente", TipoMensaje.MsgAdvertencia)
+ End If
+ End If
End If
@@ -2852,6 +2859,14 @@ Partial Class OC_OC
End If
+ If Not TieneError AndAlso TipoOC = "OC" Then
+
+ If Not GeneraPrePolizaPresupuesto(CveOrdenCompra, OC.IniciaTransacSQL) Then
+ TieneError = True
+ End If
+
+ End If
+
If Not TieneError Then
If Conta IsNot Nothing Then Conta.Commit()
OC.Commit()
@@ -3304,6 +3319,7 @@ Partial Class OC_OC
'TERMINA TODO POR SI OCURRIÓ ALGO RARO
If TieneError Then
+
If OC IsNot Nothing Then OC.RollBack()
If UsuarioActual.Empresa.UsaAC AndAlso VerificaPresupuesto Then
If Conta IsNot Nothing Then Conta.RollBack()
@@ -3505,6 +3521,16 @@ Partial Class OC_OC
End If
+
+ If UsuarioActual.CveEmpresa.Contiene(13, 73) Then
+
+ If Not GeneraPrePolizaPresupuesto(objOrdenCompra.CveOrdenCompra, objOrdenCompra.IniciaTransacSQL) Then
+ HuboError = True
+ End If
+
+ End If
+
+
Catch ex As Exception
HuboError = True
End Try
@@ -9008,7 +9034,8 @@ Partial Class OC_OC
Dim respuesta As Boolean = False
- If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then
+ 'If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then
+ If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
Dim ObjCon As New ClsContratos
Dim CvePresupuesto As Integer = 0
@@ -9027,22 +9054,6 @@ Partial Class OC_OC
If resultadosFiltrados.Count > 0 Then
- Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable()
- Group row By
- SubProyecto = row.Field(Of String)("SubProyecto"),
- CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"),
- Clasificacion = row.Field(Of String)("Clasificacion"),
- CveClasificacion = row.Field(Of Integer)("CveClasificacion")
- Into Group
- Select New With {
- .SubProyecto = SubProyecto,
- .CveSubProyecto = CveSubProyecto,
- .Clasificacion = Clasificacion,
- .CveClasificacion = CveClasificacion,
- .TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))))
- }).ToList()
-
-
If Opcion = 1 Then
@@ -9075,6 +9086,22 @@ Partial Class OC_OC
End If
Else
+
+ Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable()
+ Group row By
+ SubProyecto = row.Field(Of String)("SubProyecto"),
+ CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"),
+ Clasificacion = row.Field(Of String)("Clasificacion"),
+ CveClasificacion = row.Field(Of Integer)("CveClasificacion")
+ Into Group
+ Select New With {
+ .SubProyecto = SubProyecto,
+ .CveSubProyecto = CveSubProyecto,
+ .Clasificacion = Clasificacion,
+ .CveClasificacion = CveClasificacion,
+ .TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))))
+ }).ToList()
+
For Each item In EnumAgrupado
Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = item.CveSubProyecto)
@@ -9105,6 +9132,7 @@ Partial Class OC_OC
respuesta = True
End If
Next
+
End If
Else
@@ -9130,6 +9158,81 @@ Partial Class OC_OC
End Function
+ Private Function GeneraPrePolizaPresupuesto(CveOrdenCompraPresupuesto As Integer, Optional ByRef transaccion As SqlTransaction = Nothing) As Boolean
+
+ Dim Respuesta As Boolean = True
+
+ If UsuarioActual.CveEmpresa.Contiene(13, 73) Then
+
+ Dim CveMonedaPresupuesto As Integer = DdlMoneda.SelectedValue.ToEntero
+ Dim TC As Decimal = If(CveMonedaPresupuesto = 1, 1, GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal)
+
+ If CveMonedaPresupuesto > 1 AndAlso TC = 0 Then
+ Alert($"No se genero la prepoliza de presupuesto, no se pudo obtener el Tipo de Cambio de la fecha {TxtFecha.Text}", TipoMensaje.MsgAdvertencia)
+ Return False
+ End If
+
+ Dim ObjConta As New ClsContabilidad()
+
+ If transaccion Is Nothing Then
+ ObjConta = New ClsContabilidad()
+ Else
+ ObjConta = New ClsContabilidad(transaccion)
+ End If
+
+ Dim CvePrePolizaPreSuPuesto = ObjConta.AddPrePolizas("OC/OC-(Presupuesto)", 53, LblTotal.Text.ToDecimal, LblTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlProveedores.SelectedText, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
+
+ If CvePrePolizaPreSuPuesto > 0 Then
+
+ Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable()
+ Group row By
+ SubProyecto = row.Field(Of String)("SubProyecto"),
+ CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"),
+ Clasificacion = row.Field(Of String)("Clasificacion"),
+ CveClasificacion = row.Field(Of Integer)("CveClasificacion")
+ Into Group
+ Select New With {
+ .SubProyecto = SubProyecto,
+ .CveSubProyecto = CveSubProyecto,
+ .Clasificacion = Clasificacion,
+ .CveClasificacion = CveClasificacion,
+ .TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))) + If(IsDBNull(r("IVA")), 0D, Convert.ToDecimal(r("IVA"))) + If(IsDBNull(r("IEPSPSIVA")), 0D, Convert.ToDecimal(r("IEPSPSIVA"))) - If(IsDBNull(r("RetIVA")), 0D, Convert.ToDecimal(r("RetIVA"))) - If(IsDBNull(r("RetISR")), 0D, Convert.ToDecimal(r("RetISR"))))
+ }).ToList()
+
+ For Each item In EnumAgrupado
+
+ Dim SerieFolio = $"OC: {Folio}, Clasificación: {item.Clasificacion}"
+
+ Dim Importe As Decimal = item.TotalSum
+ Dim ImporteME As Decimal = If(CveMonedaPresupuesto = 1, 0, item.TotalSum)
+ Dim ImporteMN As Decimal = If(CveMonedaPresupuesto = 1, item.TotalSum, item.TotalSum * TC)
+
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, False, Importe, ImporteMN, 154, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then
+ Respuesta = False
+ Exit For
+ End If
+
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, True, Importe, ImporteMN, 152, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then
+ Respuesta = False
+ Exit For
+ End If
+
+ Next
+ Else
+ Respuesta = False
+ End If
+
+
+
+ End If
+
+ Return Respuesta
+
+ End Function
+
+
+
+
#End Region
diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx
index 86deadc43..d8dd7ac16 100644
--- a/Transportes/RepContratos.aspx
+++ b/Transportes/RepContratos.aspx
@@ -41,15 +41,16 @@
<%-- Filtro Visible - Consulta --%>