--FIX validacion de estatus de cobranza al editar remision, recargar info al cobrar
This commit is contained in:
@@ -500,82 +500,99 @@ Partial Class Ventas_PVCobranza
|
||||
Dim GvRow As GridViewRow = DirectCast(ImgBtn.BindingContainer, GridViewRow)
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero
|
||||
Dim CondicionesPagoContado As Boolean = GvRow.DataKey("CondicionesPago") = "0"
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
If Not ObjVentas.UpdateAsignaVentaCobranza(CveVenta, 1, UsuarioActual.CveUsuario, -1, "", Now) Then
|
||||
Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero
|
||||
|
||||
Dim RowVenta As DataRow = Nothing
|
||||
|
||||
Using ObjVta As New ClsVentas
|
||||
If ObjVta.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
RowVenta = ObjVta.DtResultados.Copy().Rows(0)
|
||||
End If
|
||||
End Using
|
||||
|
||||
If RowVenta IsNot Nothing Then
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
If Not ObjVentas.UpdateAsignaVentaCobranza(CveVenta, 1, UsuarioActual.CveUsuario, -1, "", Now) Then
|
||||
TieneError = True
|
||||
End If
|
||||
HdnCveVenta.Value = CveVenta.ToString
|
||||
|
||||
Dim Saldo As Decimal = RowVenta("Saldo").ToString().ToDecimal()
|
||||
Dim CveFormaPago33 As String = RowVenta("CveFormaPago33").ToString()
|
||||
|
||||
HdnCveCliente.Value = RowVenta("CveCliente").ToString()
|
||||
TxtImporteContado.Text = Saldo.FormatoNumero
|
||||
HdnTotal.Value = Saldo.ToString()
|
||||
TxtImporteEfectivo.Focus()
|
||||
LtlNombre.Text = RowVenta("AtencionA").ToString()
|
||||
LtlFolio.Text = RowVenta("SerieFolio").ToString()
|
||||
LtlSaldo.Text = Saldo.FormatoNumero
|
||||
LtlMoneda.Text = RowVenta("Moneda").ToString()
|
||||
|
||||
Dim CondicionesPagoContado As Boolean = RowVenta("CondicionesPago").ToString() = "0"
|
||||
Dim CveMoneda As Integer = RowVenta("CveMoneda").ToString().ToEntero()
|
||||
|
||||
HdnMoneda.Value = CveMoneda.ToString()
|
||||
If CveMoneda = 2 Then
|
||||
DivUSD.Visible = True
|
||||
TxtTC.Text = GlobalTipoCambio(Now).ToString()
|
||||
TxtTotalMXN.Text = (TxtImporteContado.Text.ToDecimal() * TxtTC.Text.ToDecimal()).FormatoNumero()
|
||||
End If
|
||||
|
||||
HdnVentaCondicionesPago.Value = RowVenta("CondicionesPago").ToString()
|
||||
HdnPlazoCobranza.Value = GvRow.DataKey("PlazoCobranza")
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197) AndAlso RowVenta("TipoDocto").ToString().Contiene("Rem", "Ant") Then
|
||||
DivAnticipo.Visible = True
|
||||
ImgAntiPend.Visible = True
|
||||
End If
|
||||
|
||||
If CondicionesPagoContado Then
|
||||
'según la forma de pago va a establecer el valor para pago.
|
||||
Select Case CveFormaPago33
|
||||
Case "1"
|
||||
TxtImporteEfectivo.Text = Saldo.FormatoNumero
|
||||
Case "2"
|
||||
TxtImporteCheque.Text = Saldo.FormatoNumero
|
||||
Case "3"
|
||||
TxtImporteTransferencia.Text = Saldo.FormatoNumero
|
||||
Case "4"
|
||||
TxtImporteCredito.Text = Saldo.FormatoNumero
|
||||
Case "18"
|
||||
TxtImporteDebito.Text = Saldo.FormatoNumero
|
||||
Case Else
|
||||
TxtImporteEfectivo.Text = Saldo.FormatoNumero
|
||||
End Select
|
||||
DivContadoBancos.Visible = True
|
||||
BtnPagar.Text = "Pagar"
|
||||
Else
|
||||
DivContadoBancos.Visible = False
|
||||
BtnPagar.Text = "Emitir a crédito"
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
End If
|
||||
HdnCveVenta.Value = CveVenta.ToString
|
||||
HdnCveCliente.Value = GvRow.DataKey("CveCliente")
|
||||
TxtImporteContado.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
HdnTotal.Value = GvRow.DataKey("Saldo")
|
||||
TxtImporteEfectivo.Focus()
|
||||
LtlNombre.Text = GvRow.DataKey("AtencionA")
|
||||
LtlFolio.Text = GvRow.DataKey("SerieFolio")
|
||||
LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero
|
||||
LtlMoneda.Text = GvRow.DataKey("Moneda")
|
||||
End Try
|
||||
|
||||
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
|
||||
'carga información para cobranza
|
||||
|
||||
HdnMoneda.Value = CveMoneda.ToString()
|
||||
If CveMoneda = 2 Then
|
||||
DivUSD.Visible = True
|
||||
TxtTC.Text = GlobalTipoCambio(Now).ToString()
|
||||
TxtTotalMXN.Text = (TxtImporteContado.Text.ToDecimal() * TxtTC.Text.ToDecimal()).FormatoNumero()
|
||||
End If
|
||||
|
||||
HdnVentaCondicionesPago.Value = GvRow.DataKey("CondicionesPago")
|
||||
HdnPlazoCobranza.Value = GvRow.DataKey("PlazoCobranza")
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197) AndAlso GvRow.DataKey("TipoDocto").Contiene("Rem", "Ant") Then
|
||||
DivAnticipo.Visible = True
|
||||
ImgAntiPend.Visible = True
|
||||
End If
|
||||
|
||||
If CondicionesPagoContado Then
|
||||
'según la forma de pago va a establecer el valor para pago.
|
||||
Select Case GvRow.DataKey("CveFormaPago33")
|
||||
Case "1"
|
||||
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case "2"
|
||||
TxtImporteCheque.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case "3"
|
||||
TxtImporteTransferencia.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case "4"
|
||||
TxtImporteCredito.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case "18"
|
||||
TxtImporteDebito.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case Else
|
||||
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
End Select
|
||||
DivContadoBancos.Visible = True
|
||||
BtnPagar.Text = "Pagar"
|
||||
If Not TieneError Then
|
||||
ObjVentas.Commit()
|
||||
PnlContado.Visible = True
|
||||
Else
|
||||
DivContadoBancos.Visible = False
|
||||
BtnPagar.Text = "Emitir a crédito"
|
||||
ObjVentas.RollBack()
|
||||
PnlContado.Visible = False
|
||||
Alert("Hubo un error al asignar datos de cobranza", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
End Try
|
||||
|
||||
'carga información para cobranza
|
||||
|
||||
If Not TieneError Then
|
||||
ObjVentas.Commit()
|
||||
PnlContado.Visible = True
|
||||
Else
|
||||
ObjVentas.RollBack()
|
||||
PnlContado.Visible = False
|
||||
Alert("Hubo un error al asignar datos de cobranza", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
'CargaDatos()
|
||||
ObjVentas.Dispose()
|
||||
End If
|
||||
|
||||
|
||||
'CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -24757,6 +24757,19 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'si es de FNC contado. bloquear edición si está pagada o en proceso de cobro
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||
Using ObjVta As New ClsVentas
|
||||
If ObjVta.GetVenta(Me.CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
Dim DbRowVenta As DataRow = ObjVta.DtResultados.FiltroPrimero("")
|
||||
If DbRowVenta IsNot Nothing AndAlso (DbRowVenta("CveCobranzaEstatus").ToString = "1" OrElse DbRowVenta("Saldo").ToString.ToDecimal = 0) Then
|
||||
Alert("No se puede actualizar la información de la remisión porque esta en proceso de cobro. Para aplicar cambios se debera de liberar desde el módulo de 'cobro por caja'.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
Dim OcurrioError As Boolean = False
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
|
||||
Reference in New Issue
Block a user