diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb
index a5899031b..3c0f7b656 100644
--- a/App_Code/ClsContratos.vb
+++ b/App_Code/ClsContratos.vb
@@ -3246,7 +3246,7 @@ Public Class ClsContratos
Return Retorno
End Function
- Public Function GetPresupuestosRepDetalleCompras(CveProyecto As Integer, CveSubProyecto As Integer, CveAgrupador As Integer, CveTipoGasto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CveUsuario As Integer) As Boolean
+ Public Function GetPresupuestosRepDetalleCompras(CveProyecto As Integer, CveSubProyecto As Integer, CveAgrupador As Integer, CveTipoGasto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CveUsuario As Integer, Optional Comprometido As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Con_PresupuestosRepDetalleCompra")
@@ -3259,6 +3259,7 @@ Public Class ClsContratos
.Add("@FechaF", SqlDbType.Date).Value = FechaF
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuario
+ .Add("@Comprometido", SqlDbType.Bit).Value = Comprometido
End With
Try
diff --git a/Contratos/RepPresupuestos.aspx b/Contratos/RepPresupuestos.aspx
index e62242dae..62963dcf3 100644
--- a/Contratos/RepPresupuestos.aspx
+++ b/Contratos/RepPresupuestos.aspx
@@ -208,7 +208,7 @@
-
+
diff --git a/Contratos/RepPresupuestosDetalle.aspx.vb b/Contratos/RepPresupuestosDetalle.aspx.vb
index 06966b86a..5788852bb 100644
--- a/Contratos/RepPresupuestosDetalle.aspx.vb
+++ b/Contratos/RepPresupuestosDetalle.aspx.vb
@@ -87,14 +87,15 @@ Partial Class Contratos_RepPresupuestosDetalle
Gpo = IfNull(Request("CveAgrupador"), -1).ToString.ToEntero
Dim Mensual = CBool(IfNull(Request("Mensual"), False))
Dim EsProyecto = CBool(IfNull(Request("EsProyecto"), False))
- If Agrupador = 1 Then Agrupador = 2 Else Agrupador = 1
+ 'If Agrupador = 1 Then Agrupador = 2 Else Agrupador = 1
DdlAgrupador.SelectedValueExist(Agrupador)
- DdlClasificacion.SelectedValueExist(CveClasificacion)
- If DdlAgrupador.SelectedValue.ToEntero = 2 Then
+ DdlClasificacion.SelectedValueExist(CveClasificacion)
+
+ If DdlAgrupador.SelectedValue.ToEntero = 1 Then
DdlClasificacion.SelectedValueExist(Gpo)
DdlProyecto.SelectedValueExist(CveProyecto)
DdlSubProyecto.SelectedValueExist(CveSubProyecto)
- ElseIf DdlAgrupador.SelectedValue.ToEntero = 1 Then
+ ElseIf DdlAgrupador.SelectedValue.ToEntero = 2 Then
If Not EsProyecto Then
Dim Dr As DataRow = GlobalDTSubProyectos(-1, Gpo)(0)
DdlProyecto.SelectedValueExist(Dr("CveProyecto"))
@@ -158,20 +159,20 @@ Partial Class Contratos_RepPresupuestosDetalle
e.Row.Cells(1).Text = "-"
End If
If e.Row.DBCampo("Ejercido").ToDecimal = 0 Then
- e.Row.Cells(2).Text = "-"
- End If
- If e.Row.DBCampo("EjercidoPorcentaje").ToDecimal = 0 Then
e.Row.Cells(3).Text = "-"
End If
- If e.Row.DBCampo("PorEjercer").ToDecimal = 0 Then
+ If e.Row.DBCampo("EjercidoPorcentaje").ToDecimal = 0 Then
e.Row.Cells(4).Text = "-"
End If
- If e.Row.DBCampo("PorEjercerPorcentaje").ToDecimal = 0 Then
+ If e.Row.DBCampo("PorEjercer").ToDecimal = 0 Then
e.Row.Cells(5).Text = "-"
End If
- If e.Row.DBCampo("Pagado").ToDecimal = 0 Then
+ If e.Row.DBCampo("PorEjercerPorcentaje").ToDecimal = 0 Then
e.Row.Cells(6).Text = "-"
End If
+ If e.Row.DBCampo("Pagado").ToDecimal = 0 Then
+ e.Row.Cells(7).Text = "-"
+ End If
If e.Row.RowIndex > 0 Then
Dim CveAgrupador = e.Row.DBCampo("CveAgrupador").ToEntero
Dim EsProyecto = False
@@ -185,9 +186,13 @@ Partial Class Contratos_RepPresupuestosDetalle
End If
EsProyecto = True
End If
- Dim Css = "Texto"
+ Dim Css = "Texto"
+
Dim Liga = $"/Contratos/RepPresupuestosDetalleCompras.aspx?&CveAgrupador={CveAgrupador}&CveClasificacion={e.Row.DBCampo("CveClasificacionFiltro")}&CveConceptoContableNom={e.Row.DBCampo("CveConceptoContableNomFiltro")}&CveProyecto={e.Row.DBCampo("CveProyectoFiltro")}&CveSubProyecto={e.Row.DBCampo("CveSubProyectoFiltro")}&CveTipoGasto={e.Row.DBCampo("CveTipoGastoFiltro")}&Agrupador={e.Row.DBCampo("AgrupadorFiltro")}&Mensual={False}&EsProyecto={EsProyecto}&FechaFin={FechaFin}&FechaInicio={FechaInicio}"
e.Row.Cells(0).Text = "" + e.Row.Cells(0).Text + ""
+
+ Dim LigaComprometido = $"/Contratos/RepPresupuestosDetalleCompras.aspx?&CveAgrupador={CveAgrupador}&CveClasificacion={e.Row.DBCampo("CveClasificacionFiltro")}&CveConceptoContableNom={e.Row.DBCampo("CveConceptoContableNomFiltro")}&CveProyecto={e.Row.DBCampo("CveProyectoFiltro")}&CveSubProyecto={e.Row.DBCampo("CveSubProyectoFiltro")}&CveTipoGasto={e.Row.DBCampo("CveTipoGastoFiltro")}&Agrupador={e.Row.DBCampo("AgrupadorFiltro")}&Mensual={False}&EsProyecto={EsProyecto}&FechaFin={FechaFin}&FechaInicio={FechaInicio}&Comprometido=1"
+ e.Row.Cells(2).Text = "" + e.Row.Cells(2).Text + ""
End If
End If
End Sub
diff --git a/Contratos/RepPresupuestosDetalleCompras.aspx b/Contratos/RepPresupuestosDetalleCompras.aspx
index a6f50fb94..f251ca390 100644
--- a/Contratos/RepPresupuestosDetalleCompras.aspx
+++ b/Contratos/RepPresupuestosDetalleCompras.aspx
@@ -219,7 +219,7 @@
-
Clasificacion:
+
Clasificación:
diff --git a/Contratos/RepPresupuestosDetalleCompras.aspx.vb b/Contratos/RepPresupuestosDetalleCompras.aspx.vb
index 08d386d3f..f1dafa0e4 100644
--- a/Contratos/RepPresupuestosDetalleCompras.aspx.vb
+++ b/Contratos/RepPresupuestosDetalleCompras.aspx.vb
@@ -2,11 +2,14 @@
Option Strict On
Imports System.Data
Imports Extensiones
+Imports Org.BouncyCastle.Asn1.Ocsp
Partial Class Contratos_RepPresupuestosDetalleCompras
- Inherits ClsPaginas
-
+ Inherits ClsPaginas
+
+
+
#Region "P R O P I E D A D E S"
-
+
Public Property Gpo() As Integer
Get
Return DirectCast(ViewState("Gpo"), Integer)
@@ -14,8 +17,20 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
Set(ByVal value As Integer)
ViewState("Gpo") = value
End Set
- End Property
-
+ End Property
+
+ Public Property Comprometido As Boolean
+ Get
+ If ViewState("Comprometido") Is Nothing Then
+ ViewState("Comprometido") = False
+ End If
+ Return Boolean.Parse(ViewState("Comprometido").ToString)
+ End Get
+ Set(value As Boolean)
+ ViewState("Comprometido") = value
+ End Set
+ End Property
+
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
@@ -25,8 +40,8 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
CargaDatos()
End If
- End Sub
-
+ End Sub
+
#Region " INICIALIZA VALORES "
Private Sub InicializaValores()
@@ -71,7 +86,11 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
Dim CveProyecto = IfNull(Request("CveProyecto"), -1).ToString.ToEntero
Dim CveSubProyecto = IfNull(Request("CveSubProyecto"), -1).ToString.ToEntero
Dim CveTipoGasto = IfNull(Request("CveTipoGasto"), -1).ToString.ToEntero
- Dim Agrupador = IfNull(Request("Agrupador"), -1).ToString.ToEntero
+ Dim Agrupador = IfNull(Request("Agrupador"), -1).ToString.ToEntero
+
+ Comprometido = If(Request("Comprometido") IsNot Nothing AndAlso Request("Comprometido").ToEntero = 1, True, False)
+
+
Gpo = IfNull(Request("CveAgrupador"), -1).ToString.ToEntero
Dim EsProyecto = CBool(IfNull(Request("EsProyecto"), False))
If Agrupador = 1 Then Agrupador = 2 Else Agrupador = 1
@@ -106,7 +125,8 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
End Sub
Private Sub CargaDatos()
Dim ObjPresupuestos As New ClsContratos
- If ObjPresupuestos.GetPresupuestosRepDetalleCompras(DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlTipoGasto.SelectedValue.ToEntero, TxtFiltrosFechaInicio.Text.ToDate, TxtFiltrosFechaFin.Text.ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
+ If ObjPresupuestos.GetPresupuestosRepDetalleCompras(DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlTipoGasto.SelectedValue.ToEntero, TxtFiltrosFechaInicio.Text.ToDate,
+ TxtFiltrosFechaFin.Text.ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Comprometido:=Comprometido) Then
GvDatos.DataSource = ObjPresupuestos.DtResultados
End If
ObjPresupuestos.Dispose()
@@ -131,15 +151,21 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
Dim Liga = ""
Dim Css = "Texto"
- Dim TipoAgrupador As Integer = e.Row.DBCampo("TipoAgrupador").ToEntero()
- Select Case TipoAgrupador
- Case 1
- Liga = $"/Compras/Compras.aspx?&CveCompra={e.Row.DBCampo("CveCompra")}"
- Case 2
- Liga = $"/Contabilidad/RegPrePoliza.aspx?&CvePrePoliza={e.Row.DBCampo("CveCompra")}"
- Case Else
+
+ If Comprometido Then
+ Liga = $"/OC/OC.aspx?OC={e.Row.DBCampo("CveOrdenCompra")}"
+ Else
+ Dim TipoAgrupador As Integer = e.Row.DBCampo("TipoAgrupador").ToEntero()
+ Select Case TipoAgrupador
+ Case 1
+ Liga = $"/Compras/Compras.aspx?&CveCompra={e.Row.DBCampo("CveCompra")}"
+ Case 2
+ Liga = $"/Contabilidad/RegPrePoliza.aspx?&CvePrePoliza={e.Row.DBCampo("CveCompra")}"
+ Case Else
+
+ End Select
+ End If
- End Select
e.Row.Cells(0).Text = "" + e.Row.Cells(0).Text + ""
End If
End If
diff --git a/OC/OC.aspx b/OC/OC.aspx
index c754747cb..a91d86f88 100644
--- a/OC/OC.aspx
+++ b/OC/OC.aspx
@@ -2239,7 +2239,7 @@
-
+
diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb
index 426f06023..4b2a682fc 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
@@ -5438,28 +5464,46 @@ Partial Class OC_OC
End If
End Sub
+
Private Sub EnviaCorreoSolicitudAnticipo(CveEvento As Integer, Optional ImporteAnticipo As Decimal = 0)
Dim Param As New List(Of String)
Dim DtPara As DataTable = GlobalDTUsuarios(DdlSAUsuario.SelectedValue.ToString.ToEntero, CveEmpresaActual)
+
If DdlMetodoPago.SelectedValue.ToEntero = 0 Then
+
DtPara = GlobalDTUsuarios(DdlSAUsuarioContado.SelectedValue.ToString.ToEntero, CveEmpresaActual)
+
+ If DtPara Is Nothing Then
+ DtPara = GlobalDTUsuarios(DdlSAUsuario.SelectedValue.ToString.ToEntero, CveEmpresaActual)
+ End If
+
End If
- Param.Add(DtPara.Rows(0)("Correo").ToString()) 'Para
- Param.Add("Solicitud de anticipo de Orden de Compra") 'Asunto
+ Try
+ If DtPara IsNot Nothing AndAlso DtPara.Rows.Count > 0 Then
+
+ Param.Add(DtPara.Rows(0)("Correo").ToString()) 'Para
+ Param.Add("Solicitud de anticipo de Orden de Compra") 'Asunto
- If ImporteAnticipo = 0 Then
- ImporteAnticipo = TxtSAImporte.Text.ToDecimal
- End If
+ If ImporteAnticipo = 0 Then
+ ImporteAnticipo = TxtSAImporte.Text.ToDecimal
+ End If
- Param.Add(GeneraCorreoAnticipo(lblFolio.Text, DtPara.Rows(0)("Nombre").ToString(), String.Format("http://sig.adssistemas.mx/OI/EventoDetalle.aspx?CveTipoEvento=1&CveEvento={0}", CveEvento), ImporteAnticipo.ToString, DdlProveedores.SelectedText))
- Param.Add(String.Format("{0}PDF\OC-{1}.pdf", UsuarioActual.Empresa.Ruta, CveOrdenCompra))
- Dim Hilo As New Threading.Thread(AddressOf MandaCorreoAnticipo)
- Hilo.Start(Param)
+ Param.Add(GeneraCorreoAnticipo(lblFolio.Text, DtPara.Rows(0)("Nombre").ToString(), String.Format("http://sig.adssistemas.mx/OI/EventoDetalle.aspx?CveTipoEvento=1&CveEvento={0}", CveEvento), ImporteAnticipo.ToString, DdlProveedores.SelectedText))
+ Param.Add(String.Format("{0}PDF\OC-{1}.pdf", UsuarioActual.Empresa.Ruta, CveOrdenCompra))
+ Dim Hilo As New Threading.Thread(AddressOf MandaCorreoAnticipo)
+ Hilo.Start(Param)
+
+ End If
+ Catch ex As Exception
+
+ End Try
+
End Sub
+
Private Sub EnviaCorreoSolicitudAnticipoCancelado()
'If Not CveIEAnticipo > 0 Then 'SI NO SE HA REALIZADO EL ANTICIPO NOTIFICA QUE SE HA CANCELADO
Dim ObjOC As New ClsOC
@@ -9008,7 +9052,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 +9072,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 +9104,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 +9150,7 @@ Partial Class OC_OC
respuesta = True
End If
Next
+
End If
Else
@@ -9130,6 +9176,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 --%>
+
+
+
@@ -682,8 +691,14 @@
var date = null;
function InitCalendar() {
- $(document).ready(function () {
- Calendario();
+ $(document).ready(function () {
+
+ let mes = parseInt($('#<%=HidCurrentMonth.ClientID%>').val());
+ let anio = parseInt($('#<%=HidCurrentYear.ClientID%>').val());
+
+
+ Calendario(mes,anio);
+
});
}
@@ -691,14 +706,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 +737,8 @@
$('#HidModCveCliente').val(event.CveCliente);
- $('#<%=BtnModal.ClientID%>').click();
+ $('#<%=BtnModal.ClientID%>').click();
+
}
@@ -792,13 +808,28 @@
updateEventOnDropResize(event);
}
- function Calendario() {
+ function Calendario(mes = -1, anio = -1) {
+
+
+ let fechaActual = new Date();
+ if (mes === -1) {
+ mes = fechaActual.getMonth() + 1;
+ }
+ if (anio === -1) {
+ anio = fechaActual.getFullYear();
+ }
+
+
+ let mesFormateado = ('0' + mes).slice(-2);
+ let fechaInicio = `${anio}-${mesFormateado}-01`;
+
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var h = {};
+ //alert(fechaInicio);
if ($('#calendar').width() <= 400) {
$('#calendar').addClass("mobile");
h = {
@@ -818,6 +849,7 @@
$('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar({
+ defaultDate: fechaInicio,
header: h,
monthNames: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
@@ -849,10 +881,39 @@
}
},
eventDrop: eventDropped,
- eventResize: eventResized
+ eventResize: eventResized,
+ viewRender: function(view, element) {
+
+ let pointDate = view.intervalStart;
+ let currentMonth = pointDate.month() + 1;
+ let currentYear = pointDate.year();
+
+ $('#<%=HidCurrentMonth.ClientID%>').val(currentMonth);
+ $('#<%=HidCurrentYear.ClientID%>').val(currentYear);
+
+ }
+
});
}
+ function obtenerFechaInicio(mes = -1, anio = -1) {
+ let fechaActual = new Date();
+
+ if (mes === -1) {
+ mes = fechaActual.getMonth() + 1; // getMonth() es base 0, así que se suma 1
+ }
+ if (anio === -1) {
+ anio = fechaActual.getFullYear();
+ }
+
+
+ let mesFormateado = ('0' + mes).slice(-2);
+
+
+ let fechaInicio = `${anio}-${mesFormateado}-01`;
+
+ return fechaInicio;
+ }
diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb
index bff2a01e6..dbafeca6b 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
@@ -107,7 +107,8 @@ Partial Class RepContratosCalendario
UPPGantt.Update()
End If
End Sub
- Private Sub InicializaCalendar()
+ Private Sub InicializaCalendar()
+
RegistraScript("InitCalendar();")
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
End Sub
@@ -193,17 +194,19 @@ 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.")
Else
ObjContratos.RollBack()
- End If
-
+ End If
+
ObjContratos.Dispose()
UpTitulos.Update()
CargaDatos()
+ InicializaCalendar()
End Sub
Protected Sub UpdateModal(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
diff --git a/Ventas/RepCancelacionesPorRespuesta.aspx.cs b/Ventas/RepCancelacionesPorRespuesta.aspx.cs
index 096e121fc..b4907ecf4 100644
--- a/Ventas/RepCancelacionesPorRespuesta.aspx.cs
+++ b/Ventas/RepCancelacionesPorRespuesta.aspx.cs
@@ -566,7 +566,13 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
}
else
{
+ //SI REGISTRA SALIDA DE ALMACÉN EN AUTOMÁTICO Y ES DEVOLUCION QUE REALIZE EL MOVMIENTO DE SALIDA DE ALMACEN
+ if (UsuarioActual.Empresa.Funcionalidad(567) == "1" && factura.TipoDocto == "Dev" && factura.SaldoAlmacen != 0)
+ {
+ factura.RealizarDevolucionAlmacen = true;
+ }
retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
+
}
return retorno;
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index f7f66754d..274ae7575 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -7529,7 +7529,7 @@ Partial Class Ventas
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
- If (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1", "2")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
+ If (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
RBLPago.SelectedValue = "2"
RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing)
@@ -7664,7 +7664,9 @@ Partial Class Ventas
'SI ES AUTORIZACION DEBE PERMITIR GENERARLA
If Bloqueo Then
- BtnEmitirImprimir.Visible = False
+ If DdlTipoComprobante.SelectedValue <> "Cot" Then
+ BtnEmitirImprimir.Visible = False
+ End If
BtnsFacturar.Visible = False
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
BtnGenerarRemision.Visible = False
@@ -7952,7 +7954,9 @@ Partial Class Ventas
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
- BtnEmitirImprimir.Visible = False
+ If DdlTipoComprobante.SelectedValue <> "Cot" Then
+ BtnEmitirImprimir.Visible = False
+ End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then
TieneBloqueoPorCreditoVencimiento = 1
@@ -7977,11 +7981,40 @@ Partial Class Ventas
End If
End If
-
End If
UPPCreditoDisponible.Update()
+ 'SOLO VERIFICA VENCIMIENTOS
+ If UsuarioActual.Empresa.Funcionalidad(702).Contiene("2") Then
+
+ Dim ValidaCliente As Boolean = False
+
+ If (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") AndAlso (Me.CveVenta <= 0 OrElse EsCreaApartirDe)) OrElse ((DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso (Me.CveVenta > 0 AndAlso Not EsCreaApartirDe))) Then
+ ValidaCliente = True
+ End If
+
+ If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso (Me.CveCliente = UsuarioActual.Empresa.Funcionalidad(714).ToEntero()) Then
+ ValidaCliente = False
+ End If
+
+ 'SI ES FACTURA, REMISION o FACTURACION DE COTIZACIONES
+ If ValidaCliente Then
+ Dim Vta As New ClsVentas
+ Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa, TipoVerificacion:=2)
+ Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
+ Vta.Dispose()
+
+ If Opcion = 2 Then
+ Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
+ BtnEmitirImprimir.Visible = False
+ BtnsFacturar.Visible = False
+ BtnGenerarRemision.Visible = False
+ TieneBloqueoPorCreditoVencimiento = 1
+ End If
+ End If
+ End If
+
'Puede hacer pedido
If CveVenta <= 0 Then
If Not UsuarioActual.TienePermisoProceso(177) And Not EsVentaMedica Then
@@ -9626,7 +9659,7 @@ Partial Class Ventas
Me.CveAutorizacion = -1
'SI ES A CREDITO DEBE VERIFICAR SI TIENE AUTORIZACIONES
- If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs") AndAlso RBLPago.SelectedValue = "1" Then
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing") AndAlso RBLPago.SelectedValue = "1" Then
Dim TipoDocumentoAutorizacion As String = ""
Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0
@@ -9634,13 +9667,13 @@ Partial Class Ventas
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
Dim ObjVentas As New ClsVentas
Try
- If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, DdlTipoDocto.SelectedValue, CveEstatus:=1) Then
+ If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "Ing", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = Nothing
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
If TieneDiasVencidos Then
- RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="Importe DESC")
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
Else
- RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="Importe DESC")
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If
If RowAutorizacion IsNot Nothing Then
@@ -9660,11 +9693,11 @@ Partial Class Ventas
If TipoDocumentoAutorizacion = "Ing" Then
If TipoAutorizacion = 1 Then
- If TieneDiasVencidos Then
- CveAutorizacion = -1
- Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+ 'If TieneDiasVencidos Then
+ ' CveAutorizacion = -1
+ ' Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ 'End If
If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
Dim BloquearCredito As Boolean = True
@@ -9714,79 +9747,23 @@ Partial Class Ventas
End If
End If
- If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
- CveAutorizacion = -1
- Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+ 'If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
+ ' CveAutorizacion = -1
+ ' Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ 'End If
- If TipoDocumentoAutorizacion = "Egs" Then
- If TipoAutorizacion = 1 Then
- If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
- CveAutorizacion = -1
- Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
- End If
- End If
+ 'If TipoDocumentoAutorizacion = "Egs" Then
+ ' If TipoAutorizacion = 1 Then
+ ' If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
+ ' CveAutorizacion = -1
+ ' Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ ' End If
+ ' End If
+ 'End If
End If
- 'SI TIENE LINEA ADICIONAL NO VERIFICAR LIMITE DE CREDITO
- 'SI NO TIENE AUTORIZACION VERIFICAR LIMITE DE CREDITO Y CANDADOS DE VENTA
- 'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada.
- 'If DdlLineaAdicional.SelectedValue.ToEntero() <= 0 AndAlso Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
- ' 'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then
-
- ' If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then
- ' Dim ObjVentas As New ClsVentas
-
- ' If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then
- ' If ObjVentas.DtResultados.Rows.Count > 0 Then
-
- ' If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then
- ' If ObjVentas.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
- ' ObjVentas.Dispose()
- ' Alert("Se está excediendo el límite de credito permitido de la Sucursal del Cliente.", TipoMensaje.MsgInformacion)
- ' Exit Sub
- ' End If
- ' Else
- ' If ObjVentas.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
- ' ObjVentas.Dispose()
- ' Alert("Se está excediendo el límite de credito permitido del Cliente.", TipoMensaje.MsgInformacion)
- ' Exit Sub
- ' End If
- ' End If
-
- ' Else
- ' ObjVentas.Dispose()
- ' Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
- ' Exit Sub
- ' End If
- ' Else
- ' ObjVentas.Dispose()
- ' Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
- ' Exit Sub
- ' End If
- ' ObjVentas.Dispose()
-
- ' 'VERIFICA SI TIENE BLOQUEO POR DIAS VENCIDOS
- ' If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
- ' Dim Vta As New ClsVentas
- ' Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa, TipoVerificacion:=2)
- ' Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
- ' Vta.Dispose()
-
- ' If Opcion = 2 Then
- ' Alert(OpcionMsg, TipoMensaje.MsgError)
- ' Exit Sub
- ' End If
- ' End If
-
- ' End If
-
- ' 'End If
- 'End If
-
'VALIDAR LINEAS ADICIONALES
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
'VERIFICA QUE LA CATEGORIA DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
@@ -18188,8 +18165,8 @@ Partial Class Ventas
'VALIDA ESTATUS CLIENTE - SOLO SE PUEDE USAR EL CLIENTE PARA COTIZAR EN CASO DE ESTAR INACTIVO
If EsCreaApartirDe OrElse ModalidadEdicion OrElse CveVenta <= 0 Then
If DdlTipoComprobante.SelectedValue.Contiene("Cot", "DPe") Or TipoContrato >= 0 Then 'SI VIENE DE PEDIDO DE AF DESDE CONTRATO NO BLOQUEA CUANDO EL CLIENTE ESTA INACTIVO
- BtnEmitirImprimir.Visible = TieneBloqueoPorCreditoVencimiento = 0
- TrVistaPrevia.Visible = TieneBloqueoPorCreditoVencimiento = 0
+ BtnEmitirImprimir.Visible = True
+ TrVistaPrevia.Visible = True
Else
If LblCliente.Text <> "Cliente" And Not EstatusCliente Then
Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia)