Validacion al remisionar autorizacion

This commit is contained in:
2020-01-28 18:59:50 -07:00
parent c2cff3970b
commit a667f61ba4

View File

@@ -6257,7 +6257,7 @@ Partial Class Ventas
End Try
End Sub
Private Sub EmitirImprimir()
Private Sub EmitirImprimir(Optional TipoDoctoViejo As String = "")
DtRemisionesTmpDT = TmpDT.Copy
DtPedidos2TmpDT = TmpDT.Copy
DtCotizacionTmpDT = TmpDT.Copy
@@ -6582,7 +6582,7 @@ Partial Class Ventas
Exit Sub
End If
EmitirImprimirNew()
EmitirImprimirNew(TipoDoctoViejo)
End Sub
#End Region
@@ -6603,7 +6603,7 @@ Partial Class Ventas
UpnTools.Update()
End Sub
Protected Sub EmitirImprimirNew()
Protected Sub EmitirImprimirNew(Optional TipoDoctoViejo As String = "")
If ValidaPagosContado() Then
@@ -6769,6 +6769,8 @@ Partial Class Ventas
EsNCAmortizacion = True
End If
Dim CveVentaAnterior As Integer = Me.CveVenta
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS,
ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion)
@@ -6789,6 +6791,15 @@ Partial Class Ventas
Next
End If
If Not String.IsNullOrEmpty(TipoDoctoViejo) Then
'SI VIENE DE UNA AUTORIZACION
If TipoDoctoViejo = "PA" Then
If Not ObjEventos.AddEventoBitacora(String.Format("Se generó una remisión en Folio: <a href=""/Ventas/Ventas.aspx?CveVenta={0}"" target=""_blank"">{1}</a>", ObjFactura.CveVenta, ObjFactura.SerieFolio), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVentaAnterior) Then
ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.")
End If
End If
End If
'SI ES REFACTURACION
Dim ObjNC As List(Of Object) = Nothing
If ErrorList.Count = 0 Then
@@ -6926,8 +6937,6 @@ Partial Class Ventas
End If
End If
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then
ObjVentas.Commit()
@@ -23584,9 +23593,30 @@ Partial Class Ventas
TxtFechaPago.Text = If(TipoDoctoViejo = "Rem" AndAlso EsDiasCreditoFijo, Now.AddDays(DiasCredito), If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza))).ToShortDateString
TxtFechaEjecucion.Text = Now.ToString
'VALIDAR QUE NO SE HAYA REMISIONADO
If TipoDoctoViejo = "PA" Then
Dim RowVenta As DataRow = Nothing
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
RowVenta = ObjVentas.DtResultados.Rows(0)
End If
ObjVentas.Dispose()
If RowVenta IsNot Nothing Then
Dim CveEstatusAutorizacion As Integer = RowVenta("CveEstatusFactura").ToString().ToEntero()
'SI LA AUTORIZACION ESTA REMISIONADA NO DEBE REMISIONAR DE NUEVO
If CveEstatusAutorizacion = 18 Then
Alert("La autorización ya esta remisionada")
Exit Sub
End If
Else
Alert("No se encontró información de la autorización")
Exit Sub
End If
End If
If FolioFijo = 0 Then CargaFolios() 'RECARGA FOLIOS CON EL NUEVO TIPO DOCTO
EmitirImprimir() 'MANDA A EMITIR - PROCESO VIEJO
EmitirImprimir(TipoDoctoViejo) 'MANDA A EMITIR - PROCESO VIEJO
End If
End Sub