Compras Cancelacion Fecha de cancelacion de movimeinto con devolución

This commit is contained in:
rakcsle
2023-08-29 18:09:13 -07:00
parent 11d413f094
commit 220ec9db43
6 changed files with 92 additions and 14 deletions

View File

@@ -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

View File

@@ -2562,7 +2562,7 @@
<asp:Button ID="BtnEliminarCompra" CssClass="btn btn-danger" Visible="False" runat="server" Text="Eliminar Compra" />
<br />
<br />
<asp:Button ID="BtnCancelarCompra" OnClientClick="ShowDivCancelarCompra();" Text="Cancelar Compra" CssClass="btn btn-danger" Visible="false" runat="server" />
<asp:Button ID="BtnCancelarCompra" Text="Cancelar Compra" CssClass="btn btn-danger" Visible="false" runat="server" OnClick="BtnCancelarCompra_Click" />
<br />
<br />
<asp:Button ID="BtnRegenerarPrePolizaAlmacen" OnClick="BtnRegenerarPrePolizaAlmacen_Click" CssClass="btn btn-warning" Visible="False" runat="server" Text="Regenerar PrePoliza" data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea regenerar la prepoliza?" data-btn-ok-label="si" />
@@ -3152,7 +3152,7 @@
<div class="row" style="align-items: center" id="divDevAuto" runat="server" visible="false">
<label class="col-md-4">Devolución automática:</label>
<div class="col-md-8">
<asp:CheckBox Text="" runat="server" ID="CheckDevAuto" Visible="True" />
<asp:CheckBox Text="" runat="server" ID="CheckDevAuto" Visible="True" AutoPostBack="true" OnCheckedChanged="CheckDevAuto_CheckedChanged" />
</div>
</div>
</div>
@@ -6479,11 +6479,11 @@
});
//Cancelar Compra
<%-- //Cancelar Compra
function ShowDivCancelarCompra() {
$('#<%= TxtFechaCancelacion.ClientID%>').val($get("TxtFecha").value);
$('#DivCancelarCompra').modal();
}
}--%>
function HideDivCancelarCompra() {
$('#DivCancelarCompra').modal('hide');
}

View File

@@ -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

View File

@@ -929,8 +929,8 @@
</div>
<div class="actions">
<div class="btn-group">
<asp:HyperLink ID="ImgAddObs" CssClass="caption-subject bold font-green" data-toggle="modal" data-target="#ModalBitacora" runat="server" Text=" <i class='fa fa-commenting font-green' ></i><span class='caption-subject bold'>Agregar</span>" Style="font-weight: 700 !important;cursor: pointer;" ToolTip="Observaciones"></asp:HyperLink><br />
<asp:HyperLink ID="HlEvento" CssClass="thickbox caption-subject bold font-green" runat="server" Text=" <i class='fa fa-calendar-plus-o font-green' ></i>Agendar" Visible="false" Style="font-weight: 700 !important;cursor: pointer;" ToolTip="Agendar"></asp:HyperLink>
<asp:HyperLink Visible="false" ID="ImgAddObs" CssClass="caption-subject bold font-green" data-toggle="modal" data-target="#ModalBitacora" runat="server" Text=" <i class='fa fa-commenting font-green' ></i><span class='caption-subject bold'>Agregar</span>" Style="font-weight: 700 !important;cursor: pointer;" ToolTip="Observaciones"></asp:HyperLink><br />
<asp:HyperLink ID="HlEvento" CssClass="thickbox caption-subject bold font-green" runat="server" Text=" <i class='fa fa-calendar-plus-o font-green' ></i>Agendar" Visible="false" Style="font-weight: 700 !important;cursor: pointer;" ToolTip="Agendar"></asp:HyperLink>
<br /><asp:Literal ID="LtlTareaNueva" runat="server"></asp:Literal>
<UserControl:TareaNueva runat="server" ID="TareaNueva" />
<script>

View File

@@ -417,7 +417,9 @@ Partial Class Inventarios_EntradasSalidas
CargaDatos(Request("CveMovimiento").ToString.ToEntero)
'CargaGvPaqueteria()
ImgAddObs.Visible = True
LtlTareaNueva.Text = String.Format("<a class=""caption-subject bold font-green"" onclick=""OpenModalNewTareaUserControl(1,-1,{{CveVenta:{0}}});""> <i class=""fa fa-plus""></i> Tarea</a>", CveMovimiento)
LtlTareaNueva.Visible = True
HlEvento.Visible = True
HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveMovimiento=" & CveMovimiento & "&TB_iframe=true&height=370&width=600;"
Else

View File

@@ -354,10 +354,10 @@ Partial Class Inventarios_InventarioFisicoDetalle
CveProducto = dr("CvePS").ToString.ToEntero
CveUnidadMedida = dr("CveUnidadMedida").ToString.ToEntero
'Dim AplicaSeccion As Boolean = dr("AplicaSeccion") = "1"
Dim AplicaCaducidad As Boolean = dr("AplicaCaducidad").ToString = "1"
Dim AplicaLote As Boolean = dr("AplicaLote").ToString = "1"
Dim AplicaSerie As Boolean = dr("AplicaSerie").ToString = "1"
Dim AplicaSeccion As Boolean = dr("AplicaSeccion").ToString = "1"
Dim AplicaCaducidad As Boolean = Boolean.Parse(dr("AplicaCaducidad").ToString)
Dim AplicaLote As Boolean = Boolean.Parse(dr("AplicaLote").ToString)
Dim AplicaSerie As Boolean = Boolean.Parse(dr("AplicaSerie").ToString)
Dim AplicaSeccion As Boolean = Boolean.Parse(dr("AplicaSeccion").ToString)
'divSeccionAlmacen.Visible = AplicaSeccion
divLote.Visible = AplicaLote