-registrar prepólizas de virtuales
This commit is contained in:
@@ -2089,7 +2089,7 @@ Partial Class Inventarios_EntradasSalidas
|
||||
|
||||
Dim RetornoVirtual As MMovimientoVirtual = Nothing
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
RetornoVirtual = GenerarMovimientoVirtual(CveMovimiento, ObjInventario)
|
||||
RetornoVirtual = GenerarMovimientoVirtual(CveMovimiento, ObjInventario, ObjConta)
|
||||
End If
|
||||
|
||||
If RetornoVirtual IsNot Nothing Then
|
||||
@@ -2968,7 +2968,7 @@ Partial Class Inventarios_EntradasSalidas
|
||||
|
||||
#Region " CONTABILIZAR "
|
||||
|
||||
Public Function ContabilizaMovimientoAlmacen(ByRef ObjConta As ClsContabilidad, Fecha As Date, Concepto As String, Modulo As String, CveMovimientoSalida As Integer, CveMovimientoEntrada As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer, Contabilizable As Boolean) As Integer
|
||||
Public Function ContabilizaMovimientoAlmacen(ByRef ObjConta As ClsContabilidad, Fecha As Date, Concepto As String, Modulo As String, CveMovimientoSalida As Integer, CveMovimientoEntrada As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer, Contabilizable As Boolean, Optional dttCostos As DataTable = Nothing, Optional CveSubProyecto As Integer = -1) As Integer
|
||||
Dim Retorno As Integer = -1
|
||||
Dim ErrorMovInv As Boolean = False
|
||||
|
||||
@@ -2977,9 +2977,22 @@ Partial Class Inventarios_EntradasSalidas
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, Importe, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then
|
||||
ErrorMovInv = True
|
||||
If CveMovimientoEntrada > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, Importe, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
End If
|
||||
If dttCostos IsNot Nothing Then
|
||||
For Each RowInv As DataRow In dttCostos.Rows
|
||||
Dim ValorInventario As Decimal = dttCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorInventario, ValorInventario, 69, Concepto, Concepto, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=CveSubProyecto, Contabilizable:=Contabilizable) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
If Not ErrorMovInv Then Retorno = CvePrePoliza
|
||||
|
||||
@@ -4634,11 +4647,11 @@ Partial Class Inventarios_EntradasSalidas
|
||||
|
||||
Dim RetornoVirtual As MMovimientoVirtual = Nothing
|
||||
If Not ErrorMovInv AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
If CveMovimientoSalida > 0 Then RetornoVirtual = GenerarMovimientoVirtual(CveMovimientoSalida, ObjInventario)
|
||||
If CveMovimientoSalida > 0 Then RetornoVirtual = GenerarMovimientoVirtual(CveMovimientoSalida, ObjInventario, ObjConta)
|
||||
|
||||
If RetornoVirtual IsNot Nothing Then ErrorMovInv = RetornoVirtual.TieneError
|
||||
|
||||
If CveMovimientoEntrada > 0 AndAlso Not ErrorMovInv Then RetornoVirtual = GenerarMovimientoVirtual(CveMovimientoEntrada, ObjInventario)
|
||||
If CveMovimientoEntrada > 0 AndAlso Not ErrorMovInv Then RetornoVirtual = GenerarMovimientoVirtual(CveMovimientoEntrada, ObjInventario, ObjConta)
|
||||
|
||||
If RetornoVirtual IsNot Nothing Then ErrorMovInv = RetornoVirtual.TieneError
|
||||
End If
|
||||
@@ -5421,8 +5434,8 @@ Partial Class Inventarios_EntradasSalidas
|
||||
Protected Sub LnkGenerarVirtual_Click(sender As Object, e As EventArgs)
|
||||
If CveMovimiento > 0 Then
|
||||
Dim ObjInventario As New ClsInventarios
|
||||
ObjInventario.IniciaTransacSQL()
|
||||
Dim Retorno As MMovimientoVirtual = GenerarMovimientoVirtual(Me.CveMovimiento, ObjInventario)
|
||||
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
|
||||
Dim Retorno As MMovimientoVirtual = GenerarMovimientoVirtual(Me.CveMovimiento, ObjInventario, ObjConta)
|
||||
|
||||
If Retorno.TieneError Then
|
||||
ObjInventario.RollBack()
|
||||
@@ -5440,7 +5453,7 @@ Partial Class Inventarios_EntradasSalidas
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function GenerarMovimientoVirtual(CveMovimiento As Integer, ByRef ObjInventario As ClsInventarios) As MMovimientoVirtual
|
||||
Private Function GenerarMovimientoVirtual(CveMovimiento As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad) As MMovimientoVirtual
|
||||
Dim ErrorMovInv As Boolean = False
|
||||
|
||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||
@@ -5449,14 +5462,20 @@ Partial Class Inventarios_EntradasSalidas
|
||||
|
||||
Dim tCveAlmacen As Integer = -1
|
||||
Dim tOrigen As Integer = -1
|
||||
Dim tCveSubProyecto As Integer = -1
|
||||
|
||||
Try
|
||||
If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
tCveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero()
|
||||
tOrigen = ObjInventario.DtResultados.FiltroPrimeroValor("Origen").ToEntero()
|
||||
End If
|
||||
Dim drAlmacenVirtual As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimero("")
|
||||
Dim CveAlmacenVirtual As Integer
|
||||
If drAlmacenVirtual IsNot Nothing Then
|
||||
CveAlmacenVirtual = drAlmacenVirtual("CveAlmacenVirtual").ToString.ToEntero
|
||||
tCveSubProyecto = drAlmacenVirtual("CveSubProyecto").ToString.ToEntero
|
||||
End If
|
||||
|
||||
Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero()
|
||||
|
||||
'VERIFICA SI TIENE ALMACEN VIRTUAL
|
||||
If CveAlmacenVirtual > 0 Then
|
||||
@@ -5482,6 +5501,17 @@ Partial Class Inventarios_EntradasSalidas
|
||||
Next
|
||||
End If
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
Dim dttCosto As DataTable = Nothing
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtual, UsuarioActual.CveEmpresa) Then
|
||||
dttCosto = ObjInventario.DtResultados
|
||||
End If
|
||||
|
||||
If ContabilizaMovimientoAlmacen(ObjConta:=ObjConta, TxtFecha.Text.Replace(",", "").ToDate, "Virtual", "ES/GV", CveMovimientoVirtual, -1, DtPSVirtual.SUM("TotalCargo"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, True, dttCosto, tCveSubProyecto) > 0 Then
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorMovInv = True
|
||||
@@ -5506,55 +5536,24 @@ Partial Class Inventarios_EntradasSalidas
|
||||
|
||||
Private Function CreaObjetosVenta() As Modelos.Factura
|
||||
Dim ObjFactura As New Modelos.Factura
|
||||
ObjFactura.Version = "3.3"
|
||||
ObjFactura.CveUsuario = UsuarioActual.CveUsuario
|
||||
ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
|
||||
ObjFactura.TipoCambio = 0
|
||||
ObjFactura.ConvertirPesos = False
|
||||
ObjFactura.TipoCambio = 0
|
||||
ObjFactura.CveMoneda = 1
|
||||
ObjFactura.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {ObjFactura.CveMoneda} ")
|
||||
ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", "CveMoneda = 1")
|
||||
ObjFactura.MonedaAbreviatura = GlobalDTMonedas.FiltroPrimeroValor("Abreviatura", $"CveMoneda = {ObjFactura.CveMoneda} ")
|
||||
ObjFactura.TipoDocto = "Tra"
|
||||
ObjFactura.RefDocto = ""
|
||||
ObjFactura.Folio = Folio.ToEntero
|
||||
ObjFactura.Serie = "Tra"
|
||||
'ObjFactura.CveMesa = -1
|
||||
ObjFactura.Fecha = NowADS()
|
||||
ObjFactura.CvePrePoliza = -1
|
||||
ObjFactura.FechaPago = NowADS()
|
||||
ObjFactura.MotivoDescuento = ""
|
||||
ObjFactura.Observaciones = ""
|
||||
ObjFactura.FechaEjecucion = NowADS()
|
||||
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
||||
ObjFactura.CveCondicionEntrega = -1
|
||||
ObjFactura.CondicionEntrega = ""
|
||||
ObjFactura.NumeroCuenta = ""
|
||||
ObjFactura.CondicionesPago = 0
|
||||
ObjFactura.FormaPago = 0
|
||||
ObjFactura.PedidoContrato = ""
|
||||
ObjFactura.OrdenCompra = ""
|
||||
ObjFactura.NumeroContrato = ""
|
||||
ObjFactura.NumeroDescripcionContrato = ""
|
||||
ObjFactura.DescripcionContrato = ""
|
||||
ObjFactura.CveCorte = -1
|
||||
ObjFactura.TipoDocumento = "Traspaso"
|
||||
ObjFactura.Alfa1 = ""
|
||||
ObjFactura.Alfa2 = ""
|
||||
ObjFactura.Alfa3 = ""
|
||||
ObjFactura.Descuento = 0
|
||||
ObjFactura.Amortizacion = 0
|
||||
ObjFactura.CveContrato = 0
|
||||
ObjFactura.CveVendedor = 0
|
||||
ObjFactura.FechaVencimiento = NowADS()
|
||||
ObjFactura.TipoEstatus = 0
|
||||
ObjFactura.Det_OrdenCompra = ""
|
||||
ObjFactura.Inv_CveEstatusEntrega = 0
|
||||
ObjFactura.FormaPago33 = ""
|
||||
ObjFactura.MetodoPago33 = ""
|
||||
ObjFactura.UsoCFDI = ""
|
||||
ObjFactura.CveClienteSucursal = 0
|
||||
|
||||
Dim CveSubProyecto As Integer = -1
|
||||
If GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {DdlAlmacen.SelectedValue}").Rows.Count > 0 Then
|
||||
CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {DdlAlmacen.SelectedValue}").Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||
|
||||
Reference in New Issue
Block a user