This commit is contained in:
Antonio Gonzalez
2020-05-28 17:18:46 -07:00
9 changed files with 165 additions and 83 deletions

View File

@@ -26,6 +26,9 @@ Public Class ClsBancos
'Atributos de la clase 'Atributos de la clase
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'CONTROL DE LA CONEXION
Private CveConexion As Integer = 0
Private EsTransaccionCompartida As Boolean = False
#End Region #End Region
@@ -50,8 +53,7 @@ Public Class ClsBancos
Public Property FechaIngCancelacion As Date Public Property FechaIngCancelacion As Date
Public Property FechaCancelacion As Date Public Property FechaCancelacion As Date
'CONTROL DE LA CONEXION
Private CveConexion As Integer = 0
#End Region #End Region
#Region " P R O P I E D A D E S - B A N C O S - I E" #Region " P R O P I E D A D E S - B A N C O S - I E"
@@ -189,6 +191,7 @@ Public Class ClsBancos
Else Else
SqlConexion = TransaccionCompartida.Connection SqlConexion = TransaccionCompartida.Connection
SqlTransacc = TransaccionCompartida SqlTransacc = TransaccionCompartida
EsTransaccionCompartida = True
End If End If
SqlCommand = New SqlCommand("", SqlConexion) SqlCommand = New SqlCommand("", SqlConexion)
@@ -209,7 +212,7 @@ Public Class ClsBancos
#Region "Conexiones" #Region "Conexiones"
Private Sub ConexionAdd() Private Sub ConexionAdd()
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try Try
DataAdapter("PA_Sis_RegistrarConexion") DataAdapter("PA_Sis_RegistrarConexion")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters

View File

@@ -22,6 +22,7 @@ Public Class ClsCompras
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'REGISTRAR CONEXIONES ABIERTAS 'REGISTRAR CONEXIONES ABIERTAS
Private CveConexion As Integer = 0 Private CveConexion As Integer = 0
Private EsTransaccionCompartida As Boolean = False
#End Region #End Region
@@ -62,7 +63,8 @@ Public Class ClsCompras
End Try End Try
Else Else
SqlConexion = TransaccionCompartida.Connection SqlConexion = TransaccionCompartida.Connection
SqlTransacc = TransaccionCompartida SqlTransacc = TransaccionCompartida
EsTransaccionCompartida = True
End If End If
SqlAdapter = New SqlDataAdapter("", SqlConexion) SqlAdapter = New SqlDataAdapter("", SqlConexion)
@@ -83,7 +85,7 @@ Public Class ClsCompras
#Region "Conexiones" #Region "Conexiones"
Private Sub ConexionAdd() Private Sub ConexionAdd()
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try Try
DataAdapter("PA_Sis_RegistrarConexion") DataAdapter("PA_Sis_RegistrarConexion")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters

View File

