This commit is contained in:
2020-05-28 17:16:59 -07:00
31 changed files with 511 additions and 236 deletions

View File

@@ -5728,6 +5728,8 @@ Partial Class Ventas
End If
If UsuarioActual.TienePermisoProceso(68) Then e.Row.FCTextBox("TxtPrecio").Enabled = False
'Si es una devolucion
If NuevaFactura = 0 Then
e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
@@ -5956,15 +5958,17 @@ Partial Class Ventas
If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR
Dim CvePS As Integer = DatarowPS("CvePS").ToString().ToEntero()
Dim CveUM As Integer = DatarowPS("CveUM").ToString().ToEntero()
Dim CveUM As Integer = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero() 'DatarowPS("CveUM").ToString().ToEntero()
Dim CveTipoPS As Integer = DatarowPS("CveTipoPS").ToString().ToEntero()
CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToString().ToDecimal
CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToDecimal
Dim CveUMInicial As Integer = GvPS.Rows(e.RowIndex).DataKey("CveUM").ToEntero
Dim ValidaExistencia As Boolean = True
If (CantidadInventario > 0) OrElse (Cantidad <= CantidadOriginal) Then 'si ya hay algo surtido, que no valide existencia
ValidaExistencia = False
End If
If CveUM <> CveUMInicial Then ValidaExistencia = True
'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS
If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then
@@ -6067,6 +6071,7 @@ Partial Class Ventas
Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia)
MensajeCosto.Clear()
e.Cancel = True
Exit Sub
End If
@@ -6080,6 +6085,7 @@ Partial Class Ventas
MensajeCosto.AppendFormat("El precio indicado es: <b>${0:#,###.00}</b> ({1}% de ganancia) <br/>", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero)
End If
Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia)
MensajeCosto.Clear()
e.Cancel = True
Exit Sub
End If
@@ -6128,6 +6134,7 @@ Partial Class Ventas
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0
DrPS = Nothing
End If
Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento))
@@ -6700,6 +6707,7 @@ Partial Class Ventas
If MensajeCosto.ToString().Length > 1 Then
Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia)
MensajeCosto.Clear()
Exit Sub
End If
@@ -6816,6 +6824,7 @@ Partial Class Ventas
Next
Alert(str.ToString(), TipoMensaje.MsgAdvertencia)
dttsat.Dispose()
str.Clear()
Exit Sub
End If
dttsat.Dispose()
@@ -7425,6 +7434,7 @@ Partial Class Ventas
Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}&Opt=3"";"))
Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga)
MensajeAlert.Clear()
'LIMPIA CONDICIONES DE PAGO - CONTADO
RBLPago.SelectedValue = "1"
@@ -7451,6 +7461,7 @@ Partial Class Ventas
ObjContr.Dispose()
ObjDocCliente.Dispose()
'ObjFolios.Dispose()
ErrorList.Clear
ErrorList = Nothing
MensajeAlert = Nothing
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
@@ -7473,13 +7484,17 @@ Partial Class Ventas
ObjContr.Dispose()
ObjDocCliente.Dispose()
'ObjFolios.Dispose()
ErrorList.Clear()
ErrorList = Nothing
MensajeAlert = Nothing
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
TmpDT = TmpDTError.Copy
End If
ObjFactura = Nothing
Obj2 = Nothing
End If
End If
End Sub
@@ -9481,7 +9496,7 @@ Partial Class Ventas
Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=CveTipoRetencion) Then
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else
If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Then
If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Or CveEstatusRefacturacion = 1 Then
If DtVentasNC IsNot Nothing Then
For Each row As DataRow In DtVentasNC.Rows
If Not row("CveVenta").ToString().ToEntero() = -1 Then
@@ -13722,6 +13737,8 @@ Partial Class Ventas
TxtPrecio.Enabled = True
End If
If UsuarioActual.TienePermisoProceso(68) Then TxtPrecio.Enabled = False
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then
DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString())
CambiaMoneda()
@@ -16739,7 +16756,7 @@ Partial Class Ventas
End If
End If
TextoExistencia.Clear()
Return TieneError
End Function
'Protected Sub LbVerInventario_Click(sender As Object, e As EventArgs) Handles LbVerInventario.Click
@@ -19208,7 +19225,7 @@ Partial Class Ventas
Else
ResultadoMail = 0
End If
sb.Clear()
End If
ObjVentas.Dispose()
End Sub
@@ -19227,7 +19244,7 @@ Partial Class Ventas
End If
LbCancelarDescripcion.Text = SbCondiciones.ToString()
SbCondiciones.Clear()
UpCancelarDocumento.Update()
End Sub
@@ -19284,7 +19301,7 @@ Partial Class Ventas
RegistraScript("$('#ModalCancelarDocumento').modal();")
UpCancelarDocumento.Update()
sb.Clear()
Else
CancelarDocumento()
End If
@@ -20718,7 +20735,7 @@ Partial Class Ventas
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error")
Exit Sub
End If
MensajeAlert.Clear()
Dim MensajeSinExistencias As New StringBuilder
Dim ObjInventarios As New ClsInventarios
@@ -20762,7 +20779,7 @@ Partial Class Ventas
Else
RegistraScript("playsonidito('beep-07.wav')", "Existo")
End If
MensajeSinExistencias.Clear()
End Sub
Protected Sub GvSerie_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvSerie.RowDeleting
@@ -21841,13 +21858,12 @@ Partial Class Ventas
Cuerpo.AppendLine("</tr></table>")
End If
Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString())
Cuerpo.Clear()
Exit Select
End Select
End Sub
Private Sub GuardarBitacora(CveVenta As Integer, RutaAdjunto As String, Obser As String)
Dim ObjEventos As New ClsOIEventos()
@@ -23588,6 +23604,7 @@ Partial Class Ventas
DtCotizacionesPS = ObjClientes.DtResultados
End If
ObjClientes.Dispose()
Cves.Clear()
If Not AgregaPSCotizacion() Then
Alert("Ocurrió un error validar las partidas de las cotizaciones seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
@@ -23962,6 +23979,7 @@ Partial Class Ventas
sb.Remove(sb.Length - 1, 1)
CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1))
sb.Clear()
End Select
Dim CveTipoDocto = DdlTipoComprobante.SelectedValue
@@ -24007,7 +24025,10 @@ Partial Class Ventas
DdlContrato.DataSource = DtContratos.FiltraParametros($"CveContrato = {CveContrato}")
DdlContrato.DataBind()
End If
MensajeRemisiones.Clear()
ObsOC.Clear()
ObsPedido.Clear()
ObsInv.Clear()
End If
End If
@@ -24332,6 +24353,7 @@ Partial Class Ventas
DtPedidos2PS = ObjVentas.DtResultados
End If
ObjVentas.Dispose()
Cves.Clear()
If Not AgregaPSPedido2() Then
Alert("Ocurrió un error validar las partidas de los pedidos seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
@@ -24364,6 +24386,10 @@ Partial Class Ventas
TxtPedidoContrato.Text = If(ObsPedido.ToString().Length > 0, ObsPedido.ToString().Substring(0, ObsPedido.ToString().Length - 2), "")
TxtObsAlmacen.Text = If(ObsInv.ToString().Length > 0, ObsInv.ToString().Substring(0, ObsInv.ToString().Length - 2), "")
MensajePedidos2.Clear()
ObsOC.Clear()
ObsPedido.Clear()
ObsInv.Clear()
UpModalPedidos2.Update()
UpFacturar.Update()
@@ -25402,6 +25428,7 @@ Partial Class Ventas
ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.")
End If
ObjEventos.Dispose()
Msg.Clear()
Else
Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia)
End If