" style="display: inline-block; margin-right: -20px; width: 150px;" />
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 779f48636..ad8e35e7f 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -5284,6 +5284,8 @@ Partial Class Ventas
Trsaldo.Visible = True
HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
+ TrMotivoDev.Visible = True
+ lblMotivoDev.Text = DbRowVenta("MotivoDevolucion").ToString()
Case "Ped"
DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido", "Ped"))
CvePedido = CveVenta
@@ -5527,6 +5529,7 @@ Partial Class Ventas
TxtObsFact.Text = DbRowVenta("Observaciones").ToString()
LblUsuario.Text = DbRowVenta("Nombre").ToString().SubStringADS(30)
LblFechaRegistro.Text = DbRowVenta("FechaIng").ToString().ToDate.ToShortDateString
+
LblSeTimbro.Text = DbRowVenta("SeTimbro").ToString()
LblMail.Text = DbRowVenta("EnvioMail").ToString()
TxtFechaPago.Text = DbRowVenta("FechaVencimiento").ToString()
@@ -8957,7 +8960,7 @@ Partial Class Ventas
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
'VALIDA EXISTENCIA
- If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153}) Then
+ If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153, 190, 192, 197}) Then
'SI ES VENTA NUEVA TOMA EN CUENTA LO DEL TMPDT
If CveVenta <= 0 Then
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
@@ -14008,6 +14011,11 @@ Partial Class Ventas
'CveAlmacenTraspasoDestino
End If
+ Dim CveMotivoDevolucion As Integer = -1
+ If DdlMotivoDevolucion.SelectedValue.ToEntero() > 0 Then
+ CveMotivoDevolucion = DdlMotivoDevolucion.SelectedValue.ToEntero()
+ End If
+
If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC,
factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC,
@@ -14027,7 +14035,7 @@ Partial Class Ventas
FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible,
CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero(), DescripcionVenta:=DescripcionVenta,
CveMedico:=CveMedico, CveProcedimiento:=CveProcedimiento, CveTipoVenta:=CveTipoVentaGuardar, RequiereOS:=ChkRequiereTecnico.Checked, FechaParaSurtir:=factura.FechaParaSurtir,
- Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text) Then
+ Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text, CveMotivoDevolucion:=CveMotivoDevolucion) Then
ErrorList.Add("Ocurrió un error al Generar la Venta. Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else
If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then
@@ -18887,7 +18895,7 @@ Partial Class Ventas
If ValidaExistencia Then
'VALIDA EXISTENCIA
- If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190}) Then
+ If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190, 192, 197}) Then
Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False)
@@ -18899,7 +18907,14 @@ Partial Class Ventas
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=0, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
Else
- Existencia = ObjInv2.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
+
+ Dim CveAlmacenConsulta As Integer = -1
+
+ If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso DivAlmacen.Visible Then
+ CveAlmacenConsulta = ddlAlmacen.SelectedValue.ToEntero()
+ End If
+
+ Existencia = ObjInv2.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlmacenConsulta, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
End If
@@ -18907,7 +18922,19 @@ Partial Class Ventas
If CveVenta <= 0 OrElse Me.EsCreaApartirDe Then
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < (If(CantidadModal > 0, CantidadModal, TxtCantidad.Text.ToDouble)) Then
- Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
+
+ Dim CveAlmacenConsulta As Integer = -1
+ Dim StrAlmacen As New StringBuilder
+
+ If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso DivAlmacen.Visible Then
+ CveAlmacenConsulta = ddlAlmacen.SelectedValue.ToEntero()
+ If CveAlmacenConsulta > 0 Then
+ Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenConsulta).FiltroPrimeroValor("Almacen")
+ StrAlmacen.AppendFormat(" Almacén: {0}", Almacen)
+ End If
+ End If
+
+ Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + "." + StrAlmacen.ToString(), TipoMensaje.MsgAdvertencia)
Return False
End If
Else
@@ -24047,9 +24074,9 @@ Partial Class Ventas
Dim AmortizacionNC As Decimal = 0
'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO
- If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
+ If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("2", "4") Then
For Each gvr As GridViewRow In GVAnticipos.Rows
- If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then
+ If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3, 12) Then
AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal
End If
Next
@@ -37387,6 +37414,22 @@ Partial Class Ventas
End If
If PuedeAplicarDevolucion Then
+
+ If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
+ DivMotivoDevolucion.Visible = True
+
+ Using ObjVenta As New ClsVentas
+ If ObjVenta.GetMotivoDevolucion(-1, 1, UsuarioActual.CveEmpresa) Then
+ DdlMotivoDevolucion.DataSource = ObjVenta.DtResultados.Copy()
+ End If
+ DdlMotivoDevolucion.DataBind()
+ DdlMotivoDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ End Using
+
+ UpDevolucion.Update()
+ End If
+
+
RegistraScript("$('#DivAplicaDevolucion').modal('show');")
End If