This commit is contained in:
rakcsle
2022-04-27 20:53:00 -07:00
15 changed files with 821 additions and 706 deletions

View File

@@ -33,7 +33,7 @@ Public Class ClsOC
Public Property CveIEAnticipo As Integer Public Property CveIEAnticipo As Integer
Public Property CveProveedorAnticipo As Integer Public Property CveProveedorAnticipo As Integer
Public Property FolioIEAnticipo As Integer Public Property FolioIEAnticipo As Integer
Public Property ImporteAnticipo As Double Public Property ImporteAnticipo As Decimal
Public Property FolioAdicional As String Public Property FolioAdicional As String
Public Property EntregaDirecta As Boolean Public Property EntregaDirecta As Boolean
@@ -79,16 +79,16 @@ Public Class ClsOC
Public Property RFC As String Public Property RFC As String
Public Property LugarEntrega As String Public Property LugarEntrega As String
Public Property Cancelacion As String Public Property Cancelacion As String
Public Property PorcentajeIVA As Double Public Property PorcentajeIVA As Decimal
Public Property CveCliente As Integer Public Property CveCliente As Integer
Public Property CveVendedor As Integer Public Property CveVendedor As Integer
Public Property PrioridadObservacion As String Public Property PrioridadObservacion As String
Public Property SubTotal As Double Public Property SubTotal As Decimal
Public Property IVA As Double Public Property IVA As Decimal
Public Property RetIVA As Double Public Property RetIVA As Decimal
Public Property RetISR As Double Public Property RetISR As Decimal
Public Property IEPS As Double Public Property IEPS As Decimal
Public Property Total As Double Public Property Total As Decimal
Public Property CvePresupuestoEgreso As Integer Public Property CvePresupuestoEgreso As Integer
Public Property RequiereCotizacion As Boolean Public Property RequiereCotizacion As Boolean
Public Property CveActivoFijo As Integer Public Property CveActivoFijo As Integer
@@ -98,8 +98,8 @@ Public Class ClsOC
Public Property SubProyecto As String Public Property SubProyecto As String
Public Property UsuarioSolicito As String Public Property UsuarioSolicito As String
Public Property UsuarioAutorizo As String Public Property UsuarioAutorizo As String
Public Property Descuento As Double Public Property Descuento As Decimal
Public Property Pendiente As Double Public Property Pendiente As Decimal
Public Property NombreCliente As String Public Property NombreCliente As String
Public Property SucCalle As String Public Property SucCalle As String
Public Property SucNoExt As String Public Property SucNoExt As String
@@ -274,7 +274,7 @@ Public Class ClsOC
Extension = Data.Rows(0)("Extension").ToString Extension = Data.Rows(0)("Extension").ToString
Usuario = Data.Rows(0)("Usuario").ToString Usuario = Data.Rows(0)("Usuario").ToString
Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero
Me.Total = Data.Rows(0)("Total").ToString.ToDouble Me.Total = Data.Rows(0)("Total").ToString.ToDecimal
Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
@@ -416,7 +416,7 @@ Public Class ClsOC
Return Retorno Return Retorno
End Function End Function
Public Function AddCotizacionDetalle(pCveCotizacion As Integer, pCvePS As Integer, pPrecioUnitario As Double, pCantidad As Double, pCveUM As Integer, pCantidadSurtir As Double, pFechaEntrega As String, pObservacion As String, pCveOrdenCompraDetalle As Integer) As Boolean Public Function AddCotizacionDetalle(pCveCotizacion As Integer, pCvePS As Integer, pPrecioUnitario As Decimal, pCantidad As Decimal, pCveUM As Integer, pCantidadSurtir As Decimal, pFechaEntrega As String, pObservacion As String, pCveOrdenCompraDetalle As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OC_CotizacionesDetalleAdd") DataAdapter("PA_OC_CotizacionesDetalleAdd")
@@ -425,9 +425,9 @@ Public Class ClsOC
.Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion
.Add("@CvePS", SqlDbType.Int).Value = pCvePS .Add("@CvePS", SqlDbType.Int).Value = pCvePS
.Add("@PU", SqlDbType.Money).Value = pPrecioUnitario .Add("@PU", SqlDbType.Money).Value = pPrecioUnitario
.Add("@Cantidad", SqlDbType.Float).Value = pCantidad .Add("@Cantidad", SqlDbType.Decimal).Value = pCantidad
.Add("@CveUM", SqlDbType.Int).Value = pCveUM .Add("@CveUM", SqlDbType.Int).Value = pCveUM
.Add("@CantidadSurtir", SqlDbType.Float).Value = pCantidadSurtir .Add("@CantidadSurtir", SqlDbType.Decimal).Value = pCantidadSurtir
.Add("@FechaEntrega", SqlDbType.VarChar).Value = pFechaEntrega .Add("@FechaEntrega", SqlDbType.VarChar).Value = pFechaEntrega
.Add("@Observacion", SqlDbType.VarChar).Value = pObservacion .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion
.Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle
@@ -452,14 +452,14 @@ Public Class ClsOC
Return Retorno Return Retorno
End Function End Function
Public Function UpdateCotizacionDetalle(pCveCotizacionDetalle As Integer, pPrecioUnitario As Double, pCantidadSurtir As Double, pFechaEntrega As String, pObservacion As String) As Boolean Public Function UpdateCotizacionDetalle(pCveCotizacionDetalle As Integer, pPrecioUnitario As Decimal, pCantidadSurtir As Decimal, pFechaEntrega As String, pObservacion As String) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OC_CotizacionesDetalleUpdate") DataAdapter("PA_OC_CotizacionesDetalleUpdate")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@PU", SqlDbType.Money).Value = pPrecioUnitario .Add("@PU", SqlDbType.Money).Value = pPrecioUnitario
.Add("@CantidadSurtir", SqlDbType.Float).Value = pCantidadSurtir .Add("@CantidadSurtir", SqlDbType.Decimal).Value = pCantidadSurtir
.Add("@FechaEntrega", SqlDbType.VarChar).Value = pFechaEntrega .Add("@FechaEntrega", SqlDbType.VarChar).Value = pFechaEntrega
.Add("@Observacion", SqlDbType.VarChar).Value = pObservacion .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion
.Add("@CveCotizacionDetalle", SqlDbType.Int).Value = pCveCotizacionDetalle .Add("@CveCotizacionDetalle", SqlDbType.Int).Value = pCveCotizacionDetalle
@@ -546,107 +546,6 @@ Public Class ClsOC
End Function End Function
#End Region #End Region
'Public Function GetEstatusCompra(ByVal CveEstatusCompra As Integer, ByVal EstatusCompra As String) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_OC_EstatusOrdenCompraGet")
' Try
' SqlAdapter.Fill(Data)
' If Data.Rows.Count = 1 Then
' _CveEstatusCompra = Data.Rows(0)("CveEstatusCompra").ToString().ToEntero()
' _EstatusCompra = Data.Rows(0)("EstatusCompra").ToString()
' _Estatus = Data.Rows(0)("Estatus").ToString = "True"
' _FechaIng = Data.Rows(0)("FechaIng").ToString().ToDate()
' _CveUsuario = Data.Rows(0)("CveUsuario").ToString().ToEntero()
' _NombreUsuario = Data.Rows(0)("Nombre").ToString()
' End If
' Retorno = True
' Catch ex As Exception
' OnError("Ocurrió un error al obtener el Catálogo de Estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
' End Try
' Return Retorno
'End Function
'Public Function AddEstatusCompra(ByVal Descripcion As String, Estatus As Boolean, ByVal CveUsuario As Integer) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_OC_EstatusOrdenCompraAdd")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@EstatusOrdenCompra", SqlDbType.VarChar).Value = Descripcion
' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As SqlException
' If ex.Number = 2627 Then
' Alert("La Clave o Descripción del EstatusCompra ya existe.", TipoMensaje.MsgAdvertencia)
' Else
' OnError("Ocurrió un error al guardar el nuevo estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
' End If
' Catch ex As Exception
' OnError("Ocurrió un error al guardar el nuevo estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
' End Try
' Return Retorno
'End Function
'Public Function UpdateEstatusCompra(ByVal Descripcion As String, Estatus As Boolean, ByVal CveEstatusCompra As Integer, ByVal CveUsuario As Integer) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_OC_EstatusOrdenCompraUpdate")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@EstatusOrdenCompra", SqlDbType.VarChar).Value = Descripcion
' '.Add("@pCveUsuario", SqlDbType.Int).Value = CveUsuario
' .Add("@Estatus", SqlDbType.Bit).Value = Estatus
' .Add("@CveEstatusOrdenCompra", SqlDbType.Int).Value = CveEstatusCompra
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As SqlException
' If ex.Number = 2627 Then
' Alert("La Clave o Descripción del Estatus de Compra ya existe.", TipoMensaje.MsgAdvertencia)
' Else
' OnError("Ocurrió un error al guardar los cambios en el estatus de compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
' End If
' Catch ex As Exception
' OnError("Ocurrió un error al guardar los cambios en el estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
' End Try
' Return Retorno
'End Function
'Public Function RemoveEstatusCompra(ByVal CveEstatusCompra As Integer) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_OC_EstatusOrdenCompraRemove")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@CveEstatusOrdenCompra", SqlDbType.Int).Value = CveEstatusCompra
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As Exception
' OnError("Ocurrió un error al eliminar el estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
' End Try
' Return Retorno
'End Function
#Region "O R D E N E S - D E - C O M P R A S" #Region "O R D E N E S - D E - C O M P R A S"
Public Function GetOC(ObjOrdenCompra As Modelos.OrdenCompra) As Boolean Public Function GetOC(ObjOrdenCompra As Modelos.OrdenCompra) As Boolean
@@ -707,7 +606,7 @@ Public Class ClsOC
_Folio = dr("Folio").ToString.ToEntero _Folio = dr("Folio").ToString.ToEntero
_CveIEAnticipo = dr("CveIEAnticipo").ToString.ToEntero _CveIEAnticipo = dr("CveIEAnticipo").ToString.ToEntero
_FolioIEAnticipo = dr("FolioIEAnticipo").ToString.ToEntero _FolioIEAnticipo = dr("FolioIEAnticipo").ToString.ToEntero
_ImporteAnticipo = dr("ImporteAnticipo").ToString.ToDouble _ImporteAnticipo = dr("ImporteAnticipo").ToString.ToDecimal
_CveProveedorAnticipo = dr("CveProveedorAnticipo").ToString.ToEntero _CveProveedorAnticipo = dr("CveProveedorAnticipo").ToString.ToEntero
_CveEmpresa = dr("CveEmpresa").ToString.ToEntero _CveEmpresa = dr("CveEmpresa").ToString.ToEntero
_CveProyecto = dr("CveProyecto").ToString.ToEntero _CveProyecto = dr("CveProyecto").ToString.ToEntero
@@ -752,32 +651,15 @@ Public Class ClsOC
Me.SucursalTelefono = If(Not IsDBNull(dr("TelefonoSucursal")), dr("TelefonoSucursal").ToString, "") Me.SucursalTelefono = If(Not IsDBNull(dr("TelefonoSucursal")), dr("TelefonoSucursal").ToString, "")
ProveedorContacto = dr("ContactoNombre").ToString ProveedorContacto = dr("ContactoNombre").ToString
PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDouble PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal
SubTotal = dr("SubTotal").ToString.ToDouble SubTotal = dr("SubTotal").ToString.ToDecimal
Descuento = dr("Descuento").ToString.ToDouble Descuento = dr("Descuento").ToString.ToDecimal
IVA = dr("IVA").ToString.ToDouble IVA = dr("IVA").ToString.ToDecimal
RetIVA = dr("RetIVA").ToString.ToDouble RetIVA = dr("RetIVA").ToString.ToDecimal
RetISR = dr("RetISR").ToString.ToDouble RetISR = dr("RetISR").ToString.ToDecimal
IEPS = dr("IEPS").ToString.ToDouble IEPS = dr("IEPS").ToString.ToDecimal
Total = dr("Total").ToString.ToDouble Total = dr("Total").ToString.ToDecimal
Pendiente = dr("Pendiente").ToString.ToDouble Pendiente = dr("Pendiente").ToString.ToDecimal
'If Not IsDBNull(dr("SubTotal")) Then
' SubTotal = dr("SubTotal").ToString.ToDouble
' If IVA <= 0 Then
' _IVA = _SubTotal * dr("PorcentajeIVA").ToString.ToDouble
' End If
' _Total = _SubTotal + _IVA - _Descuento - _RetIVA - _RetISR
'End If
'_CveSupervisara = dr("CveSupervisara").ToString.ToEntero
'_CveAutoriza = dr("CveAutoriza").ToString.ToEntero
'_CveAutorizara = dr("CveAutorizara").ToString.ToEntero
'_NombreSupervisa = dr("NombreSupervisa").ToString
'_NombreAutoriza = dr("NombreAutoriza").ToString
'_FechaSupervisa = dr("FechaSupervisa").ToString.ToDate
'_FechaAutoriza = dr("FechaAutoriza").ToString.ToDate
'RequiereCotizacion = CType(dr("RequiereCotizacion"), Boolean) 'RequiereCotizacion = CType(dr("RequiereCotizacion"), Boolean)
SubProyecto = dr("SubProyecto").ToString SubProyecto = dr("SubProyecto").ToString
@@ -820,9 +702,9 @@ Public Class ClsOC
pFechaEstimadaEntrega As String, pLugarEntrega As String, pCveUsuario As Integer, pCveEmpresa As Integer, pCvePresupuestoEgreso As Integer, pFechaEstimadaEntrega As String, pLugarEntrega As String, pCveUsuario As Integer, pCveEmpresa As Integer, pCvePresupuestoEgreso As Integer,
Optional pCveProveedor As Integer = -1, Optional pCveProveedorSucursal As Integer = -1, Optional IDPoliza As Integer = -1, Optional RequiereCotizacion As Boolean = False, Optional CveUsuarioAsignado As Integer = -1, Optional pCveProveedor As Integer = -1, Optional pCveProveedorSucursal As Integer = -1, Optional IDPoliza As Integer = -1, Optional RequiereCotizacion As Boolean = False, Optional CveUsuarioAsignado As Integer = -1,
Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "", Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "",
Optional PorcentajeIVA As Double = 0.16, Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional FechaExpiracion As Date = Nothing, Optional CveCotizacion As Integer = -1, Optional PorcentajeIVA As Decimal = 0.16, Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional FechaExpiracion As Date = Nothing, Optional CveCotizacion As Integer = -1,
Optional FolioAdicional As String = "", Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, Optional FolioAdicional As String = "", Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1,
Optional CveIEAnticipo As Integer = -1, Optional ImporteAnticipo As Double = 0, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", Optional CveProveedorContacto As Integer = -1) As Boolean Optional CveIEAnticipo As Integer = -1, Optional ImporteAnticipo As Decimal = 0, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", Optional CveProveedorContacto As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OC_OrdenesCompraAdd") DataAdapter("PA_OC_OrdenesCompraAdd")
@@ -971,7 +853,7 @@ Public Class ClsOC
Return Retorno Return Retorno
End Function End Function
Public Function UpdateOrdenCompraDetalleAjuste(CveOrdenCompra As Integer, CveOrdenCompraDetalle As Integer, Diferencia As Double, CveUsuarioModifico As Integer) As Boolean Public Function UpdateOrdenCompraDetalleAjuste(CveOrdenCompra As Integer, CveOrdenCompraDetalle As Integer, Diferencia As Decimal, CveUsuarioModifico As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OC_OrdenesCompraDetalleAjusteUpdate") DataAdapter("PA_OC_OrdenesCompraDetalleAjusteUpdate")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
@@ -1028,7 +910,7 @@ Public Class ClsOC
pCveProveedor As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer, Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "", pCveProveedor As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer, Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "",
Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional IDPoliza As Integer = -1, Optional FechaExpiracion As Date = Nothing, Optional FolioAdicional As String = "", Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional IDPoliza As Integer = -1, Optional FechaExpiracion As Date = Nothing, Optional FolioAdicional As String = "",
Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1",
Optional pCveProveedorSucursal As Integer = -1, Optional CveProveedorContacto As Integer = -1, Optional PorcentajeIVA As Double = 0.16) As Boolean Optional pCveProveedorSucursal As Integer = -1, Optional CveProveedorContacto As Integer = -1, Optional PorcentajeIVA As Decimal = 0.16) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OC_OrdenesCompraUpdate") DataAdapter("PA_OC_OrdenesCompraUpdate")
@@ -1266,18 +1148,18 @@ Public Class ClsOC
Return Retorno Return Retorno
End Function End Function
Public Function AddOrdenCompraDetalle(pCveOrdenCompra As Integer, pCantidad As Double, pCveUnidadMedida As Integer, pCvePS As Integer, pImporte As Double, pCveSubProyecto As Integer, pCveActivoFijo As Integer, Public Function AddOrdenCompraDetalle(pCveOrdenCompra As Integer, pCantidad As Decimal, pCveUnidadMedida As Integer, pCvePS As Integer, pImporte As Decimal, pCveSubProyecto As Integer, pCveActivoFijo As Integer,
pObservacion As String, pCveUsuario As Integer, Optional pCveOrdenCompraPadre As Integer = -1, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0, pObservacion As String, pCveUsuario As Integer, Optional pCveOrdenCompraPadre As Integer = -1, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Decimal = 0,
Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0, Optional IEPSPS As Decimal = 0, Optional IEPSPSIVA As Decimal = 0, Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional Total As Decimal = 0,
Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Decimal = 0, Optional RetIVAPorcentaje As Decimal = 0, Optional RetISRPorcentaje As Decimal = 0, Optional IEPSPSPorcentaje As Decimal = 0,
Optional IEPSPSIVAPorcentaje As Double = 0, Optional CveVentaDetalleCotizacion As Integer = -1, Optional CveTipoGastoObra As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1) As Boolean Optional IEPSPSIVAPorcentaje As Decimal = 0, Optional CveVentaDetalleCotizacion As Integer = -1, Optional CveTipoGastoObra As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OC_OrdenesCompraDetalleAdd") DataAdapter("PA_OC_OrdenesCompraDetalleAdd")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra
.Add("@Cantidad", SqlDbType.Float).Value = pCantidad .Add("@Cantidad", SqlDbType.Decimal).Value = pCantidad
.Add("@Descuento", SqlDbType.Float).Value = Descuento .Add("@Descuento", SqlDbType.Decimal).Value = Descuento
.Add("@Importe", SqlDbType.Float).Value = pImporte .Add("@Importe", SqlDbType.Float).Value = pImporte
.Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida .Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida
.Add("@CvePS", SqlDbType.Int).Value = pCvePS .Add("@CvePS", SqlDbType.Int).Value = pCvePS
@@ -1290,16 +1172,16 @@ Public Class ClsOC
.Add("@vCveOrdenCompraDetalle", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@vCveOrdenCompraDetalle", SqlDbType.Int).Direction = ParameterDirection.Output
.Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS .Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS
.Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA .Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA
.Add("@IVA", SqlDbType.Float).Value = IVA .Add("@IVA", SqlDbType.Decimal).Value = IVA
.Add("@RetIVA", SqlDbType.Float).Value = RetIVA .Add("@RetIVA", SqlDbType.Decimal).Value = RetIVA
.Add("@RetISR", SqlDbType.Float).Value = RetISR .Add("@RetISR", SqlDbType.Decimal).Value = RetISR
.Add("@Total", SqlDbType.Float).Value = Total .Add("@Total", SqlDbType.Decimal).Value = Total
.Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle
.Add("@IVAPorcentaje", SqlDbType.Float).Value = IVAPorcentaje .Add("@IVAPorcentaje", SqlDbType.Decimal).Value = IVAPorcentaje
.Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje .Add("@RetIVAPorcentaje", SqlDbType.Decimal).Value = RetIVAPorcentaje
.Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje .Add("@RetISRPorcentaje", SqlDbType.Decimal).Value = RetISRPorcentaje
.Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje .Add("@IEPSPSPorcentaje", SqlDbType.Decimal).Value = IEPSPSPorcentaje
.Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje .Add("@IEPSPSIVAPorcentaje", SqlDbType.Decimal).Value = IEPSPSIVAPorcentaje
.Add("@CveVentaDetalleCotizacion", SqlDbType.Int).Value = CveVentaDetalleCotizacion .Add("@CveVentaDetalleCotizacion", SqlDbType.Int).Value = CveVentaDetalleCotizacion
.Add("@CveTipoGastoObra", SqlDbType.Int).Value = CveTipoGastoObra .Add("@CveTipoGastoObra", SqlDbType.Int).Value = CveTipoGastoObra
.Add("@CveCultivoCuadroDetalle", SqlDbType.Int).Value = CveCultivoCuadroDetalle .Add("@CveCultivoCuadroDetalle", SqlDbType.Int).Value = CveCultivoCuadroDetalle
@@ -1322,11 +1204,11 @@ Public Class ClsOC
Return Retorno Return Retorno
End Function End Function
Public Function UpdateOrdenCompraDetalle(pCantidad As Double, pCveUnidadMedida As Integer, pCvePS As Integer, pImporte As Double, pCveSubProyecto As Integer, pCveActivoFijo As Integer, Public Function UpdateOrdenCompraDetalle(pCantidad As Decimal, pCveUnidadMedida As Integer, pCvePS As Integer, pImporte As Decimal, pCveSubProyecto As Integer, pCveActivoFijo As Integer,
pObservacion As String, pCveUsuario As Integer, pCveOrdenCompraDetalle As Integer, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0, pObservacion As String, pCveUsuario As Integer, pCveOrdenCompraDetalle As Integer, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Decimal = 0,
Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0, Optional IEPSPS As Decimal = 0, Optional IEPSPSIVA As Decimal = 0, Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional Total As Decimal = 0,
Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Decimal = 0, Optional RetIVAPorcentaje As Decimal = 0, Optional RetISRPorcentaje As Decimal = 0, Optional IEPSPSPorcentaje As Decimal = 0,
Optional IEPSPSIVAPorcentaje As Double = 0, Optional CveTipoGastoObra As Integer = -1) As Integer Optional IEPSPSIVAPorcentaje As Decimal = 0, Optional CveTipoGastoObra As Integer = -1) As Integer
Dim Retorno As Integer = -1 Dim Retorno As Integer = -1
DataAdapter("PA_OC_OrdenesCompraDetalleUpdate") DataAdapter("PA_OC_OrdenesCompraDetalleUpdate")
@@ -1336,8 +1218,8 @@ Public Class ClsOC
.Add("@Cantidad", SqlDbType.Float).Value = pCantidad .Add("@Cantidad", SqlDbType.Float).Value = pCantidad
.Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida .Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida
.Add("@CvePS", SqlDbType.Int).Value = pCvePS .Add("@CvePS", SqlDbType.Int).Value = pCvePS
.Add("@Descuento", SqlDbType.Float).Value = Descuento .Add("@Descuento", SqlDbType.Decimal).Value = Descuento
.Add("@Importe", SqlDbType.Float).Value = pImporte .Add("@Importe", SqlDbType.Decimal).Value = pImporte
.Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto
.Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle
.Add("@CveActivoFijo", SqlDbType.Int).Value = pCveActivoFijo .Add("@CveActivoFijo", SqlDbType.Int).Value = pCveActivoFijo
@@ -1346,16 +1228,16 @@ Public Class ClsOC
.Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario
.Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS .Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS
.Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA .Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA
.Add("@IVA", SqlDbType.Float).Value = IVA .Add("@IVA", SqlDbType.Decimal).Value = IVA
.Add("@RetIVA", SqlDbType.Float).Value = RetIVA .Add("@RetIVA", SqlDbType.Decimal).Value = RetIVA
.Add("@RetISR", SqlDbType.Float).Value = RetISR .Add("@RetISR", SqlDbType.Decimal).Value = RetISR
.Add("@Total", SqlDbType.Float).Value = Total .Add("@Total", SqlDbType.Decimal).Value = Total
.Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle
.Add("@IVAPorcentaje", SqlDbType.Float).Value = IVAPorcentaje .Add("@IVAPorcentaje", SqlDbType.Decimal).Value = IVAPorcentaje
.Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje .Add("@RetIVAPorcentaje", SqlDbType.Decimal).Value = RetIVAPorcentaje
.Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje .Add("@RetISRPorcentaje", SqlDbType.Decimal).Value = RetISRPorcentaje
.Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje .Add("@IEPSPSPorcentaje", SqlDbType.Decimal).Value = IEPSPSPorcentaje
.Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje .Add("@IEPSPSIVAPorcentaje", SqlDbType.Decimal).Value = IEPSPSIVAPorcentaje
.Add("@CveTipoGastoObra", SqlDbType.Int).Value = CveTipoGastoObra .Add("@CveTipoGastoObra", SqlDbType.Int).Value = CveTipoGastoObra
End With End With
@@ -2412,7 +2294,7 @@ Public Class ClsOC
Return Retorno Return Retorno
End Function End Function
Public Function AddSolicitudAnticipo(CveOrdenCompra As Integer, Importe As Double, CveEmpresa As Integer) As Boolean Public Function AddSolicitudAnticipo(CveOrdenCompra As Integer, Importe As Decimal, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_OC_SolicitudAnticipoAdd") DataAdapter("PA_OC_SolicitudAnticipoAdd")
@@ -2496,16 +2378,16 @@ Public Class ClsOC
End Function End Function
#Region " OC DETALLE - SALDOS [ SURTIDO INV | VINCULADO COMP ]" #Region " OC DETALLE - SALDOS [ SURTIDO INV | VINCULADO COMP ]"
Public Function OrdenesCompraDetalleSaldosInvCompraAdd(CveOCDetalle As Integer, CveInvDetalle As Integer, CantidadSurtida As Double, CveCompraDetalle As Integer, CantidadVinculada As Double) As Boolean Public Function OrdenesCompraDetalleSaldosInvCompraAdd(CveOCDetalle As Integer, CveInvDetalle As Integer, CantidadSurtida As Decimal, CveCompraDetalle As Integer, CantidadVinculada As Decimal) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("OC_OrdenesCompraDetalleSaldosInvCompraAdd") DataAdapter("OC_OrdenesCompraDetalleSaldosInvCompraAdd")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveOCDetalle", SqlDbType.Int).Value = CveOCDetalle .Add("@CveOCDetalle", SqlDbType.Int).Value = CveOCDetalle
.Add("@CveInvDetalle", SqlDbType.Int).Value = CveInvDetalle .Add("@CveInvDetalle", SqlDbType.Int).Value = CveInvDetalle
.Add("@CantidadSurtida", SqlDbType.Float).Value = CantidadSurtida .Add("@CantidadSurtida", SqlDbType.Decimal).Value = CantidadSurtida
.Add("@CveCompraDetalle", SqlDbType.Int).Value = CveCompraDetalle .Add("@CveCompraDetalle", SqlDbType.Int).Value = CveCompraDetalle
.Add("@CantidadVinculada", SqlDbType.Float).Value = CantidadVinculada .Add("@CantidadVinculada", SqlDbType.Decimal).Value = CantidadVinculada
End With End With
Try Try

View File

@@ -838,7 +838,7 @@ Public Class ClsVentas
Return Retorno Return Retorno
End Function End Function
Public Function UpdateEstatusVenta(CveVenta As Integer, CveEstatusFactura As Integer, CveEmpresa As Integer, Optional Num2 As Integer = -1) As Boolean Public Function UpdateEstatusVenta(CveVenta As Integer, CveEstatusFactura As Integer, CveEmpresa As Integer, Optional Num2 As Integer = -1, Optional CveEstatusRefacturacion As Integer = -1, Optional CveMotivoCancelacion As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasEstatusUpdate") DataAdapter("PA_Vta_VentasEstatusUpdate")
@@ -848,6 +848,8 @@ Public Class ClsVentas
.Add("@CveEstatusFactura", SqlDbType.Int).Value = CveEstatusFactura .Add("@CveEstatusFactura", SqlDbType.Int).Value = CveEstatusFactura
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@Num2", SqlDbType.Float).Value = Num2 .Add("@Num2", SqlDbType.Float).Value = Num2
.Add("@CveEstatusRefacturacion", SqlDbType.Int).Value = CveEstatusRefacturacion
.Add("@CveMotivoCancelacion", SqlDbType.Int).Value = CveMotivoCancelacion
End With End With
Try Try

View File

@@ -4845,7 +4845,8 @@ Namespace Modelos
End If End If
'SI YA ESTA TIMBRADA, NUEVO PROCESO REFACTURACION, ASIGNA LA CANCELACION PENDIENTE 'SI YA ESTA TIMBRADA, NUEVO PROCESO REFACTURACION, ASIGNA LA CANCELACION PENDIENTE
If EsRefacturacion AndAlso Me.CveEstatusFactura = 3 AndAlso CveMotivoCancelacion > 0 Then 'EL ESTATUS REFACTURACION 4 ES PARA LAS QUE NO SE PUDIERON CANCELAR, DEBE OBLIGAR A CANCELAR ANTE EL SAT
If EsRefacturacion AndAlso Me.CveEstatusFactura = 3 AndAlso CveMotivoCancelacion > 0 AndAlso CveEstatusRefacturacion <> 4 Then
CveEstatusFacturaAsignado = 23 CveEstatusFacturaAsignado = 23
End If End If

View File

@@ -562,8 +562,8 @@
function txtSumaTntermediario(txt) { function txtSumaTntermediario(txt) {
var comision2 = ToDouble($('#C_TxtComisionIntermediario').val()); var comision2 = ToDouble($('#C_TxtComisionIntermediario').val());
if (comision2 > ValorTotalSeleccionado) { if (comision2 > ValorTotalSeleccionado) {
$('#C_TxtComisionIntermediario').val(ComisionIntermediario); //$('#C_TxtComisionIntermediario').val(ComisionIntermediario);
alert("No es posible poner un importe superior a lo seleccionado"); //alert("No es posible poner un importe superior a lo seleccionado");
} else { } else {
saldo = ValorTotalSeleccionado - descuento + comision - comision2 - IVA; saldo = ValorTotalSeleccionado - descuento + comision - comision2 - IVA;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); $('#C_lblValorTotal').text(FormatoNumero(saldo, 2));

View File

@@ -2149,18 +2149,8 @@ Partial Class Compras_Compras
Private Sub CargaRetIVAConcepto(Optional Cambio As Boolean = False) Private Sub CargaRetIVAConcepto(Optional Cambio As Boolean = False)
If TrRetIVA.Visible Then If TrRetIVA.Visible Then
TdRetIVAConcepto.Visible = True TdRetIVAConcepto.Visible = True
End If End If
If Cambio Then If Cambio Then
@@ -2174,15 +2164,12 @@ Partial Class Compras_Compras
End If End If
DdlRetIVAConcepto.Items.Add(New ListItem("Arrendamiento", "4")) DdlRetIVAConcepto.Items.Add(New ListItem("Arrendamiento", "4"))
''If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then
'If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then 'DdlRetIVAConcepto.Items.Add(New ListItem("Ret IVA Servicios", "5"))
DdlRetIVAConcepto.Items.Add(New ListItem("Ret IVA Servicios", "5")) ''End If
'End If
End If End If
UpPS.Update() UpPS.Update()
End Sub End Sub
@@ -5262,7 +5249,7 @@ Partial Class Compras_Compras
'QUEMA SALDOS DE INV-COMPRA | MERCANCIA RECIBIDA POR ADELANTADO (OC) | PP 176 'QUEMA SALDOS DE INV-COMPRA | MERCANCIA RECIBIDA POR ADELANTADO (OC) | PP 176
If OCVinculada And Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then If OCVinculada And Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then
For Each Row As DataRow In TmpDT.FiltraParametros("CveTipoPS = 2").Rows For Each Row As DataRow In TmpDT.FiltraParametros("CveTipoPS = 2").Rows
If Not ObjOC.OrdenesCompraDetalleSaldosInvCompraAdd(Row("CveOrdenCompraDetalle").ToString.ToEntero, -1, -1, Row("CveCompraDetalle").ToString.ToEntero, Row("Cantidad").ToString.ToDouble) Then If Not ObjOC.OrdenesCompraDetalleSaldosInvCompraAdd(Row("CveOrdenCompraDetalle").ToString.ToEntero, -1, -1, Row("CveCompraDetalle").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal) Then
ErrorSaldosInvComp = True ErrorSaldosInvComp = True
Exit For Exit For
End If End If

View File

@@ -1011,14 +1011,17 @@ Partial Class PopUpVerFactura
Dim Usuario As String = $"&emsp;<b>Usuario:</b> {Nombre}" Dim Usuario As String = $"&emsp;<b>Usuario:</b> {Nombre}"
If DtCortesVentas.Rows.Count > 0 Or DtCortesVentasResumen.Rows.Count > 0 Then If DtCortesVentas.Rows.Count > 0 Or DtCortesVentasResumen.Rows.Count > 0 Then
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
'params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, ImageToBase64(Drawing.Image.FromFile(Imagen.FullName), Drawing.Imaging.ImageFormat.Png), "")))
Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
Dim params As New List(Of ReportParameter) Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("AgrupoPor", $"{FechaCorte}{Usuario}")) params.Add(New ReportParameter("AgrupoPor", $"{FechaCorte}{Usuario}"))
If Imagen.Exists Then If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri)) params.Add(New ReportParameter("LogoPath", LogoRuta))
Else Else
params.Add(New ReportParameter("LogoPath", "")) params.Add(New ReportParameter("LogoPath", ""))
End If End If
@@ -1124,7 +1127,7 @@ Partial Class PopUpVerFactura
Private Sub ImprimeGastoContrato(CveContrato As Integer, CveContratoGasto As Integer) Private Sub ImprimeGastoContrato(CveContrato As Integer, CveContratoGasto As Integer)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim Dr As DataRow = Nothing Dim Dr As DataRow = Nothing
Dim ObjContratos As New ClsContratos Dim ObjContratos As New ClsContratos
@@ -1158,7 +1161,9 @@ Partial Class PopUpVerFactura
End If End If
params.Add(New ReportParameter("Utilidad", $"$ {(SumaUtilidad - SumaGasto).ToString.FormatoNumero()}")) params.Add(New ReportParameter("Utilidad", $"$ {(SumaUtilidad - SumaGasto).ToString.FormatoNumero()}"))
If Imagen.Exists Then If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
params.Add(New ReportParameter("LogoPath", LogoRuta))
Else Else
params.Add(New ReportParameter("LogoPath", "")) params.Add(New ReportParameter("LogoPath", ""))
End If End If
@@ -1306,14 +1311,9 @@ Partial Class PopUpVerFactura
If Dt.Rows.Count > 0 Then If Dt.Rows.Count > 0 Then
Dim params As New List(Of ReportParameter) Dim params As New List(Of ReportParameter)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
'params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, ImageToBase64(Drawing.Image.FromFile(Imagen.FullName), Drawing.Imaging.ImageFormat.Png), ""))) 'params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, ImageToBase64(Drawing.Image.FromFile(Imagen.FullName), Drawing.Imaging.ImageFormat.Png), "")))
Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName) Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
If Imagen.Exists Then If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", LogoRuta)) params.Add(New ReportParameter("LogoPath", LogoRuta))
Else Else
@@ -1733,7 +1733,7 @@ Partial Class PopUpVerFactura
If DtConceptos.Rows.Count > 0 Then If DtConceptos.Rows.Count > 0 Then
Dim params As New List(Of ReportParameter) Dim params As New List(Of ReportParameter)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
If Imagen.Exists Then If Imagen.Exists Then
Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName) Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
@@ -3250,8 +3250,15 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("NombreEntrego", Personal)) params.Add(New ReportParameter("NombreEntrego", Personal))
params.Add(New ReportParameter("Responsable", Personal)) params.Add(New ReportParameter("Responsable", Personal))
params.Add(New ReportParameter("NombreRecibio", Capturo.ToUpper)) params.Add(New ReportParameter("NombreRecibio", Capturo.ToUpper))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
params.Add(New ReportParameter("LogoPath", logouri)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
If Imagen.Exists Then
Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
params.Add(New ReportParameter("LogoPath", LogoRuta))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
If DtMovimientos.COUNT("Serie") > 0 Then If DtMovimientos.COUNT("Serie") > 0 Then
params.Add(New ReportParameter("MostrarSerieLote", "1")) params.Add(New ReportParameter("MostrarSerieLote", "1"))
Else Else
@@ -3336,8 +3343,14 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("NombreEntrego", Capturo.ToUpper)) params.Add(New ReportParameter("NombreEntrego", Capturo.ToUpper))
params.Add(New ReportParameter("Responsable", Personal)) params.Add(New ReportParameter("Responsable", Personal))
params.Add(New ReportParameter("NombreRecibio", Personal)) params.Add(New ReportParameter("NombreRecibio", Personal))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
params.Add(New ReportParameter("LogoPath", logouri)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
If Imagen.Exists Then
Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
params.Add(New ReportParameter("LogoPath", LogoRuta))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
If DtMovimientos.COUNT("Serie") > 0 Then If DtMovimientos.COUNT("Serie") > 0 Then
params.Add(New ReportParameter("MostrarSerieLote", "1")) params.Add(New ReportParameter("MostrarSerieLote", "1"))
Else Else
@@ -4775,7 +4788,8 @@ Partial Class PopUpVerFactura
End If End If
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
If Not ReporteEmpresa.Exists Then If Not ReporteEmpresa.Exists Then
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
@@ -4783,7 +4797,8 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
If Imagen.Exists Then If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri)) Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
params.Add(New ReportParameter("LogoPath", LogoRuta))
Else Else
params.Add(New ReportParameter("LogoPath", "")) params.Add(New ReportParameter("LogoPath", ""))
End If End If
@@ -4979,10 +4994,9 @@ Partial Class PopUpVerFactura
ObjAF.Dispose() ObjAF.Dispose()
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
If Imagen.Exists Then If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri)) Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
params.Add(New ReportParameter("LogoPath", LogoRuta))
Else Else
params.Add(New ReportParameter("LogoPath", "")) params.Add(New ReportParameter("LogoPath", ""))
End If End If
@@ -6070,7 +6084,9 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("CodigoTD", CodigoTD)) params.Add(New ReportParameter("CodigoTD", CodigoTD))
If Imagen.Exists Then If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
params.Add(New ReportParameter("LogoPath", LogoRuta))
Else Else
params.Add(New ReportParameter("LogoPath", "")) params.Add(New ReportParameter("LogoPath", ""))
End If End If
@@ -6128,7 +6144,7 @@ Partial Class PopUpVerFactura
ObjPS.Dispose() ObjPS.Dispose()
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim DtDatos As New DataTable Dim DtDatos As New DataTable
Dim params As New List(Of ReportParameter) Dim params As New List(Of ReportParameter)
@@ -6207,7 +6223,9 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("CodigoTD", CodigoTD)) params.Add(New ReportParameter("CodigoTD", CodigoTD))
If Imagen.Exists Then If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName)
params.Add(New ReportParameter("LogoPath", LogoRuta))
Else Else
params.Add(New ReportParameter("LogoPath", "")) params.Add(New ReportParameter("LogoPath", ""))
End If End If

