diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb
index 57a586ee2..6162c7533 100644
--- a/App_Code/ClsCompras.vb
+++ b/App_Code/ClsCompras.vb
@@ -36,6 +36,7 @@ Public Class ClsCompras
Public Property CveCompra As Integer
Public Property CveFactura As Integer
Public Property CveCompraDetalle As Integer
+ Public Property FechaCancelacionMovto As Date
#End Region
Public Function IniciaTransacSQL() As SqlTransaction
@@ -3321,6 +3322,26 @@ Public Class ClsCompras
End Function
+ Public Function GetFechaCancelacionMovimiento(CveCompra As Integer, CveEmpresa As Integer) As Boolean
+ FechaCancelacionMovto = MinFecha
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Comp_FechaCancelacionMovimiento")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveCompra", SqlDbType.Int).Value = CveCompra
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@Fecha", SqlDbType.DateTime).Direction = ParameterDirection.Output
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ FechaCancelacionMovto = SqlAdapter.SelectCommand.Parameters("@Fecha").Value.ToString.ToDateTime
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener la fecha de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ Return Retorno
+
+
+ End Function
End Class
diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx
index f56cf82e1..6e18fa020 100644
--- a/Compras/Compras.aspx
+++ b/Compras/Compras.aspx
@@ -2562,7 +2562,7 @@
-
+
@@ -3152,7 +3152,7 @@
@@ -6479,11 +6479,11 @@
});
- //Cancelar Compra
+ <%-- //Cancelar Compra
function ShowDivCancelarCompra() {
$('#<%= TxtFechaCancelacion.ClientID%>').val($get("TxtFecha").value);
$('#DivCancelarCompra').modal();
- }
+ }--%>
function HideDivCancelarCompra() {
$('#DivCancelarCompra').modal('hide');
}
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index f618ce353..631abcc5d 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -1079,6 +1079,18 @@ Partial Class Compras_Compras
End Set
End Property
+ Public Property FechaCancelacionMovimiento As Date
+ Get
+ If ViewState("FechaCancelacionMovimiento") Is Nothing Then
+ ViewState("FechaCancelacionMovimiento") = MinFecha
+ End If
+ Return ViewState("FechaCancelacionMovimiento").ToString.ToDateTime
+ End Get
+ Set(value As Date)
+ ViewState("FechaCancelacionMovimiento") = value
+ End Set
+ End Property
+
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
'ImgBtnBuscarOC.Attributes.Add("data-toggle", "tooltip")
@@ -5734,6 +5746,9 @@ LblAmortizacion.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtRetIVA.Text.ToDecimal,
End Select
End If
+
+
+
importeMovimiento = importePagoProv
If CveMonedaPago = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 1 Then
importeMovimiento = importeMovimiento / TipoCambioCompra
@@ -5761,9 +5776,9 @@ LblAmortizacion.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtRetIVA.Text.ToDecimal,
ErrorPrepoliza = True
End If
- 'daskldaskldmaskldanmlksd
- If importeMovimiento <> 0 Then
- For Each gvRowCredito As GridViewRow In GvCreditos.Rows
+
+ 'If importeMovimiento <> 0 Then
+ For Each gvRowCredito As GridViewRow In GvCreditos.Rows
Dim ImportePagoCredito As Decimal = If(gvRowCredito.FCTextBox("TxtAmbos").Text.ToDecimal > 0, gvRowCredito.FCTextBox("TxtAmbos").Text.ToDecimal, (gvRowCredito.FCTextBox("TxtCapital").Text.ToDecimal + gvRowCredito.FCTextBox("TxtInteres").Text.ToDecimal))
Dim ImporteIEAnticipo As Decimal = gvRowCredito.DataKey("ImporteIE").ToDecimal '' Lo que se pago desde el movimiento Bancario
@@ -5812,7 +5827,7 @@ LblAmortizacion.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtRetIVA.Text.ToDecimal,
End If
End If
Next
- End If
+ 'End If
End If
importeMovimiento = 0 : importeMN = 0
If TipoCambioCompra > 1 AndAlso DdlMoneda.SelectedValue.ToEntero <> 1 Then Concepto += $" TC{TipoCambioCompra} ${importeMovimiento.FormatoNumero(2)}"
@@ -19963,6 +19978,46 @@ LblAmortizacion.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtRetIVA.Text.ToDecimal,
#End Region
+
+ Protected Sub BtnCancelarCompra_Click(sender As Object, e As EventArgs)
+
+ Dim objCompras As New ClsCompras
+
+
+ If objCompras.GetFechaCancelacionMovimiento(CveCompra:=CveCompra, CveEmpresa:=UsuarioActual.CveEmpresa) Then
+ FechaCancelacionMovimiento = objCompras.FechaCancelacionMovto
+ Else
+ FechaCancelacionMovimiento = MinFecha
+ End If
+
+ TxtFechaCancelacion.Text = TxtFecha.Text
+
+ objCompras.Dispose()
+
+ UpCancelarCompra.Update()
+
+ RegistraScript(" $('#DivCancelarCompra').modal();")
+
+ End Sub
+
+ Protected Sub CheckDevAuto_CheckedChanged(sender As Object, e As EventArgs)
+
+ TxtFechaCancelacion.Text = ""
+ BtnCancelarCompra2.Enabled = False
+
+ If CheckDevAuto.Checked Then
+ If FechaCancelacionMovimiento > MinFecha Then
+ TxtFechaCancelacion.Text = FechaCancelacionMovimiento.ToString("dd/MM/yyyy")
+ BtnCancelarCompra2.Enabled = True
+ End If
+ Else
+ TxtFechaCancelacion.Text = TxtFecha.Text
+ BtnCancelarCompra2.Enabled = True
+ End If
+
+ UpCancelarCompra.Update()
+
+ End Sub
End Class
diff --git a/Inventarios/EntradasSalidas.aspx b/Inventarios/EntradasSalidas.aspx
index 3163a96a7..98cca3b3c 100644
--- a/Inventarios/EntradasSalidas.aspx
+++ b/Inventarios/EntradasSalidas.aspx
@@ -929,8 +929,8 @@