@@ -2944,6 +2944,24 @@ Public Class ClsInventarios
Return Retorno Return Retorno
End Function End Function
Public Function UpdateEstatusAlmacen(CveVentaDetalle As Integer, Valor As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("Vta_UpdateDevolucionVentaDetalle")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVenta
.Add("@Valor", SqlDbType.Int).Value = Valor
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar la devolucion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function LimpiaEntregaDirecta(CveMovimiento As Integer) As Boolean Public Function LimpiaEntregaDirecta(CveMovimiento As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Inv_LimpiaEntregaDirecta") DataAdapter("PA_Inv_LimpiaEntregaDirecta")
@@ -3064,6 +3082,24 @@ Public Class ClsInventarios
Return Retorno Return Retorno
End Function End Function
Public Function GetSaldoVentaDetalle(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentaDetalleSaldo")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener datos de almacen por detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetMovimientosDevoluciones(CveVenta As Integer, CveEmpresa As Integer) As Boolean Public Function GetMovimientosDevoluciones(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentaDetalleAlmacenDevolucion") DataAdapter("PA_Vta_VentaDetalleAlmacenDevolucion")

View File

@@ -3201,12 +3201,12 @@ Namespace Modelos
End If End If
'Factura 'Factura
If Not ObjEventos.AddEventoBitacora($"Sustituye a: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>Folio Factura</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then If Not ObjEventos.AddEventoBitacora($"Remisión facturada: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>Folio Factura</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
'Remision 'Remision
If Not ObjEventos.AddEventoBitacora($"Refacturacion en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then If Not ObjEventos.AddEventoBitacora($"Facturación de remisión en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
@@ -4269,6 +4269,18 @@ Namespace Modelos
Dim ObjE As New ClsOIEventos() Dim ObjE As New ClsOIEventos()
ObjE.AddEventoBitacora(msgBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) ObjE.AddEventoBitacora(msgBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta)
ObjE.Dispose() ObjE.Dispose()
Else
If CveEstatus = 5 Then
Dim ObjE As New ClsOIEventos()
ObjE.AddEventoBitacora("La cancelación de la factura fue aceptada en el SAT", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta)
ObjE.Dispose()
ElseIf CveEstatus = 4 Then
Dim ObjE As New ClsOIEventos()
ObjE.AddEventoBitacora("No se pudo comprobar el estatus de factura ante el SAT, solo sera cancelada en el sistema", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta)
ObjE.Dispose()
End If
End If End If
'SI ES CANCELACION EN PROCESO CANCELA EL PROCESO DE LAS REMISIONES 'SI ES CANCELACION EN PROCESO CANCELA EL PROCESO DE LAS REMISIONES

View File

@@ -60,7 +60,7 @@
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="5%" /> <asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="5%" /> <asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="FechaCaducidad" DataField="FechaCaducidad" ItemStyle-Width="5%" /> <asp:BoundField HeaderText="FechaCaducidad" DataField="FechaCaducidad" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Sección Actual" DataField="AlmacenSeccion" ItemStyle-Width="15%" /> <asp:BoundField HeaderText="Sección Actual" DataField="SeccionAlmacen" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Existencia" DataField="Existencia" DataFormatString="{0:#,###.##}" ItemStyle-Width="5%" /> <asp:BoundField HeaderText="Existencia" DataField="Existencia" DataFormatString="{0:#,###.##}" ItemStyle-Width="5%" />
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <ItemTemplate>
@@ -69,7 +69,7 @@
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Nueva Seccion" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField HeaderText="Nueva Seccion" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <ItemTemplate>
<asp:DropDownList ID="DDlS" runat="server" Width="150px" DataValueField="CveAlmacenSeccion" DataTextField="AlmacenSeccion" class="select2me"></asp:DropDownList> <asp:DropDownList ID="DDlS" runat="server" Width="150px" DataValueField="CveSeccion" DataTextField="Seccion" class="select2me"></asp:DropDownList>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>

View File

@@ -184,28 +184,32 @@ Partial Class Inventarios_AjustesSeccionAlmacen
Dim ErrorArchivo = False Dim ErrorArchivo = False
If Not ErrorArchivo AndAlso DtExcel IsNot Nothing Then If Not ErrorArchivo AndAlso DtExcel IsNot Nothing Then
If Not DtExcel.Columns(0).ColumnName = "Código" Then If Not DtExcel.Columns(0).ColumnName = "Cantidad" Then
Alert("El nombre de la primera columna debe ser 'Código'.Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not DtExcel.Columns(1).ColumnName = "Código" Then
Alert("El nombre de la segunda columna debe ser 'Código'.Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la segunda columna debe ser 'Código'.Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not DtExcel.Columns(1).ColumnName = "Producto/Servicio" Then If Not DtExcel.Columns(2).ColumnName = "Producto/Servicio" Then
Alert("El nombre de la cuarta columna debe ser 'Producto/Servicio'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la tercera columna debe ser 'Producto/Servicio'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not DtExcel.Columns(2).ColumnName = "SeccionAlmacen" Then If Not DtExcel.Columns(3).ColumnName = "SeccionAlmacen" Then
Alert("El nombre de la quinta columna debe ser 'SeccionAlmacen'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la cuarta columna debe ser 'SeccionAlmacen'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not DtExcel.Columns(3).ColumnName = "Serie" Then If Not DtExcel.Columns(4).ColumnName = "Serie" Then
Alert("El nombre de la sexta columna debe ser 'Serie'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la quinta columna debe ser 'Serie'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not DtExcel.Columns(4).ColumnName = "Lote" Then If Not DtExcel.Columns(5).ColumnName = "Lote" Then
Alert("El nombre de la séptima columna debe ser 'Lote'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la sexta columna debe ser 'Lote'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
If Not DtExcel.Columns(5).ColumnName = "FechaCaducidad" Then If Not DtExcel.Columns(6).ColumnName = "FechaCaducidad" Then
Alert("El nombre de la octava columna debe ser 'FechaCaducidad'. Favor de corregirlo", TipoMensaje.MsgError) Alert("El nombre de la séptima columna debe ser 'FechaCaducidad'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
@@ -239,17 +243,21 @@ Partial Class Inventarios_AjustesSeccionAlmacen
For Each RowExcel As DataRow In DtExcel.Rows For Each RowExcel As DataRow In DtExcel.Rows
Dim Codigo As String = RowExcel("Código").ToString.Trim Dim Codigo As String = RowExcel("Código").ToString.Trim()
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, Codigo:=Codigo).Rows(0) Dim PS As String = RowExcel("Producto/Servicio").ToString().Trim()
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, Codigo:=Codigo).FiltroPrimero($"PS='{PS}'")
If DrPS IsNot Nothing Then If DrPS IsNot Nothing Then
If Not ErrorMovInv Then If Not ErrorMovInv Then
Dim CantidadEntrada As Decimal = RowExcel("Cantidad").ToString().ToDecimal()
Dim CvePS As Integer = DrPS("CvePS").ToString().ToEntero() Dim CvePS As Integer = DrPS("CvePS").ToString().ToEntero()
Dim CveUM As Integer = DrPS("CveUM").ToString().ToEntero() Dim CveUM As Integer = DrPS("CveUM").ToString().ToEntero()
Dim ProductoServicio As String = RowExcel("Producto/Servicio").ToString.Trim
Dim SeccionAlmacen As String = RowExcel("SeccionAlmacen").ToString.Trim Dim SeccionAlmacen As String = RowExcel("SeccionAlmacen").ToString.Trim
Dim CveSeccionAlmacen As Integer = dtSecciones.FiltroPrimeroValor("CveSeccion", $"AlmacenSeccion='{SeccionAlmacen}'") Dim CveSeccionAlmacen As Integer = dtSecciones.FiltroPrimeroValor("CveSeccion", $"SeccionAlmacen='{SeccionAlmacen}'")
Dim Serie As String = RowExcel("Serie").ToString() Dim Serie As String = RowExcel("Serie").ToString()
Dim Lote As String = RowExcel("Lote").ToString() Dim Lote As String = RowExcel("Lote").ToString()
@@ -257,47 +265,52 @@ Partial Class Inventarios_AjustesSeccionAlmacen
Dim RowExistencia As DataRow = DtExistenciasSecciones.FiltroPrimero($"CvePS={CvePS}") Dim RowExistencia As DataRow = DtExistenciasSecciones.FiltroPrimero($"CvePS={CvePS}")
Dim CveSeccionAlmacenSalida As Integer = RowExistencia("CveSeccionAlmacen").ToString().ToEntero() If RowExistencia IsNot Nothing Then
Dim CantidadSalida As Decimal = RowExistencia("Existencia").ToString().ToDecimal() Dim CveSeccionAlmacenSalida As Integer = RowExistencia("CveSeccionAlmacen").ToString().ToEntero()
Dim SerieSalida As String = RowExistencia("Serie").ToString() Dim CantidadSalida As Decimal = RowExistencia("Existencia").ToString().ToDecimal()
Dim LoteSalida As String = RowExistencia("Lote").ToString() Dim SerieSalida As String = RowExistencia("Serie").ToString()
Dim FechaCaducidadSalida As Date = IfNull(RowExistencia("FechaCaducidad"), MinFecha).ToString.ToDate Dim LoteSalida As String = RowExistencia("Lote").ToString()
Dim PUSalida As Decimal = RowExistencia("PU").ToString() Dim FechaCaducidadSalida As Date = IfNull(RowExistencia("FechaCaducidad"), MinFecha).ToString.ToDate
Dim PUSalida As Decimal = RowExistencia("PU").ToString()
'GENERA LA SALIDA DE LOS PRODUCTOS QUE VIENEN EN EL EXCEL 'GENERA LA SALIDA DE LOS PRODUCTOS QUE VIENEN EN EL EXCEL
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadSalida, CveUM, CvePS, PUSalida, CveSeccionAlmacen:=CveSeccionAlmacenSalida, Serie:=SerieSalida, Lote:=LoteSalida, FechaCaducidad:=FechaCaducidadSalida, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadSalida, CveUM, CvePS, PUSalida, CveSeccionAlmacen:=CveSeccionAlmacenSalida, Serie:=SerieSalida, Lote:=LoteSalida, FechaCaducidad:=FechaCaducidadSalida, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
ErrorMovInv = True
Exit For
End If
Dim CveMovimientoDetalleSalida As Integer = ObjInventario.CveMovimientoDetalle
ErrorMovInv = CveMovimientoDetalleSalida <= 0
'GENERA LA ENTRADA DE LOS PRODUCTOS QUE SE DIERON ENTRADA
If Not ErrorMovInv Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa, CveMovimientoDetalle:=CveMovimientoDetalleSalida) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
Dim RowEntrada As DataRow = ObjInventario.DtResultados.Rows(0)
Dim CvePSEntrada = RowEntrada("CvePS").ToString().ToEntero()
Dim CantidadEntrada As Decimal = RowEntrada("Cantidad").ToString().ToDecimal()
Dim PUEntrada As Decimal = RowEntrada("PUOriginal").ToString().ToDecimal()
Dim CveUMEntrada As Integer = RowEntrada("CveUM").ToString().ToEntero()
Dim CostoIndirecto As Decimal = RowEntrada("CostoIndirecto").ToString().ToDecimal()
'ACTUALIZAMOS EL PS, PARA QUE TENGA EL APLICA SECCION
ErrorMovInv = Not ObjPS.UpdateAplicaSeccionAlmacen(CvePS, UsuarioActual.CveEmpresa, True)
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, CantidadEntrada, CveUMEntrada, CvePSEntrada, PUEntrada, -1, CostoIndirecto:=CostoIndirecto, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
ErrorMovInv = True
Exit For
End If
Else
ErrorMovInv = True ErrorMovInv = True
Exit For
End If End If
Dim CveMovimientoDetalleSalida As Integer = ObjInventario.CveMovimientoDetalle
ErrorMovInv = CveMovimientoDetalleSalida <= 0
'GENERA LA ENTRADA DE LOS PRODUCTOS QUE SE DIERON ENTRADA
If Not ErrorMovInv Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa, CveMovimientoDetalle:=CveMovimientoDetalleSalida) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
Dim RowEntrada As DataRow = ObjInventario.DtResultados.Rows(0)
Dim CvePSEntrada = RowEntrada("CvePS").ToString().ToEntero()
Dim PUEntrada As Decimal = RowEntrada("PUOriginal").ToString().ToDecimal()
Dim CveUMEntrada As Integer = RowEntrada("CveUM").ToString().ToEntero()
Dim CostoIndirecto As Decimal = RowEntrada("CostoIndirecto").ToString().ToDecimal()
'ACTUALIZAMOS EL PS, PARA QUE TENGA EL APLICA SECCION
ErrorMovInv = Not ObjPS.UpdateAplicaSeccionAlmacen(CvePS, UsuarioActual.CveEmpresa, True)
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, CantidadEntrada, CveUMEntrada, CvePSEntrada, PUEntrada, -1, CostoIndirecto:=CostoIndirecto, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
ErrorMovInv = True
Exit For
End If
Else
ErrorMovInv = True
End If
End If
Else
ErrorMovInv = True
RowNoEncontrados.AppendFormat("{0},", Codigo)
End If End If
End If End If
Else Else
ErrorMovInv = True ErrorMovInv = True

View File

@@ -1980,7 +1980,7 @@ Partial Class Inventarios_EntregaAlmacen
End If End If
For Each Dr As DataRow In ObjInventario.DtResultados.Rows For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1), EsInterno:=EsInterno) Then
ErrorMovInv = True ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.")
Exit For Exit For

View File

@@ -5728,6 +5728,8 @@ Partial Class Ventas
End If End If
If UsuarioActual.TienePermisoProceso(68) Then e.Row.FCTextBox("TxtPrecio").Enabled = False
'Si es una devolucion 'Si es una devolucion
If NuevaFactura = 0 Then If NuevaFactura = 0 Then
e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
@@ -7010,28 +7012,36 @@ Partial Class Ventas
Dim ObjNC As List(Of Object) = Nothing Dim ObjNC As List(Of Object) = Nothing
If ErrorList.Count = 0 Then If ErrorList.Count = 0 Then
If NuevaFactura = 1 Then If NuevaFactura = 1 Then
'Si directamente como cancelada sin aceptación, debe de generar la cancelacion aquí 'SI YA ESTA MARCADA LA VENTA ANTERIOR
'If Me.CveEstatusRefacturacion = 0 Then ' cuando es refacturación sin aceptación debe de cancelar y reducir saldo If DevolucionAlmacenNC = 2 Then
' ObjNC = generaNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, ObjEventos) If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
' If ObjNC Is Nothing Then
' ErrorList.Add("No se pudo Cancelar la Factura")
' End If
'End If
'Esquema viejo, evitamos que aparezca por surtir
If ErrorList.Count = 0 Then
'MARCAR VENTA ANTERIOR
If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
End If End If
'MARCAR VENTA ANTERIOR
If VentaSaldoAlmacenNC <> 0 OrElse DevolucionAlmacenNC = 2 Then
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
End If
End If
End If End If
'MARCAR VENTA ANTERIOR
If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
End If
'MARCA LO PENDIENTE A NIVEL DETALLE
Dim DtMovDetalles As DataTable = Nothing
If ObjInventario.GetSaldoVentaDetalle(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then
DtMovDetalles = ObjInventario.DtResultados.Copy()
End If
If DtMovDetalles IsNot Nothing Then
For Each Row As DataRow In DtMovDetalles.Rows
Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToEntero()
If SaldoAlmacen < 0 Then
ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalle").ToString().ToEntero(), 1)
ElseIf SaldoAlmacen = 0 Then
ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalle").ToString().ToEntero(), 0)
End If
Next
End If
DtMovDetalles.Dispose()
End If End If
End If End If
@@ -11117,12 +11127,12 @@ Partial Class Ventas
End If End If
'Factura 'Factura
If Not ObjEventos.AddEventoBitacora($"Sustituye a: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>Folio Factura</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then If Not ObjEventos.AddEventoBitacora($"Remisión facturada : <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
'Remision 'Remision
If Not ObjEventos.AddEventoBitacora($"Refacturacion en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then If Not ObjEventos.AddEventoBitacora($"Facturación de remisión en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
Next Next
@@ -13727,6 +13737,8 @@ Partial Class Ventas
TxtPrecio.Enabled = True TxtPrecio.Enabled = True
End If End If
If UsuarioActual.TienePermisoProceso(68) Then TxtPrecio.Enabled = False
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then
DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString()) DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString())
CambiaMoneda() CambiaMoneda()

View File

@@ -60,6 +60,10 @@