Validacion de amortizaciones,quemar remisiones,eliminar usados en PV,bitacora en ventas
This commit is contained in:
@@ -3858,6 +3858,13 @@ Namespace Modelos
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
If ObjFactura.TipoDocto = "Ant" AndAlso ObjFactura.SaldoAmortizado > 0 Then
|
||||
Retorno.Mensaje = "La factura no se puede cancelar debido a que esta amortizada."
|
||||
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
|
||||
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
'SI LA REMISION ESTA FACTURADA NO SE PUEDE CANCELAR
|
||||
If ObjFactura.TipoDocto = "Rem" Then
|
||||
Dim ObjV As New ClsVentas
|
||||
@@ -4283,11 +4290,6 @@ Namespace Modelos
|
||||
End If
|
||||
End If
|
||||
|
||||
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
|
||||
If Not GeneraMovimientosVirtuales(CveVenta, ObjInventario) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
|
||||
End If
|
||||
Else
|
||||
'UTILIZA LA DEVOLUCION YA REALIZADA
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
@@ -4298,6 +4300,12 @@ Namespace Modelos
|
||||
End If
|
||||
End If
|
||||
|
||||
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
|
||||
If Not GeneraMovimientosVirtuales(CveVenta, ObjInventario) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
|
||||
End If
|
||||
|
||||
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
||||
If Not ErrorCancelar AndAlso RevivirRemisiones Then
|
||||
If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then
|
||||
@@ -5057,6 +5065,8 @@ Namespace Modelos
|
||||
Public Property SaldoVentaDevolucion As Decimal
|
||||
Public Property Saldo As Decimal
|
||||
Public Property SaldoAlmacen As Decimal
|
||||
Public Property SaldoAnticipo As Decimal
|
||||
Public Property SaldoAmortizado As Decimal
|
||||
Public Property CvePAC As Integer
|
||||
Public Property CveAnticipo As Integer
|
||||
Public Property RemisionesLista As List(Of Integer)
|
||||
|
||||
@@ -81,23 +81,22 @@ Partial Class Inicio
|
||||
If UsuarioActual.CveRol = 1 Then
|
||||
divInd.Visible = True
|
||||
CargaSubProyectos()
|
||||
End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(271) Then MuestraVentasPUE()
|
||||
End If
|
||||
|
||||
'Ventas no timbradas por centro de costo
|
||||
If UsuarioActual.TienePermisoProceso(208) Then MuestraNoTimbradasCentroCosto()
|
||||
|
||||
'Reporte facaturas pendientes por autorizar Oscar 2016-07-06
|
||||
If UsuarioActual.TienePermisoProceso(158) Then
|
||||
RegistraScript("$( document ).ready(function() { AbrirVentana('/Compras/PopUpFacturasPendientesAutorizar.aspx');});", "repFacturas")
|
||||
End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(271) Then MuestraVentasPUE()
|
||||
If UsuarioActual.TienePermisoProceso(270) Then MuestraComprasPUE()
|
||||
|
||||
Dim EsDEV = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString.Contains("Desarrollo2017")
|
||||
Dim EsDEV = Not UsuarioActual.Empresa.FacturaProduccion
|
||||
If Not EsDEV Then
|
||||
If UsuarioActual.CveUsuario.Contiene(93, 1425, 2, 1606, 1472, 100) Then MuestraInconsistencias() '100
|
||||
End If
|
||||
|
||||
'Ventas no timbradas por centro de costo
|
||||
If UsuarioActual.TienePermisoProceso(208) Then MuestraNoTimbradasCentroCosto()
|
||||
|
||||
|
||||
'Reporte facaturas pendientes por autorizar Oscar 2016-07-06
|
||||
If UsuarioActual.TienePermisoProceso(158) Then
|
||||
RegistraScript("$( document ).ready(function() { AbrirVentana('/Compras/PopUpFacturasPendientesAutorizar.aspx');});", "repFacturas")
|
||||
If UsuarioActual.CveUsuario.Contiene(93, 1425, 2, 1606, 1472, 100) Then MuestraInconsistencias() '100
|
||||
End If
|
||||
|
||||
'MUESTRA CALENDARIO SOLO ROL ADMINISTRADOR-AD
|
||||
|
||||
@@ -2261,10 +2261,38 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
End If
|
||||
|
||||
'QUEMAR REMISIONES
|
||||
If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then
|
||||
Dim DtDevRem As New DataTable
|
||||
|
||||
'CARGA REMISIONES DE LA VENTA DEVUELTA
|
||||
If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then
|
||||
DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen = 0")
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
If DtDevRem.Rows.Count > 0 Then
|
||||
For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem"}).Rows
|
||||
If Not ObjInventario.ActualizarEsDevolucionVenta(DrMovtos("CveRem").ToString.ToEntero, 2) Then
|
||||
TextoError = "Ocurrió un error al hacer la devolución hacia la remision. Por favor vuelva a intentar."
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
TextoError = "Ocurrió un error al hacer la devolucion a remisión. Por favor vuelva a intentar."
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
|
||||
If Not ErrorMovInv And EsDevolucionVenta = 1 Then
|
||||
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVentaSurtir) Then
|
||||
TextoError = "Ocurrió un error al hacer la devolucion. Por favor vuelva a intentar."
|
||||
TextoError = "Ocurrió un error al hacer la devolución. Por favor vuelva a intentar."
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -1988,8 +1988,6 @@ Partial Class PV
|
||||
CalculaTotalesVenta()
|
||||
|
||||
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
'JJMQ 20160506: Se agrego para la validacion de pago de contado.
|
||||
'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "")
|
||||
|
||||
UpContado.Update()
|
||||
End Sub
|
||||
@@ -3071,7 +3069,7 @@ Partial Class PV
|
||||
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
|
||||
|
||||
TmpDT.Columns.Add("PUOriginal", GetType(Decimal))
|
||||
|
||||
TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer))
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -3264,7 +3262,8 @@ Partial Class PV
|
||||
Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0,
|
||||
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
|
||||
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
|
||||
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False) As Integer
|
||||
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False,
|
||||
Optional ConsecPSPadre As Integer = -1) As Integer
|
||||
|
||||
Dim Retorno As Integer = -1
|
||||
If Not CvePS > 0 Then
|
||||
@@ -3427,6 +3426,10 @@ Partial Class PV
|
||||
Row("CuentaPredial") = CuentaPredial
|
||||
Row("EsCargo") = EsCargo
|
||||
|
||||
If EsCargo AndAlso ConsecPSPadre >= 0 Then
|
||||
Row("ConsecPSPadre") = ConsecPSPadre
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
|
||||
|
||||
@@ -5213,8 +5216,6 @@ Partial Class PV
|
||||
Exit Sub
|
||||
End If
|
||||
Try
|
||||
|
||||
|
||||
If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then
|
||||
Dim CveMarca As Integer = -1
|
||||
|
||||
@@ -5570,177 +5571,148 @@ Partial Class PV
|
||||
CalculaTotalesVenta()
|
||||
End Sub
|
||||
Private Function CalculaUsados(Consec As Integer) As List(Of Integer)
|
||||
|
||||
'If Modalidad = "U" Then
|
||||
' EliminarUsados(Consec)
|
||||
'End If
|
||||
If Modalidad = "U" Then
|
||||
EliminarUsados(Consec)
|
||||
End If
|
||||
|
||||
Dim ListaPScargo As New List(Of Integer)
|
||||
|
||||
Dim DTTamanios As New DataTable
|
||||
Dim ObjAcum As New ClsAcumuladores
|
||||
|
||||
If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
DTTamanios = ObjAcum.DtResultados
|
||||
Dim DTCvePSCostos = ObjAcum.DtResultados.FiltraParametros("", "", {"CvePSCargo"})
|
||||
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
||||
Dim DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
||||
|
||||
|
||||
Dim CveUnidadMedidaPSA As Integer = -1
|
||||
Dim UnidadMedidaPSA As String = "Unidad"
|
||||
Dim CveClacificacionPSA As Integer = -1
|
||||
Dim CveUnidadMedidaPSA As Integer = -1
|
||||
Dim UnidadMedidaPSA As String = "Unidad"
|
||||
Dim CveClacificacionPSA As Integer = -1
|
||||
|
||||
Dim ClacificacionPSA As String = ""
|
||||
Dim ClacificacionPSA As String = ""
|
||||
|
||||
Dim CveSubProyectoPSA As Integer = -1
|
||||
Dim SubProyectoPSA As String = ""
|
||||
Dim CveSubProyectoPSA As Integer = -1
|
||||
Dim SubProyectoPSA As String = ""
|
||||
|
||||
Dim PSPSA As String = ""
|
||||
Dim PSPSA As String = ""
|
||||
|
||||
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
||||
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
||||
|
||||
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
|
||||
DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("Clacificacion", GetType(String))
|
||||
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("PS", GetType(String))
|
||||
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
||||
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
||||
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
|
||||
DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("Clacificacion", GetType(String))
|
||||
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("PS", GetType(String))
|
||||
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
||||
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
||||
DTPSTemp.Columns.Add("ConsecPSPadre", GetType(Integer))
|
||||
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
For Each DrowPartidas As DataRow In TmpDT.Select($"Consec = {Consec}")
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
For Each DrowPartidas As DataRow In TmpDT.Select($"Consec = {Consec}")
|
||||
|
||||
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
|
||||
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
|
||||
|
||||
If CveTamanioTemp > 0 Then
|
||||
If CveTamanioTemp > 0 Then
|
||||
|
||||
Dim DTTamanioTemp As New DataTable
|
||||
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString.ToEntero
|
||||
Dim DTTamanioTemp As New DataTable
|
||||
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString.ToEntero
|
||||
|
||||
|
||||
CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString.ToEntero
|
||||
SubProyectoPSA = DrowPartidas("SubProyecto").ToString
|
||||
|
||||
If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
|
||||
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
|
||||
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
|
||||
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
|
||||
PSPSA = ObjProductosServicios.PS
|
||||
End If
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
|
||||
Else
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
|
||||
End If
|
||||
|
||||
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
|
||||
|
||||
|
||||
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
|
||||
|
||||
For Each dRowUpdate As DataRow In DTPSTemp.Rows
|
||||
|
||||
If (dRowUpdate("CvePS").ToString.ToEntero = CvePsTemp) Then
|
||||
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString.ToDecimal + DrowPartidas("Cantidad").ToString.ToDecimal
|
||||
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString.ToDecimal + ImporteCargo
|
||||
End If
|
||||
Next
|
||||
|
||||
DTPSTemp.AcceptChanges()
|
||||
|
||||
Else
|
||||
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
|
||||
|
||||
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString.ToDecimal
|
||||
dRowNuevo("PU") = Cargo
|
||||
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
|
||||
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
|
||||
dRowNuevo("CveClacificacion") = CveClacificacionPSA
|
||||
dRowNuevo("Clacificacion") = ClacificacionPSA
|
||||
dRowNuevo("CvePS") = CvePsTemp
|
||||
dRowNuevo("PS") = PSPSA
|
||||
|
||||
dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString.ToEntero
|
||||
dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString
|
||||
|
||||
DTPSTemp.Rows.Add(dRowNuevo)
|
||||
DTPSTemp.AcceptChanges()
|
||||
End If
|
||||
CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString.ToEntero
|
||||
SubProyectoPSA = DrowPartidas("SubProyecto").ToString
|
||||
|
||||
If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
|
||||
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
|
||||
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
|
||||
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
|
||||
PSPSA = ObjProductosServicios.PS
|
||||
End If
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
|
||||
Else
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
|
||||
End If
|
||||
|
||||
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
|
||||
|
||||
|
||||
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
|
||||
|
||||
For Each dRowUpdate As DataRow In DTPSTemp.Rows
|
||||
|
||||
If (dRowUpdate("CvePS").ToString.ToEntero = CvePsTemp) Then
|
||||
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString.ToDecimal + DrowPartidas("Cantidad").ToString.ToDecimal
|
||||
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString.ToDecimal + ImporteCargo
|
||||
End If
|
||||
Next
|
||||
|
||||
DTPSTemp.AcceptChanges()
|
||||
|
||||
Else
|
||||
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
|
||||
|
||||
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString.ToDecimal
|
||||
dRowNuevo("PU") = Cargo
|
||||
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
|
||||
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
|
||||
dRowNuevo("CveClacificacion") = CveClacificacionPSA
|
||||
dRowNuevo("Clacificacion") = ClacificacionPSA
|
||||
dRowNuevo("CvePS") = CvePsTemp
|
||||
dRowNuevo("PS") = PSPSA
|
||||
|
||||
dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString.ToEntero
|
||||
dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString
|
||||
dRowNuevo("ConsecPSPadre") = Consec
|
||||
|
||||
DTPSTemp.Rows.Add(dRowNuevo)
|
||||
DTPSTemp.AcceptChanges()
|
||||
End If
|
||||
Next
|
||||
ObjProductosServicios.Dispose()
|
||||
|
||||
Dim ModalidadBack = Modalidad
|
||||
'CAMBIA LA MODALIDAD PARA AGREGAR LOS PS CARGO
|
||||
If Modalidad = "U" Then
|
||||
Modalidad = "A"
|
||||
End If
|
||||
Next
|
||||
ObjProductosServicios.Dispose()
|
||||
|
||||
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
||||
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
|
||||
Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
||||
Dim ModalidadBack = Modalidad
|
||||
'CAMBIA LA MODALIDAD PARA AGREGAR LOS PS CARGO
|
||||
If Modalidad = "U" Then
|
||||
Modalidad = "A"
|
||||
End If
|
||||
|
||||
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
||||
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
|
||||
Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
||||
drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
||||
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
|
||||
drowPsTamaños("SubProyecto").ToString, EsCargo:=True)
|
||||
If Consec > 0 Then
|
||||
ListaPScargo.Add(drowPsTamaños("CvePS").ToString.ToEntero)
|
||||
End If
|
||||
drowPsTamaños("SubProyecto").ToString, EsCargo:=True, ConsecPSPadre:=drowPsTamaños("ConsecPSPadre").ToString.ToEntero)
|
||||
If Consec > 0 Then
|
||||
ListaPScargo.Add(drowPsTamaños("CvePS").ToString.ToEntero)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
|
||||
Modalidad = ModalidadBack
|
||||
End If
|
||||
ObjAcum.Dispose()
|
||||
Modalidad = ModalidadBack
|
||||
|
||||
Return ListaPScargo
|
||||
End Function
|
||||
Private Sub EliminarUsados(Consec As Integer)
|
||||
Dim DTTamanios As New DataTable
|
||||
|
||||
Dim ObjAcum As New ClsAcumuladores
|
||||
'ELIMINAR EL USADO EXTRAS
|
||||
For Each drow As DataRow In TmpDT.Select($"ConsecPSPadre ={Consec}")
|
||||
drow.Delete()
|
||||
Next
|
||||
|
||||
If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
DTTamanios = ObjAcum.DtResultados
|
||||
Dim DTCvePSCostos = ObjAcum.DtResultados.FiltraParametros("", "", {"CvePSCargo"})
|
||||
|
||||
If Not TmpDT.Columns.Contains("Eliminar") Then
|
||||
TmpDT.Columns.Add("Eliminar", GetType(Integer))
|
||||
End If
|
||||
|
||||
For Each drow As DataRow In TmpDT.FiltraParametros($"Consec ={Consec}").Rows
|
||||
For Each drow2 As DataRow In DTCvePSCostos.Rows
|
||||
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
|
||||
drow("Eliminar") = 1
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
'ELIMINAR LOS USADOS QUE SE MANDAN A RECEPCION
|
||||
For Each drow As DataRow In TmpDT.Select($"Consec ={Consec}")
|
||||
For Each RowRecepcionUsados As DataRow In TmpDTRecepcionUsados.Rows
|
||||
If (RowRecepcionUsados("CvePSRelacionado").ToString() = drow("CvePS").ToString()) Then
|
||||
RowRecepcionUsados.Delete()
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim TmpDTView As New DataView(TmpDT)
|
||||
TmpDTView.RowFilter = "Eliminar = 1"
|
||||
|
||||
For Each dRowEliminar As DataRowView In TmpDTView
|
||||
For Each RowRecepcionUsados As DataRow In TmpDTRecepcionUsados.Rows
|
||||
If (RowRecepcionUsados("CvePS").ToString() = dRowEliminar("CvePS").ToString()) Then
|
||||
RowRecepcionUsados.Delete()
|
||||
End If
|
||||
Next
|
||||
dRowEliminar.Delete()
|
||||
Next
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
TmpDTRecepcionUsados.AcceptChanges()
|
||||
|
||||
End If
|
||||
ObjAcum.Dispose()
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
TmpDTRecepcionUsados.AcceptChanges()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
@@ -4292,7 +4292,7 @@ Partial Class Ventas
|
||||
Retorno = True
|
||||
|
||||
Else
|
||||
CveVenta = -1
|
||||
ViewState("CveVenta") = -1
|
||||
Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
@@ -9121,7 +9121,12 @@ Partial Class Ventas
|
||||
'Si es devolucion se agregan a la tabla de Vta_VentasDetalleDevolucion
|
||||
If factura.AplicaDevolucion Then
|
||||
If Not ObjVentas.AddVentaDetalleDevolucion(Row("CveVentaDetalle").ToString.ToEntero, ObjVentas.CveVentaDetalle, Row("Cantidad").ToString.ToDouble) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolucion.")
|
||||
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
|
||||
End If
|
||||
If ErrorList.Count = 0 Then
|
||||
If Not ObjEventos.AddEventoBitacora(String.Format("Se aplicó una devolución en Folio: <a href=""/Ventas/Ventas.aspx?CveVenta={0}"" target=""_blank"">{1}</a>", factura.CveVenta, factura.SerieFolio), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVentaDevolucion) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar la bitacora de devolución.")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -23173,6 +23178,8 @@ Partial Class Ventas
|
||||
|
||||
'CUANDO ES CREAR APARTIR DE SE LIMPIAN FUNCIONALIDADES DE DOCUMENTOS YA REGISTRADOS
|
||||
BtnGenerarRemision.Visible = False
|
||||
BtnEditarRemision.Visible = False
|
||||
BtnPermisoEditarRemision.Visible = False
|
||||
BtnPermisoEditarCotizacion.Visible = False
|
||||
BtnEditarCotizacion.Visible = False
|
||||
BtnGenerarOS.Visible = False
|
||||
@@ -23480,154 +23487,136 @@ Partial Class Ventas
|
||||
|
||||
|
||||
Private Sub CalculaUsados()
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then
|
||||
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
||||
|
||||
Dim DTCvePSCostos As DataTable
|
||||
DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
||||
|
||||
If Not TmpDT.Columns.Contains("Eliminar") Then
|
||||
TmpDT.Columns.Add("Eliminar", GetType(Integer))
|
||||
End If
|
||||
|
||||
For Each drow As DataRow In TmpDT.Rows
|
||||
For Each drow2 As DataRow In DTCvePSCostos.Rows
|
||||
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
|
||||
drow("Eliminar") = 1
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim TmpDTView As New DataView(TmpDT)
|
||||
TmpDTView.RowFilter = "Eliminar = 1"
|
||||
|
||||
For Each dRowEliminar As DataRowView In TmpDTView
|
||||
dRowEliminar.Delete()
|
||||
Next
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
If ViewState("CargoUsado").ToString = "False" Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim CveUnidadMedidaPSA As Integer = -1
|
||||
Dim UnidadMedidaPSA As String = "Unidad"
|
||||
Dim CveClacificacionPSA As Integer = -1
|
||||
|
||||
Dim ClacificacionPSA As String = ""
|
||||
|
||||
Dim CveSubProyectoPSA As Integer = -1
|
||||
Dim SubProyectoPSA As String = ""
|
||||
|
||||
Dim PSPSA As String = ""
|
||||
|
||||
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
||||
'AgregarProductoServicio(1, CveUnidadMedidaPSA, UnidadMedidaPSA, CveClacificacionPSA, ClacificacionPSA, CvePSPSA, PSPSA, "", ImporteCargo, 0, -1, "", CveSubProyectoPSA, SubProyectoPSA)
|
||||
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
|
||||
DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("Clacificacion", GetType(String))
|
||||
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("PS", GetType(String))
|
||||
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
||||
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
||||
|
||||
For Each DrowPartidas As DataRow In TmpDT.Rows
|
||||
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
|
||||
|
||||
If CveTamanioTemp > 0 Then
|
||||
|
||||
Dim DTTamanioTemp As New DataTable
|
||||
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString.ToEntero
|
||||
|
||||
|
||||
'' If ClienteEsDistribuidor Then
|
||||
CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString.ToEntero
|
||||
SubProyectoPSA = DrowPartidas("SubProyecto").ToString
|
||||
|
||||
Dim DTTamanios As DataTable = Nothing
|
||||
' Dim ObjAcum As New ClsAcumuladores
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
|
||||
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
|
||||
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
|
||||
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
|
||||
PSPSA = ObjProductosServicios.PS
|
||||
End If
|
||||
ObjProductosServicios.Dispose()
|
||||
|
||||
'If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
|
||||
Else
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
|
||||
End If
|
||||
|
||||
DTTamanios = GlobalDTAcumTamaños() 'ObjAcum.DtResultados
|
||||
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
|
||||
|
||||
Dim DTCvePSCostos As DataTable
|
||||
DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
||||
|
||||
If Not TmpDT.Columns.Contains("Eliminar") Then
|
||||
TmpDT.Columns.Add("Eliminar", GetType(Integer))
|
||||
End If
|
||||
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
|
||||
|
||||
For Each dRowUpdate As DataRow In DTPSTemp.Rows
|
||||
|
||||
If (dRowUpdate("CvePS").ToString.ToEntero = CvePsTemp) Then
|
||||
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString.ToDecimal + DrowPartidas("Cantidad").ToString.ToDecimal
|
||||
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString.ToDecimal + ImporteCargo
|
||||
End If
|
||||
Next
|
||||
|
||||
DTPSTemp.AcceptChanges()
|
||||
|
||||
Else
|
||||
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
|
||||
|
||||
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString.ToDecimal
|
||||
dRowNuevo("PU") = Cargo
|
||||
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
|
||||
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
|
||||
dRowNuevo("CveClacificacion") = CveClacificacionPSA
|
||||
dRowNuevo("Clacificacion") = ClacificacionPSA
|
||||
dRowNuevo("CvePS") = CvePsTemp
|
||||
dRowNuevo("PS") = PSPSA
|
||||
|
||||
dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString.ToEntero
|
||||
dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString
|
||||
|
||||
DTPSTemp.Rows.Add(dRowNuevo)
|
||||
DTPSTemp.AcceptChanges()
|
||||
End If
|
||||
|
||||
For Each drow As DataRow In TmpDT.Rows
|
||||
For Each drow2 As DataRow In DTCvePSCostos.Rows
|
||||
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
|
||||
drow("Eliminar") = 1
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim TmpDTView As New DataView(TmpDT)
|
||||
TmpDTView.RowFilter = "Eliminar = 1"
|
||||
|
||||
For Each dRowEliminar As DataRowView In TmpDTView
|
||||
dRowEliminar.Delete()
|
||||
|
||||
Next
|
||||
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
If ViewState("CargoUsado").ToString = "False" Then
|
||||
Exit Sub
|
||||
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
||||
Modalidad = "A"
|
||||
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
|
||||
AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
||||
drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
||||
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
|
||||
drowPsTamaños("SubProyecto").ToString)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
|
||||
Dim CveUnidadMedidaPSA As Integer = -1
|
||||
Dim UnidadMedidaPSA As String = "Unidad"
|
||||
Dim CveClacificacionPSA As Integer = -1
|
||||
|
||||
Dim ClacificacionPSA As String = ""
|
||||
|
||||
Dim CveSubProyectoPSA As Integer = -1
|
||||
Dim SubProyectoPSA As String = ""
|
||||
|
||||
Dim PSPSA As String = ""
|
||||
|
||||
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
||||
'AgregarProductoServicio(1, CveUnidadMedidaPSA, UnidadMedidaPSA, CveClacificacionPSA, ClacificacionPSA, CvePSPSA, PSPSA, "", ImporteCargo, 0, -1, "", CveSubProyectoPSA, SubProyectoPSA)
|
||||
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
|
||||
DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("Clacificacion", GetType(String))
|
||||
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("PS", GetType(String))
|
||||
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
||||
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
||||
|
||||
For Each DrowPartidas As DataRow In TmpDT.Rows
|
||||
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
|
||||
|
||||
If CveTamanioTemp > 0 Then
|
||||
|
||||
Dim DTTamanioTemp As New DataTable
|
||||
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString.ToEntero
|
||||
|
||||
|
||||
CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString.ToEntero
|
||||
SubProyectoPSA = DrowPartidas("SubProyecto").ToString
|
||||
|
||||
If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
|
||||
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
|
||||
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
|
||||
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
|
||||
PSPSA = ObjProductosServicios.PS
|
||||
End If
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
|
||||
Else
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
|
||||
End If
|
||||
|
||||
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
|
||||
|
||||
|
||||
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
|
||||
|
||||
For Each dRowUpdate As DataRow In DTPSTemp.Rows
|
||||
|
||||
If (dRowUpdate("CvePS").ToString.ToEntero = CvePsTemp) Then
|
||||
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString.ToDecimal + DrowPartidas("Cantidad").ToString.ToDecimal
|
||||
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString.ToDecimal + ImporteCargo
|
||||
End If
|
||||
Next
|
||||
|
||||
DTPSTemp.AcceptChanges()
|
||||
|
||||
Else
|
||||
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
|
||||
|
||||
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString.ToDecimal
|
||||
dRowNuevo("PU") = Cargo
|
||||
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
|
||||
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
|
||||
dRowNuevo("CveClacificacion") = CveClacificacionPSA
|
||||
dRowNuevo("Clacificacion") = ClacificacionPSA
|
||||
dRowNuevo("CvePS") = CvePsTemp
|
||||
dRowNuevo("PS") = PSPSA
|
||||
|
||||
dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString.ToEntero
|
||||
dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString
|
||||
|
||||
DTPSTemp.Rows.Add(dRowNuevo)
|
||||
DTPSTemp.AcceptChanges()
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
||||
Modalidad = "A"
|
||||
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
|
||||
AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
||||
drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
||||
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
|
||||
drowPsTamaños("SubProyecto").ToString)
|
||||
End If
|
||||
Next
|
||||
|
||||
ObjProductosServicios.Dispose()
|
||||
'End If
|
||||
|
||||
' ObjAcum.Dispose()
|
||||
'End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, CveVenta As Integer) As Boolean
|
||||
|
||||
Reference in New Issue
Block a user