diff --git a/Contratos/RepPresupuestos.aspx b/Contratos/RepPresupuestos.aspx index e62242dae..d8ba3eecc 100644 --- a/Contratos/RepPresupuestos.aspx +++ b/Contratos/RepPresupuestos.aspx @@ -330,6 +330,7 @@ Agrupador Autorizado + Comprometido Ejercido Por Ejercer Pagado @@ -342,6 +343,7 @@ <%-- + @@ -377,9 +379,11 @@ Total + - + + @@ -459,15 +463,19 @@ <%-- --%> - + <%-- --%> - + + + + + diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 426f06023..71a3f72b6 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 @@ -2852,6 +2853,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 +3313,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 +3515,16 @@ Partial Class OC_OC End If + + If Not HuboError AndAlso UsuarioActual.Empresa.Funcionalidad(532) = "1" Then + + If Not GeneraPrePolizaPresupuesto(objOrdenCompra.CveOrdenCompra, objOrdenCompra.IniciaTransacSQL) Then + HuboError = True + End If + + End If + + Catch ex As Exception HuboError = True End Try @@ -9027,22 +9047,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 +9079,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 +9125,7 @@ Partial Class OC_OC respuesta = True End If Next + End If Else @@ -9130,6 +9151,70 @@ Partial Class OC_OC End Function + Private Function GeneraPrePolizaPresupuesto(CveOrdenCompraPrePoliza As Integer, Optional ByRef transaccion As SqlTransaction = Nothing) As Boolean + + Dim Respuesta As Boolean = True + + If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then + + Dim ObjConta As New ClsContabilidad() + + If transaccion Is Nothing Then + ObjConta = New ClsContabilidad(Nothing) + 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}" + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, False, item.TotalSum, item.TotalSum, 154, SerieFolio, SerieFolio, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPrePoliza, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then + Respuesta = False + Exit For + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, True, item.TotalSum, item.TotalSum, 152, SerieFolio, SerieFolio, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPrePoliza, 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 --%>
- +
-
-
+
+ + <%--
--%> + <%-- Fecha Inicial --%> -
+
@@ -69,7 +70,7 @@
<%-- Fecha Final --%> -
+
@@ -100,43 +101,44 @@
-
+ <%--
--%>
<%-- Filtro Oculto --%> -
-
-
+ + + +
+
+
+
+
@@ -485,7 +491,7 @@
- + @@ -691,14 +697,14 @@ } function updateEvent(event, element) { + $('#<%=TxtCantidadPasajeros.ClientID%>').val(event.CantidadPasajeros); $('#<%=TxtFolio.ClientID%>').val(event.NumeroContrato); $('#<%=TxtObservaciones.ClientID%>').val(event.title); $('#<%=TxtDescripcion.ClientID%>').val(event.title); $('#<%=TxtUbicacion.ClientID%>').val(event.NombreAcercamiento); - <%--$('#<%=TxtFechaSalida.ClientID%>').val(event.start._i); - $('#<%=TxtFechaRegreso.ClientID%>').val(event.end._i);--%> + $('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start._i)); $('#<%=TxtFechaRegreso.ClientID%>').val(formatearFechaISO(event.FechaFinal)); @@ -722,7 +728,8 @@ $('#HidModCveCliente').val(event.CveCliente); - $('#<%=BtnModal.ClientID%>').click(); + $('#<%=BtnModal.ClientID%>').click(); + } @@ -793,6 +800,7 @@ } function Calendario() { + var date = new Date(); var d = date.getDate(); var m = date.getMonth(); diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index bff2a01e6..e47c8d212 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -38,7 +38,7 @@ Partial Class RepContratosCalendario InicializaCalendar() CargaDatos() End If - InicializaCalendar() + 'InicializaCalendar() End Sub Private Sub CargaDatos() Dim ObjContratos As New ClsContratos @@ -193,7 +193,8 @@ Partial Class RepContratosCalendario Dim ObjContratos As New ClsContratos ObjContratos.IniciaTransacSQL() - If Contrato.ToEntero <= 0 Then Contrato = CveContrato.Value + Contrato = CveContrato.Value + If ObjContratos.UpdateContratos(Contrato.ToEntero, TxtFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34, CveContratosEstatus:=DdlEstatusContrato.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveAF:=DdlAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero) Then ObjContratos.Commit() Alert("Actualizado Correctamente.")