View File

@@ -1777,7 +1777,7 @@ Partial Class Inventarios_EntradasSalidas
If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True
TipoMovtoOtro = Not TipoMovtoAlmacen TipoMovtoOtro = Not TipoMovtoAlmacen
Dim CveConceptoContable As Integer = 78 Dim CveConceptoContable As Integer = 260
Dim CveClasificacion As Integer = -1 Dim CveClasificacion As Integer = -1
Select Case DdlConcepto.SelectedValue.ToEntero Select Case DdlConcepto.SelectedValue.ToEntero
Case 28, 31 Case 28, 31

View File

@@ -533,11 +533,7 @@ Partial Class Inventarios_RecepcionAlmacen
Private Sub CargaAlmacenes(CveSubProyecto As Integer, Optional CveTiposAlmacen As String = "", Optional CveTipoCompra As Integer = -1) Private Sub CargaAlmacenes(CveSubProyecto As Integer, Optional CveTiposAlmacen As String = "", Optional CveTipoCompra As Integer = -1)
Dim StrAlmacenes As String = "" Dim StrAlmacenes As String = ""
If UsuarioActual.CveSubProyecto = 8804 Then 'AGS StrAlmacenes = $"CveTipoAlmacen IN ({If(CveTiposAlmacen.Length > 0, CveTiposAlmacen, "1,2,15,14,19")}) {If(CveSubProyecto > 0, $"And CveSubProyecto = {CveSubProyecto}", "")}"
StrAlmacenes = $"CveTipoAlmacen IN ({If(CveTiposAlmacen.Length > 0, CveTiposAlmacen, "1,2,12,15")}) {If(CveSubProyecto > 0, $"And CveSubProyecto = {CveSubProyecto}", "")}"
Else
StrAlmacenes = $"CveTipoAlmacen IN ({If(CveTiposAlmacen.Length > 0, CveTiposAlmacen, "1,2,15,14")}) {If(CveSubProyecto > 0, $"And CveSubProyecto = {CveSubProyecto}", "")}"
End If
If CveTipoCompra = 10 Then If CveTipoCompra = 10 Then
StrAlmacenes = $"Modalidad = 0" StrAlmacenes = $"Modalidad = 0"
@@ -3693,7 +3689,7 @@ Partial Class Inventarios_RecepcionAlmacen
If Not ErrorMovInv And CveOCSurtir > 0 Then If Not ErrorMovInv And CveOCSurtir > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjOC.OrdenesCompraDetalleSaldosInvCompraAdd(Dr("CveOrdenCompraDetalle").ToString.ToEntero, Dr("CveMovimientoDetalle").ToString.ToEntero, Dr("Cantidad").ToString.ToDouble, -1, -1) Then If Not ObjOC.OrdenesCompraDetalleSaldosInvCompraAdd(Dr("CveOrdenCompraDetalle").ToString.ToEntero, Dr("CveMovimientoDetalle").ToString.ToEntero, Dr("Cantidad").ToString.ToDecimal, -1, -1) Then
ErrorMovInv = True ErrorMovInv = True
Exit For Exit For
End If End If

File diff suppressed because it is too large Load Diff

View File

@@ -208,8 +208,8 @@ Partial Class PopOCCotizacionesDetalle
End If End If
For Each dr As GridViewRow In GvDC.Rows For Each dr As GridViewRow In GvDC.Rows
TieneError = Not objCotizacion.AddCotizacionDetalle(objCotizacion.CveCotizacion, dr.DataKey("CvePS").ToEntero, dr.FCTextBox("TxtPU").Text.ToDouble, dr.DataKey("Cantidad").ToDouble, TieneError = Not objCotizacion.AddCotizacionDetalle(objCotizacion.CveCotizacion, dr.DataKey("CvePS").ToEntero, dr.FCTextBox("TxtPU").Text.ToDecimal, dr.DataKey("Cantidad").ToDecimal,
dr.DataKey("CveUnidadMedida").ToEntero, dr.FCTextBox("txtCantidadSurtir").Text.ToDouble, dr.DataKey("CveUnidadMedida").ToEntero, dr.FCTextBox("txtCantidadSurtir").Text.ToDecimal,
If(dr.FCTextBox("txtFechaEntrega").Text.Trim = "" Or dr.FCTextBox("txtFechaEntrega").Text = "__/__/____", "-1", If(dr.FCTextBox("txtFechaEntrega").Text.Trim = "" Or dr.FCTextBox("txtFechaEntrega").Text = "__/__/____", "-1",
dr.FCTextBox("txtFechaEntrega").Text), dr.FCTextBox("txtObservacion").Text.ToString, dr.DataKey("CveOrdenCompraDetalle").ToString.ToEntero) dr.FCTextBox("txtFechaEntrega").Text), dr.FCTextBox("txtObservacion").Text.ToString, dr.DataKey("CveOrdenCompraDetalle").ToString.ToEntero)
If TieneError = True Then Exit For If TieneError = True Then Exit For
@@ -230,12 +230,12 @@ Partial Class PopOCCotizacionesDetalle
For Each dr As GridViewRow In GvDC.Rows For Each dr As GridViewRow In GvDC.Rows
If dr.DataKey("CveCotizacionDetalle").ToEntero > 0 Then If dr.DataKey("CveCotizacionDetalle").ToEntero > 0 Then
TieneError = Not objCotizacion.UpdateCotizacionDetalle(dr.DataKey("CveCotizacionDetalle").ToEntero, dr.FCTextBox("TxtPU").Text.ToDouble, dr.FCTextBox("txtCantidadSurtir").Text.ToDouble, dr.FCTextBox("txtFechaEntrega").Text, dr.FCTextBox("txtObservacion").Text.ToString) TieneError = Not objCotizacion.UpdateCotizacionDetalle(dr.DataKey("CveCotizacionDetalle").ToEntero, dr.FCTextBox("TxtPU").Text.ToDecimal, dr.FCTextBox("txtCantidadSurtir").Text.ToDecimal, dr.FCTextBox("txtFechaEntrega").Text, dr.FCTextBox("txtObservacion").Text.ToString)
Else Else
Dim strTemp = dr.DataKey("CveOrdenCompraDetalle").ToString Dim strTemp = dr.DataKey("CveOrdenCompraDetalle").ToString
If dr.FCTextBox("txtCantidadSurtir").Text.ToString.ToDouble > 0 Then If dr.FCTextBox("txtCantidadSurtir").Text.ToString.ToDouble > 0 Then
If dr.FCTextBox("TxtPU").Text.ToDouble > 0 Then TieneError = Not objCotizacion.AddCotizacionDetalle(CveCotizacion, dr.DataKey("CvePS").ToEntero, dr.FCTextBox("TxtPU").Text.ToDouble, dr.DataKey("Cantidad").ToDouble, dr.DataKey("CveUnidadMedida").ToEntero, dr.FCTextBox("txtCantidadSurtir").Text.ToString.ToDouble, If(dr.FCTextBox("txtFechaEntrega").Text.Trim = "" Or dr.FCTextBox("txtFechaEntrega").Text = "__/__/____", "-1", dr.FCTextBox("txtFechaEntrega").Text), dr.FCTextBox("txtObservacion").Text.ToString, dr.DataKey("CveOrdenCompraDetalle").ToEntero) If dr.FCTextBox("TxtPU").Text.ToDouble > 0 Then TieneError = Not objCotizacion.AddCotizacionDetalle(CveCotizacion, dr.DataKey("CvePS").ToEntero, dr.FCTextBox("TxtPU").Text.ToDecimal, dr.DataKey("Cantidad").ToDecimal, dr.DataKey("CveUnidadMedida").ToEntero, dr.FCTextBox("txtCantidadSurtir").Text.ToString.ToDecimal, If(dr.FCTextBox("txtFechaEntrega").Text.Trim = "" Or dr.FCTextBox("txtFechaEntrega").Text = "__/__/____", "-1", dr.FCTextBox("txtFechaEntrega").Text), dr.FCTextBox("txtObservacion").Text.ToString, dr.DataKey("CveOrdenCompraDetalle").ToEntero)
End If End If
End If End If

View File

@@ -41,7 +41,7 @@
<div class="actions"> <div class="actions">
<div class="btn-group"> <div class="btn-group">
<div class="row" style="margin-left: 0px; text-align: right" align="left"> <div class="row" style="margin-left: 0px; text-align: right" align="left">
<div style="margin-right: 15px"> <div style="margin-right: 15px">
<input type="text" id="TxtBusqueda1" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda1','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <input type="text" id="TxtBusqueda1" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda1','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
@@ -88,7 +88,7 @@
</div> </div>
<div class="actions"> <div class="actions">
<div class="btn-group"> <div class="btn-group">
<div class="row" style="margin-left: 0px; text-align: right" align="left"> <div class="row" style="margin-left: 0px; text-align: right" align="left">
<div style="margin-right: 15px"> <div style="margin-right: 15px">
<input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvRefacturaciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvRefacturaciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvRefacturaciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvRefacturaciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
@@ -103,7 +103,7 @@
<div class="col-md-12"> <div class="col-md-12">
<asp:GridView ID="GvRefacturaciones" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación" <asp:GridView ID="GvRefacturaciones" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación"
DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,FolioFiscalSustitucion,CveEstatusFactura,RFCReceptor" DataKeyNames="CveVenta,CveCliente,SerieFolio,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,CveEstatusFactura,RFCReceptor,CveEstatusRefacturacion,CveVentaSustitucion,TotalSustitucion,RFCReceptorSustitucion,CveClienteSustitucion,FolioFiscalSustitucion,SerieFolioSustitucion"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%" OnRowDataBound="GvDatos_RowDataBound"> CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%" OnRowDataBound="GvDatos_RowDataBound">
<Columns> <Columns>
<asp:BoundField HeaderText="Cliente" DataField="Nombre" ItemStyle-Width="25%" /> <asp:BoundField HeaderText="Cliente" DataField="Nombre" ItemStyle-Width="25%" />
@@ -123,10 +123,19 @@
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Cancelar"> <asp:TemplateField ItemStyle-Width="35px" HeaderText="Cancelar">
<ItemTemplate> <ItemTemplate>
<asp:LinkButton ID="LnkCancelar" Visible="false" runat="server" OnClick="BtnCancelarDocumento_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si"></asp:LinkButton> <div class="row" style="padding-bottom:3px;">
<div class="col-md-12">
<asp:LinkButton ID="LnkCancelar" Visible="false" runat="server" OnClick="BtnCancelarDocumento_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-check'> Factura Pendiente</i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si"></asp:LinkButton>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:LinkButton ID="LnkCancelarFolioSustitucion" Visible="false" runat="server" OnClick="LnkCancelarFolioSustitucion_Click" CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-check'> Folio Sustitucion</i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si"></asp:LinkButton>
</div>
</div>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:HyperLinkField HeaderText="Refacturar" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" /> <asp:HyperLinkField HeaderText="Refacturar" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
</Columns> </Columns>
<RowStyle CssClass="Texto" /> <RowStyle CssClass="Texto" />
<HeaderStyle CssClass="Titulos" /> <HeaderStyle CssClass="Titulos" />

View File

@@ -68,9 +68,9 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
} }
ObjVentas.Dispose(); ObjVentas.Dispose();
GvDatos.DataSource = DtVentas.FiltraParametros("(CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0)"); GvDatos.DataSource = DtVentas.FiltraParametros("(CveEstatusFactura = 20 AND CveEstatusRefacturacion IN (0,4))");
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3) OR (CveEstatusFactura = 20 AND CveEstatusRefacturacion > 0) OR CveEstatusFactura = 23"); var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3) OR (CveEstatusFactura = 20 AND CveEstatusRefacturacion IN (1,2,3)) OR CveEstatusFactura = 23");
if (DtRefacturar != null && DtRefacturar.Rows.Count > 0) if (DtRefacturar != null && DtRefacturar.Rows.Count > 0)
{ {
DivRefacturar.Visible = true; DivRefacturar.Visible = true;
@@ -177,9 +177,25 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
string Nombre = GvRow.DataKey("Nombre"); string Nombre = GvRow.DataKey("Nombre");
string FolioSustitucion = GvRow.DataKey("FolioFiscalSustitucion"); string FolioSustitucion = GvRow.DataKey("FolioFiscalSustitucion");
int CveMotivoCancelacion = -1;
int CveEstatusRefacturacion = GvRow.DataKey("CveEstatusRefacturacion").ToEntero();
//SI NO SE PUDO CANCELAR, CANCELAR CON EL 02
if (CveEstatusRefacturacion == 4)
{
FolioSustitucion = "";
//CUANDO LAS REFACTURACIONES NO SE PUEDEN CANCELAR, DEBE SER CANCELADO CON EL MOTIVO 02
CveMotivoCancelacion = get_GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa, CveSATMotivoCancelacion: 2).FiltroPrimeroValor("CveMotivoCancelacion").ToEntero();
}
else
{
CveEstatusRefacturacion = 2;
}
if (CveVenta > 0 && Uuid != "") if (CveVenta > 0 && Uuid != "")
{ {
var respCancelacion = CancelarDocumento(CveVenta, -1, CveCliente, Folio, Uuid, "", DateTime.Now, TipoDocto, Total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: true, FolioSustitucion: FolioSustitucion, CveEstatusRefacturacion: 2); var respCancelacion = CancelarDocumento(CveVenta, -1, CveCliente, Folio, Uuid, "", DateTime.Now, TipoDocto, Total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: true, FolioSustitucion: FolioSustitucion, CveEstatusRefacturacion: CveEstatusRefacturacion);
if (!respCancelacion.HuboError) if (!respCancelacion.HuboError)
{ {
@@ -463,7 +479,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
retorno.Mensaje = sb.ToString(); retorno.Mensaje = sb.ToString();
return retorno; return retorno;
} }
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false, string FolioSustitucion = "", int CveEstatusRefacturacion = 0) private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false, string FolioSustitucion = "", int CveEstatusRefacturacion = 0, int CveMotivoCancelacion = 0)
{ {
Modelos.Factura.MCancelacionVentaMensaje retorno = null; Modelos.Factura.MCancelacionVentaMensaje retorno = null;
var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion: true); var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion: true);
@@ -480,12 +496,22 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
factura.CveEstatusRefacturacion = CveEstatusRefacturacion; factura.CveEstatusRefacturacion = CveEstatusRefacturacion;
} }
if (CveMotivoCancelacion > 0)
{
factura.CveMotivoCancelacion = CveMotivoCancelacion;
}
int CveEstatusFactura = -1; int CveEstatusFactura = -1;
//SI LA FACTURA YA ESTA CANCELADA, LA ASIGNA YA COMO CANCELADA //SI LA FACTURA YA ESTA CANCELADA, LA ASIGNA YA COMO CANCELADA
if (CveEstatus == 5) if (CveEstatus == 5)
{ {
CveEstatusFactura = CveEstatus; CveEstatusFactura = CveEstatus;
} }
//NO DEBE DE ASIGNAR ESTATUS
if (CveEstatus == -2)
{
CveEstatusFactura = -1;
}
retorno = factura.CancelarPorRefacturacion(factura.CveMotivoCancelacion, factura.MotivoCancelacion, FolioSustitucion: FolioSustitucion, CveEstatusFacturaAsignado: CveEstatusFactura); retorno = factura.CancelarPorRefacturacion(factura.CveMotivoCancelacion, factura.MotivoCancelacion, FolioSustitucion: FolioSustitucion, CveEstatusFacturaAsignado: CveEstatusFactura);
} }
@@ -561,6 +587,11 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23 && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0) if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23 && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0)
{ {
e.Row.FCLinkButton("LnkCancelar").Visible = true; e.Row.FCLinkButton("LnkCancelar").Visible = true;
//SOLO MOSTRAR SI LA FACTURA NUEVA ESTA EMITIDA
if (e.Row.DBCampo("CveEstatusRefacturacion").ToString().ToEntero() != 4 && e.Row.DBCampo("CveEstatusFacturaSustitucion").ToString().ToEntero() == 3)
{
e.Row.FCLinkButton("LnkCancelarFolioSustitucion").Visible = true;
}
} }
} }
} }
@@ -708,40 +739,127 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
} }
protected void LnkCancelarFolioSustitucion_Click(object sender, EventArgs e)
{
//this.HdnLigaRefacturar.Value = "";
this.CveVenta = -1;
//protected void BtnAcuse_Click(object sender, EventArgs e) GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
//{ this.CveVenta = GvRow.DataKey("CveVentaSustitucion").ToEntero();
// GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
// string UsuarioServicio = "rene.molina@adsistemas.mx";
// string ClaveServicio = "rene2018";
// string UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL";
// this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); int CveCliente = GvRow.DataKey("CveClienteSustitucion").ToEntero();
string Total = GvRow.DataKey("TotalSustitucion");
string RFCReceptor = GvRow.DataKey("RFCReceptorSustitucion");
string TipoDocto = GvRow.DataKey("TipoDocto");
string Nombre = GvRow.DataKey("Nombre");
string FolioSustitucion = GvRow.DataKey("FolioFiscalSustitucion");
string SerieFolioSustitucion = GvRow.DataKey("SerieFolioSustitucion");
// string Uuid = GvRow.DataKey("FolioFiscal"); int CveVentaOriginal = GvRow.DataKey("CveVenta").ToEntero();
// decimal Total = GvRow.DataKey("Total").ToDecimal(); string SerieFolioOriginal = GvRow.DataKey("SerieFolio");
// string RFCCliente = GvRow.DataKey("RFCCliente");
// string FolioFiscalSustitucion = GvRow.DataKey("FolioFiscalSustitucion");
// Cancelacion2022.AcuseSat resp = new Cancelacion2022.AcuseSat();
// GoFac.GoCfdi a = new GoFac.GoCfdi();
// a.ObtenerAcuse(UrlServicio, UsuarioActual.Empresa.RFC, UsuarioServicio, ClaveServicio, Uuid);
// if (a.CodigoError != 0) //CUANDO LAS REFACTURACIONES NO SE PUEDEN CANCELAR, DEBE SER CANCELADO CON EL MOTIVO 02
// { int CveMotivoCancelacion = get_GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa, CveSATMotivoCancelacion: 2).FiltroPrimeroValor("CveMotivoCancelacion").ToEntero();
// //no se pudo obtener, la mandamos cancelar
// Timbrado ObjCancelacion = new Timbrado();
// if (ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, Uuid, Total, RFCCliente, UsuarioActual.Empresa.RFC, 4, ValidaFactura:false, CveSATMotivoCancelacion: 1, FolioSustitucion: FolioFiscalSustitucion )) if (CveVenta > 0 && FolioSustitucion != "")
// { {
// string b = ObjCancelacion.CancelacionAcuse; var respCancelacion = CancelarDocumento(CveVenta, -2, CveCliente, "", FolioSustitucion, "", DateTime.Now, TipoDocto, Total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: true, FolioSustitucion: "", CveEstatusRefacturacion: 4, CveMotivoCancelacion: CveMotivoCancelacion);
// //falta actualizar
// Alert("Se regeneró la solicitud de cancelación");
// }
if (!respCancelacion.HuboError)
{
var sb = new StringBuilder();
var EnviarAcuse = false;
if (respCancelacion.CveEstatus > 0)
{
if (respCancelacion.CveEstatus.Contiene(5, 20))
{
EnviarAcuse = true;
}
// } var CveEstatus = respCancelacion.CveEstatus;
var ObjVentas = new ClsVentas();
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
{
if (respCancelacion.CveEstatus == 20)
{
sb.Append($"El estatus de la factura <b>{SerieFolioSustitucion}</b> fue cambiado a 'Cancelación en proceso'.");
sb.Append("El documento se canceló correctamente.");
sb.Append($"</br> <a href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=CAN&CVEVTA={CveVenta}")}' class='Texto' target='_blank'>Imprimir Acuse</a>");
}
else if (respCancelacion.CveEstatus == 23)
{
sb.Append("La solicitud de cancelación no la aplicó el SAT, intente cancelar de nuevo.");
}
else if (respCancelacion.CveEstatus == 5)
{
sb.Append($"El estatus de la factura <b>{SerieFolioSustitucion}</b> fue cambiado a 'Cancelada'.");
sb.Append("El documento se canceló correctamente.");
sb.Append($"</br> <a href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=CAN&CVEVTA={CveVenta}")}' class='Texto' target='_blank'>Imprimir Acuse</a>");
}
//} if (respCancelacion.CveEstatus.Contiene(5,20))
{
if (ObjVentas.UpdateEstatusVenta(CveVentaOriginal, 23, UsuarioActual.CveEmpresa, CveEstatusRefacturacion:4, CveMotivoCancelacion: CveMotivoCancelacion))
{
sb.Append($"</br>La Factura <b>{SerieFolioOriginal}</b> fue desligada.");
}
}
}
else
{
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
}
ObjVentas.Dispose();
if (respCancelacion.CveEstatus == 23)
{
var resp = Timbrado.VerificarVigenciaSAT(FolioSustitucion, UsuarioActual.Empresa.RFC, RFCReceptor, Total, true);
if (resp != null)
{
sb.AppendFormat("<br/> Folio Fiscal: {0} <br/>", FolioSustitucion);
sb.AppendFormat("Código Estado: {0} <br/>", resp.CodigoEstatus);
sb.AppendFormat("Estado: {0} <br/>", resp.Estado);
sb.AppendFormat("Es Cancelable: {0} <br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable);
sb.AppendFormat("Estatus de Cancelación: {0} <br/><br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion);
}
}
}
else
{
var resp = Timbrado.VerificarVigenciaSAT(FolioSustitucion, UsuarioActual.Empresa.RFC, RFCReceptor, Total, true);
if (resp != null)
{
sb.AppendFormat("Folio Fiscal: {0} <br/>", FolioSustitucion);
sb.AppendFormat("Código Estado: {0} <br/>", resp.CodigoEstatus);
sb.AppendFormat("Estado: {0} <br/>", resp.Estado);
sb.AppendFormat("Es Cancelable: {0} <br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable);
sb.AppendFormat("Estatus de Cancelación: {0} <br/><br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion);
}
sb.Append(respCancelacion.Mensaje);
}
if (EnviarAcuse)
{
sb.Append("</br></br> ¿Desea enviar el Acuse de Cancelación al Cliente?");
Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, "BtnEnviarMailCancelacion();", TextoConfirmacion: "Enviar", TextoSegundoBoton: "Cancelar");
}
else
{
Alert(sb.ToString());
}
}
else
{
Alert(respCancelacion.Mensaje, TipoMensaje.MsgError);
}
CargaDatos();
}
UPDatos.Update();
}
} }
public class MRespuestaSAT public class MRespuestaSAT
{ {

View File

@@ -3853,7 +3853,7 @@
<asp:Button ID="BtnGeneraAutorizacion" runat="server" Text="Generar Autorización" OnClick="BtnGeneraAutorizacion_Click" Visible="false" ValidationGroup="GrpEmitirImprimir" CssClass="btn myventasbutton btn-primary" data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea generar la autorización?" data-btn-ok-label="si" /> <asp:Button ID="BtnGeneraAutorizacion" runat="server" Text="Generar Autorización" OnClick="BtnGeneraAutorizacion_Click" Visible="false" ValidationGroup="GrpEmitirImprimir" CssClass="btn myventasbutton btn-primary" data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea generar la autorización?" data-btn-ok-label="si" />
<%--<asp:Button ID="Button2" runat="server" Text="Button" />--%> <%--<asp:Button ID="Button2" runat="server" Text="Button" />--%>
<asp:Button ID="BtnGenerarPoliza" runat="server" Text="GenerarPoliza" Visible="false" CssClass="btn myventasbutton btn-primary" /> <asp:Button ID="BtnGenerarPoliza" runat="server" Text="GenerarPoliza" OnClick="BtnGenerarPoliza_Click" Visible="false" CssClass="btn myventasbutton btn-primary" />
<asp:Button ID="BtnGenerarOS" runat="server" Text="Generar OS" Visible="false" CssClass="btn myventasbutton btn-primary" /> <asp:Button ID="BtnGenerarOS" runat="server" Text="Generar OS" Visible="false" CssClass="btn myventasbutton btn-primary" />
<asp:Button ID="BtnEditarCotizacion" runat="server" Text="Actualizar" Visible="false" CssClass="btn myventasbutton btn-primary" /> <asp:Button ID="BtnEditarCotizacion" runat="server" Text="Actualizar" Visible="false" CssClass="btn myventasbutton btn-primary" />

View File

@@ -1266,6 +1266,14 @@ Partial Class Ventas
ViewState("CveEstatusRefacturacion") = value ViewState("CveEstatusRefacturacion") = value
End Set End Set
End Property End Property
Private Property RefacturarCancelada As Boolean
Get
Return If(IsNothing(ViewState("RefacturarCancelada")), False, CBool(ViewState("RefacturarCancelada")))
End Get
Set(value As Boolean)
ViewState("RefacturarCancelada") = value
End Set
End Property
Private Property CveEstadoCancelacion As Integer Private Property CveEstadoCancelacion As Integer
Get Get
@@ -4393,10 +4401,13 @@ Partial Class Ventas
'End If 'End If
If Not CveEstatus.Contiene(4, 5, 12, 13, 20, 23) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs", "Ant") AndAlso UsuarioActual.TienePermisoProceso(159) Then If (Not CveEstatus.Contiene(4, 5, 12, 13, 20, 23) OrElse (CveEstatus = 5 AndAlso DbRowVenta("CveEstatusRefacturacion").ToString().ToEntero() = 4)) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs", "Ant") AndAlso UsuarioActual.TienePermisoProceso(159) Then
Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto"))) Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto")))
If TienePermiso <> "" Then If TienePermiso <> "" Then
LkRefacturacion.Visible = True LkRefacturacion.Visible = True
If (CveEstatus = 5 AndAlso DbRowVenta("CveEstatusRefacturacion").ToString().ToEntero() = 4) Then
RefacturarCancelada = True
End If
End If End If
End If End If
@@ -9106,6 +9117,15 @@ Partial Class Ventas
End If End If
End If End If
'MARCAR LA FACTURA ANTERIOR
If (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then
If Me.ObjFacturaNC IsNot Nothing Then
If Me.ObjFacturaNC.CveEstatusRefacturacion = 4 AndAlso Not ObjVentas.UpdateEstatusVenta(ObjFacturaNC.CveVenta, ObjFacturaNC.CveEstatusFactura, UsuarioActual.CveEmpresa, CveEstatusRefacturacion:=5) Then
ErrorList.Add("No se actualizó el estatus de la factura anterior.")
End If
End If
End If
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then
ObjVentas.Commit() ObjVentas.Commit()
@@ -9124,6 +9144,10 @@ Partial Class Ventas
AutoConta = False AutoConta = False
End If End If
If UsuarioActual.CveEmpresa = 140 Then
AutoConta = True
End If
If AutoConta Then If AutoConta Then
If idCuentaContabilizacion > 0 Then If idCuentaContabilizacion > 0 Then
If ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then If ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then
@@ -9134,13 +9158,14 @@ Partial Class Ventas
End If End If
Else Else
Alert(String.Format("Falta asignación de las siguientes cuentas contables: {0}", CuentasContablesInvalidas), TipoMensaje.MsgAdvertencia) Alert(String.Format("Falta asignación de las siguientes cuentas contables: {0}", CuentasContablesInvalidas), TipoMensaje.MsgAdvertencia)
End If
Else
If UsuarioActual.Empresa.UsaAC Then
If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
End If End If
End If End If
'If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
'RMF, cuando es pedido, se manda autorización. 'RMF, cuando es pedido, se manda autorización.
If ObjFactura.TipoDocto.Contiene("PA") Then If ObjFactura.TipoDocto.Contiene("PA") Then
@@ -9156,9 +9181,6 @@ Partial Class Ventas
ViewState("CveVenta") = ObjFactura.CveVenta ViewState("CveVenta") = ObjFactura.CveVenta
If Request("CveEmbarqueManifiesto") IsNot Nothing AndAlso IsNumeric(Request("CveEmbarqueManifiesto")) AndAlso Request("CveEmbarqueManifiesto").ToEntero() > 0 Then If Request("CveEmbarqueManifiesto") IsNot Nothing AndAlso IsNumeric(Request("CveEmbarqueManifiesto")) AndAlso Request("CveEmbarqueManifiesto").ToEntero() > 0 Then
If ObjVentas.Embarque_ManifiestoUpvta(ObjFactura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Request("CveEmbarqueManifiesto").ToEntero()) Then If ObjVentas.Embarque_ManifiestoUpvta(ObjFactura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Request("CveEmbarqueManifiesto").ToEntero()) Then
@@ -9167,7 +9189,6 @@ Partial Class Ventas
End If End If
GVAnticipos.DataBind() GVAnticipos.DataBind()
Try Try
Dim DirectoriArchivoXML As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto) ' System.IO.Path.Combine() Dim DirectoriArchivoXML As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto) ' System.IO.Path.Combine()
If Not Directory.Exists(DirectoriArchivoXML) Then If Not Directory.Exists(DirectoriArchivoXML) Then
@@ -9268,7 +9289,7 @@ Partial Class Ventas
'CANCELAR FACTURA ANTERIOR 'CANCELAR FACTURA ANTERIOR
If SeTimbro AndAlso (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then If SeTimbro AndAlso (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then
If Me.ObjFacturaNC IsNot Nothing Then If Me.ObjFacturaNC IsNot Nothing AndAlso Me.ObjFacturaNC.CveEstatusFactura <> 5 Then
Me.ObjFacturaNC.CveEstatusRefacturacion = 2 'MARCAR COMO REFACTURADA Me.ObjFacturaNC.CveEstatusRefacturacion = 2 'MARCAR COMO REFACTURADA
MsgCancelacionRefacturacion = Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, FolioFiscalFactura) MsgCancelacionRefacturacion = Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, FolioFiscalFactura)
End If End If
@@ -11975,8 +11996,13 @@ Partial Class Ventas
factura.Alfa3 = "DEV" factura.Alfa3 = "DEV"
factura.DevolucionImportePagado = ObjFacturaNC.Total / ObjFacturaNC.PagadoBancos 'falta tomar el dato factura.DevolucionImportePagado = ObjFacturaNC.Total / ObjFacturaNC.PagadoBancos 'falta tomar el dato
End If End If
Dim tCvePlantillaPoliza As Integer = factura.CvePlantillaPoliza
factura.CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardarVenta", factura.CvePlantillaPoliza, factura.Total, factura.Total, factura.CveMoneda, factura.Fecha, If(CveEmpresaCRM > 0, LblEmpresaCRM.Text, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa) If UsuarioActual.CveEmpresa = 140 Then
tCvePlantillaPoliza = 1 ' que sea siempre ingreso.
End If
factura.CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardarVenta", tCvePlantillaPoliza, factura.Total, factura.Total, factura.CveMoneda, factura.Fecha, If(CveEmpresaCRM > 0, LblEmpresaCRM.Text, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa)
Dim RFCReceptor As String = "" Dim RFCReceptor As String = ""
@@ -12162,9 +12188,33 @@ Partial Class Ventas
'Si es devolucion se agregan a la tabla de Vta_VentasDetalleDevolucion 'Si es devolucion se agregan a la tabla de Vta_VentasDetalleDevolucion
If factura.AplicaDevolucion Then If factura.AplicaDevolucion Then
If Not ObjVentas.AddVentaDetalleDevolucion(Row("CveVentaDetalle").ToString().ToEntero(), ObjVentas.CveVentaDetalle, Row("Cantidad").ToString().ToDouble) Then Try
Dim EsCargo As Integer = If(Row("EsCargo").ToString() = "True", 1, 0)
If EsCargo = 1 Then
If Me.ObjFacturaNC IsNot Nothing Then
Dim CveVentaDetalleUsado As Integer = -1
For Each RowIng As DataRow In Me.ObjFacturaNC.DtDetalle.Rows
If RowIng("Cantidad").ToString().ToDecimal() = Row("Cantidad").ToString().ToDecimal() AndAlso RowIng("CvePS").ToString().ToEntero() = Row("CvePS").ToString().ToEntero() Then
CveVentaDetalleUsado = RowIng("CveVentaDetalle").ToString().ToEntero()
Exit For
End If
Next
If CveVentaDetalleUsado > 0 Then
If Not ObjVentas.AddVentaDetalleDevolucion(CveVentaDetalleUsado, ObjVentas.CveVentaDetalle, Row("Cantidad").ToString().ToDouble) Then
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
End If
End If
End If
Else
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 devolución.")
End If
End If
Catch ex As Exception
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.") ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
End If End Try
If ErrorList.Count = 0 Then 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 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.") ErrorList.Add("Ocurrió un error al agregar la bitacora de devolución.")
@@ -20881,129 +20931,134 @@ Partial Class Ventas
'End Sub 'End Sub
Private Sub BtnNuevaFactura_Click(sender As Object, e As EventArgs) Handles LkRefacturacion.Click Private Sub BtnNuevaFactura_Click(sender As Object, e As EventArgs) Handles LkRefacturacion.Click
'Nos vamos a la nueva factura 'Nos vamos a la nueva factura
Dim script As String = "" If RefacturarCancelada Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1")
Dim sb As New StringBuilder() Else
Dim script As String = ""
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
Dim sb As New StringBuilder()
If Not String.IsNullOrEmpty(FolioFiscal) AndAlso Not (UsuarioActual.Empresa.Funcionalidad(529) = "1") Then If Not String.IsNullOrEmpty(FolioFiscal) AndAlso Not (UsuarioActual.Empresa.Funcionalidad(529) = "1") Then
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>") sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
Dim RFCReceptor As String = LblRFC.Text.Trim Dim RFCReceptor As String = LblRFC.Text.Trim
'SI SE FACTURO LA SUCURSAL DEL CLIENTE TOMA EL RFC DE ESTA 'SI SE FACTURO LA SUCURSAL DEL CLIENTE TOMA EL RFC DE ESTA
If FacturarSucursal AndAlso Me.ClienteSucursal IsNot Nothing Then If FacturarSucursal AndAlso Me.ClienteSucursal IsNot Nothing Then
RFCReceptor = Me.ClienteSucursal.RFC RFCReceptor = Me.ClienteSucursal.RFC
End If End If
Dim SWatch As New Stopwatch Dim SWatch As New Stopwatch
SWatch.Start() SWatch.Start()
Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True) Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True)
SWatch.Stop() SWatch.Stop()
Dim SegundosRespuesta As Double = SWatch.ElapsedMilliseconds / 1000 Dim SegundosRespuesta As Double = SWatch.ElapsedMilliseconds / 1000
SegundosRespuesta = SegundosRespuesta.ToEntero SegundosRespuesta = SegundosRespuesta.ToEntero
If SegundosRespuesta >= 5 Then If SegundosRespuesta >= 5 Then
Alert($"Los servicios de validacion del SAT presentan lentitud en la respuesta [{ SegundosRespuesta } s].", TipoMensaje.ToastError, "") Alert($"Los servicios de validacion del SAT presentan lentitud en la respuesta [{ SegundosRespuesta } s].", TipoMensaje.ToastError, "")
End If End If
If Vigencia IsNot Nothing Then If Vigencia IsNot Nothing Then
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable) sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable)
DivRelacionadasRefacturacion.Visible = True DivRelacionadasRefacturacion.Visible = True
BtnMotivoRefacturacion.Visible = False BtnMotivoRefacturacion.Visible = False
DivMotivoRefacturacionTexto.Visible = False DivMotivoRefacturacionTexto.Visible = False
Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion)
If Relacionados IsNot Nothing Then If Relacionados IsNot Nothing Then
Dim sbExtra As New StringBuilder() Dim sbExtra As New StringBuilder()
If Relacionados.Codigo = 500 Then If Relacionados.Codigo = 500 Then
sbExtra.Append("El servicio de verificación de documentos relacionados no esta disponible.") sbExtra.Append("El servicio de verificación de documentos relacionados no esta disponible.")
Else Else
sbExtra.Append(Relacionados.Mensaje) sbExtra.Append(Relacionados.Mensaje)
Dim SbHijos = New StringBuilder() Dim SbHijos = New StringBuilder()
Dim SbPadres = New StringBuilder() Dim SbPadres = New StringBuilder()
'If Relacionados.RelacionadosHijo IsNot Nothing Then 'If Relacionados.RelacionadosHijo IsNot Nothing Then
' For Each hijo In Relacionados.RelacionadosHijo ' For Each hijo In Relacionados.RelacionadosHijo
' SbHijos.AppendFormat("{0};", hijo.Uuid) ' SbHijos.AppendFormat("{0};", hijo.Uuid)
' Next ' Next
' If SbHijos.Length > 0 Then ' If SbHijos.Length > 0 Then
' SbHijos.Remove(SbHijos.Length - 1, 1) ' SbHijos.Remove(SbHijos.Length - 1, 1)
' End If
'End If
If Relacionados.RelacionadosPadre IsNot Nothing Then
For Each padre In Relacionados.RelacionadosPadre
SbPadres.AppendFormat("{0};", padre.Uuid)
Next
If SbPadres.Length > 0 Then
SbPadres.Remove(SbPadres.Length - 1, 1)
End If
End If
Using ObjVentas As New ClsVentas
'If SbHijos.Length > 0 Then
' If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbHijos.ToString(), UsuarioActual.CveEmpresa) Then
' GvFacturasHijosCancelar.DataSource = ObjVentas.DtResultados.Copy()
' End If ' End If
'End If 'End If
If SbPadres.Length > 0 Then If Relacionados.RelacionadosPadre IsNot Nothing Then
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then For Each padre In Relacionados.RelacionadosPadre
GvFacturasPadreRefacturar.DataSource = ObjVentas.DtResultados.FiltraParametros($"CveVenta <> {CveVenta}") SbPadres.AppendFormat("{0};", padre.Uuid)
Next
If SbPadres.Length > 0 Then
SbPadres.Remove(SbPadres.Length - 1, 1)
End If End If
End If End If
End Using Using ObjVentas As New ClsVentas
'If SbHijos.Length > 0 Then
' If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbHijos.ToString(), UsuarioActual.CveEmpresa) Then
' GvFacturasHijosCancelar.DataSource = ObjVentas.DtResultados.Copy()
' End If
'End If
If SbPadres.Length > 0 Then
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then
GvFacturasPadreRefacturar.DataSource = ObjVentas.DtResultados.FiltraParametros($"CveVenta <> {CveVenta}")
End If
End If
End Using
'GvFacturasHijosCancelar.DataBind()
GvFacturasPadreRefacturar.DataBind()
End If
If sbExtra.Length > 0 Then
LbExtraRefacturacion.Text = $"<br><b>*{sbExtra.ToString()}</b>"
End If
'GvFacturasHijosCancelar.DataBind()
GvFacturasPadreRefacturar.DataBind()
End If End If
If sbExtra.Length > 0 Then
LbExtraRefacturacion.Text = $"<br><b>*{sbExtra.ToString()}</b>"
End If
End If End If
End If
If Vigencia.EsCancelable = "Cancelable sin aceptación" Then If Vigencia.EsCancelable = "Cancelable sin aceptación" Then
'script = "BtnRefacturacionConfirmarAceptacion();" 'script = "BtnRefacturacionConfirmarAceptacion();"
Me.CveEstadoCancelacion = 1 Me.CveEstadoCancelacion = 1
sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable) sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable)
sb.Append("Está seguro de realizar la refacturación?.") sb.Append("Está seguro de realizar la refacturación?.")
End If End If
If Vigencia.EsCancelable = "Cancelable con aceptación" OrElse String.IsNullOrEmpty(Vigencia.EsCancelable) Then If Vigencia.EsCancelable = "Cancelable con aceptación" OrElse String.IsNullOrEmpty(Vigencia.EsCancelable) Then
'script = "BtnRefacturacionConfirmar();" 'script = "BtnRefacturacionConfirmar();"
Me.CveEstadoCancelacion = 2 Me.CveEstadoCancelacion = 2
sb.AppendFormat("<b>{0}</b> <br/>", "Cancelable con aceptación") sb.AppendFormat("<b>{0}</b> <br/>", "Cancelable con aceptación")
sb.Append("Está seguro de cancelar el documento para realizar la refacturación?.") sb.Append("Está seguro de cancelar el documento para realizar la refacturación?.")
End If
Else
'If Not UsuarioActual.Empresa.FacturaProduccion Then
' script = "BtnRefacturacionConfirmar();"
'End If
sb.Append("<b>No encontrado</b> <br/>")
End If End If
Else Else
'If Not UsuarioActual.Empresa.FacturaProduccion Then 'sb.Append("¿Desea realizar la refacturación?<br/>")
' script = "BtnRefacturacionConfirmar();" script = "BtnRefacturacionConfirmarAceptacion();"
'End If
sb.Append("<b>No encontrado</b> <br/>")
End If End If
Else
'sb.Append("¿Desea realizar la refacturación?<br/>") LblEstatusRefacturacion.Text = sb.ToString()
script = "BtnRefacturacionConfirmarAceptacion();" UpMotivoRefac.Update()
RegistraScript("$('#DivMotivoRefacturacion').modal({ backdrop: 'static', keyboard: false });", "R1")
'Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, JSBtnAceptar:=script, TextoConfirmacion:="&nbsp;&nbsp;&nbsp;&nbsp;Si&nbsp;&nbsp;&nbsp;&nbsp;", TextoCancelacion:="&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;")
End If End If
LblEstatusRefacturacion.Text = sb.ToString()
UpMotivoRefac.Update()
RegistraScript("$('#DivMotivoRefacturacion').modal({ backdrop: 'static', keyboard: false });", "R1")
'Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, JSBtnAceptar:=script, TextoConfirmacion:="&nbsp;&nbsp;&nbsp;&nbsp;Si&nbsp;&nbsp;&nbsp;&nbsp;", TextoCancelacion:="&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;")
End If End If
End Sub End Sub
Private Sub BtnMotivoRefacturacion_Click(sender As Object, e As System.EventArgs) Handles BtnMotivoRefacturacion.Click Private Sub BtnMotivoRefacturacion_Click(sender As Object, e As System.EventArgs) Handles BtnMotivoRefacturacion.Click
@@ -21753,7 +21808,7 @@ Partial Class Ventas
DdlCuentaCheque.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) DdlCuentaCheque.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero())))
End If End If
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then If UsuarioActual.Empresa.Funcionalidad(558) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
DdlCuentaTarjetaCredito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) DdlCuentaTarjetaCredito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero())))
DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero())))
Else Else
@@ -29656,6 +29711,11 @@ Partial Class Ventas
CargaVendedores() CargaVendedores()
If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso Not TbDescuentosRNC.Visible Then
TbDescuentosRNC.Visible = True
LnkDescuentosRNC.Visible = UsuarioActual.TienePermisoProceso(328)
End If
UpPS.Update() UpPS.Update()
UPPDescuento.Update() UPPDescuento.Update()
UPObservaciones.Update() UPObservaciones.Update()
@@ -31529,6 +31589,11 @@ Partial Class Ventas
End Function End Function
Private Sub EmitirDocumentoNuevo(TipoDoctoNuevo As String) Private Sub EmitirDocumentoNuevo(TipoDoctoNuevo As String)
If DdlVendedor.SelectedValue.ToEntero() <= 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso TipoDoctoNuevo = "Ing" Then
Alert("Debe seleccionar un vendedor.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If (FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso String.IsNullOrEmpty(Me.ClienteSucursal.RFC))) Then If (FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso String.IsNullOrEmpty(Me.ClienteSucursal.RFC))) Then
Alert("La sucursal no tiene asignada un RFC.", TipoMensaje.MsgAdvertencia) Alert("La sucursal no tiene asignada un RFC.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
@@ -34374,5 +34439,38 @@ Partial Class Ventas
UpEmitirTransitorio.Update() UpEmitirTransitorio.Update()
End Sub End Sub
#End Region #End Region
Protected Sub BtnGenerarPoliza_Click(sender As Object, e As EventArgs)
CreaObjetosVenta()
Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa)
Dim Msgok As New StringBuilder
If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "OP", "Com") Then
Dim IDPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjAC, ObjFactura)
If IDPoliza.IdPoliza > 0 Then
Dim ObjVentas As New ClsVentas
If ObjVentas.UpdateVentaPrePoliza(IDPoliza.IdPoliza, IDPoliza.FolioPoliza, CvePrePoliza, CveVenta, UsuarioActual.CveEmpresa) Then
'Si se facturó la cotización hay que vincular la venta
Msgok.AppendFormat("Abono Registrado Correctamente.<br/><br/> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a>", IDPoliza)
End If
ObjVentas.Dispose()
'Si se facturó la cotización hay que vincular la venta
Msgok.AppendFormat("Abono Registrado Correctamente.<br/><br/> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a>", IDPoliza)
Else
ErrorList.Add("Ocurrió un error al generar A.C. en la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If
Else
Msgok.Append("Movimiento Registrado Correctamente.<br/><br/> ")
End If
ObjAC.dispose
End Sub
End Class End Class