diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb index a2a007864..628310288 100644 --- a/App_Code/ClsOC.vb +++ b/App_Code/ClsOC.vb @@ -33,7 +33,7 @@ Public Class ClsOC Public Property CveIEAnticipo As Integer Public Property CveProveedorAnticipo As Integer Public Property FolioIEAnticipo As Integer - Public Property ImporteAnticipo As Double + Public Property ImporteAnticipo As Decimal Public Property FolioAdicional As String Public Property EntregaDirecta As Boolean @@ -79,16 +79,16 @@ Public Class ClsOC Public Property RFC As String Public Property LugarEntrega As String Public Property Cancelacion As String - Public Property PorcentajeIVA As Double + Public Property PorcentajeIVA As Decimal Public Property CveCliente As Integer Public Property CveVendedor As Integer Public Property PrioridadObservacion As String - Public Property SubTotal As Double - Public Property IVA As Double - Public Property RetIVA As Double - Public Property RetISR As Double - Public Property IEPS As Double - Public Property Total As Double + Public Property SubTotal As Decimal + Public Property IVA As Decimal + Public Property RetIVA As Decimal + Public Property RetISR As Decimal + Public Property IEPS As Decimal + Public Property Total As Decimal Public Property CvePresupuestoEgreso As Integer Public Property RequiereCotizacion As Boolean Public Property CveActivoFijo As Integer @@ -98,8 +98,8 @@ Public Class ClsOC Public Property SubProyecto As String Public Property UsuarioSolicito As String Public Property UsuarioAutorizo As String - Public Property Descuento As Double - Public Property Pendiente As Double + Public Property Descuento As Decimal + Public Property Pendiente As Decimal Public Property NombreCliente As String Public Property SucCalle As String Public Property SucNoExt As String @@ -274,7 +274,7 @@ Public Class ClsOC Extension = Data.Rows(0)("Extension").ToString Usuario = Data.Rows(0)("Usuario").ToString 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 @@ -416,7 +416,7 @@ Public Class ClsOC Return Retorno 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 DataAdapter("PA_OC_CotizacionesDetalleAdd") @@ -425,9 +425,9 @@ Public Class ClsOC .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion .Add("@CvePS", SqlDbType.Int).Value = pCvePS .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("@CantidadSurtir", SqlDbType.Float).Value = pCantidadSurtir + .Add("@CantidadSurtir", SqlDbType.Decimal).Value = pCantidadSurtir .Add("@FechaEntrega", SqlDbType.VarChar).Value = pFechaEntrega .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle @@ -452,14 +452,14 @@ Public Class ClsOC Return Retorno 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 DataAdapter("PA_OC_CotizacionesDetalleUpdate") With SqlAdapter.SelectCommand.Parameters .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("@Observacion", SqlDbType.VarChar).Value = pObservacion .Add("@CveCotizacionDetalle", SqlDbType.Int).Value = pCveCotizacionDetalle @@ -546,107 +546,6 @@ Public Class ClsOC End Function #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" Public Function GetOC(ObjOrdenCompra As Modelos.OrdenCompra) As Boolean @@ -707,7 +606,7 @@ Public Class ClsOC _Folio = dr("Folio").ToString.ToEntero _CveIEAnticipo = dr("CveIEAnticipo").ToString.ToEntero _FolioIEAnticipo = dr("FolioIEAnticipo").ToString.ToEntero - _ImporteAnticipo = dr("ImporteAnticipo").ToString.ToDouble + _ImporteAnticipo = dr("ImporteAnticipo").ToString.ToDecimal _CveProveedorAnticipo = dr("CveProveedorAnticipo").ToString.ToEntero _CveEmpresa = dr("CveEmpresa").ToString.ToEntero _CveProyecto = dr("CveProyecto").ToString.ToEntero @@ -752,32 +651,15 @@ Public Class ClsOC Me.SucursalTelefono = If(Not IsDBNull(dr("TelefonoSucursal")), dr("TelefonoSucursal").ToString, "") ProveedorContacto = dr("ContactoNombre").ToString - PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDouble - SubTotal = dr("SubTotal").ToString.ToDouble - Descuento = dr("Descuento").ToString.ToDouble - IVA = dr("IVA").ToString.ToDouble - RetIVA = dr("RetIVA").ToString.ToDouble - RetISR = dr("RetISR").ToString.ToDouble - IEPS = dr("IEPS").ToString.ToDouble - Total = dr("Total").ToString.ToDouble - Pendiente = dr("Pendiente").ToString.ToDouble - '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 + PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal + SubTotal = dr("SubTotal").ToString.ToDecimal + Descuento = dr("Descuento").ToString.ToDecimal + IVA = dr("IVA").ToString.ToDecimal + RetIVA = dr("RetIVA").ToString.ToDecimal + RetISR = dr("RetISR").ToString.ToDecimal + IEPS = dr("IEPS").ToString.ToDecimal + Total = dr("Total").ToString.ToDecimal + Pendiente = dr("Pendiente").ToString.ToDecimal 'RequiereCotizacion = CType(dr("RequiereCotizacion"), Boolean) 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, 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 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 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 DataAdapter("PA_OC_OrdenesCompraAdd") @@ -971,7 +853,7 @@ Public Class ClsOC Return Retorno 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 DataAdapter("PA_OC_OrdenesCompraDetalleAjusteUpdate") 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 = "", 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 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 DataAdapter("PA_OC_OrdenesCompraUpdate") @@ -1266,18 +1148,18 @@ Public Class ClsOC Return Retorno 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, - pObservacion As String, pCveUsuario As Integer, Optional pCveOrdenCompraPadre As Integer = -1, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 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 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 IEPSPSIVAPorcentaje As Double = 0, Optional CveVentaDetalleCotizacion As Integer = -1, Optional CveTipoGastoObra As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1) As Boolean + 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 Decimal = 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 Decimal = 0, Optional RetIVAPorcentaje As Decimal = 0, Optional RetISRPorcentaje As Decimal = 0, Optional IEPSPSPorcentaje As Decimal = 0, + 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 DataAdapter("PA_OC_OrdenesCompraDetalleAdd") With SqlAdapter.SelectCommand.Parameters .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@Cantidad", SqlDbType.Float).Value = pCantidad - .Add("@Descuento", SqlDbType.Float).Value = Descuento + .Add("@Cantidad", SqlDbType.Decimal).Value = pCantidad + .Add("@Descuento", SqlDbType.Decimal).Value = Descuento .Add("@Importe", SqlDbType.Float).Value = pImporte .Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida .Add("@CvePS", SqlDbType.Int).Value = pCvePS @@ -1290,16 +1172,16 @@ Public Class ClsOC .Add("@vCveOrdenCompraDetalle", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS .Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA - .Add("@IVA", SqlDbType.Float).Value = IVA - .Add("@RetIVA", SqlDbType.Float).Value = RetIVA - .Add("@RetISR", SqlDbType.Float).Value = RetISR - .Add("@Total", SqlDbType.Float).Value = Total + .Add("@IVA", SqlDbType.Decimal).Value = IVA + .Add("@RetIVA", SqlDbType.Decimal).Value = RetIVA + .Add("@RetISR", SqlDbType.Decimal).Value = RetISR + .Add("@Total", SqlDbType.Decimal).Value = Total .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle - .Add("@IVAPorcentaje", SqlDbType.Float).Value = IVAPorcentaje - .Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje - .Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje - .Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje - .Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje + .Add("@IVAPorcentaje", SqlDbType.Decimal).Value = IVAPorcentaje + .Add("@RetIVAPorcentaje", SqlDbType.Decimal).Value = RetIVAPorcentaje + .Add("@RetISRPorcentaje", SqlDbType.Decimal).Value = RetISRPorcentaje + .Add("@IEPSPSPorcentaje", SqlDbType.Decimal).Value = IEPSPSPorcentaje + .Add("@IEPSPSIVAPorcentaje", SqlDbType.Decimal).Value = IEPSPSIVAPorcentaje .Add("@CveVentaDetalleCotizacion", SqlDbType.Int).Value = CveVentaDetalleCotizacion .Add("@CveTipoGastoObra", SqlDbType.Int).Value = CveTipoGastoObra .Add("@CveCultivoCuadroDetalle", SqlDbType.Int).Value = CveCultivoCuadroDetalle @@ -1322,11 +1204,11 @@ Public Class ClsOC Return Retorno End Function - Public Function UpdateOrdenCompraDetalle(pCantidad As Double, pCveUnidadMedida As Integer, pCvePS As Integer, pImporte As Double, 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, - 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 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 IEPSPSIVAPorcentaje As Double = 0, Optional CveTipoGastoObra As Integer = -1) 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 Decimal = 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 Decimal = 0, Optional RetIVAPorcentaje As Decimal = 0, Optional RetISRPorcentaje As Decimal = 0, Optional IEPSPSPorcentaje As Decimal = 0, + Optional IEPSPSIVAPorcentaje As Decimal = 0, Optional CveTipoGastoObra As Integer = -1) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_OC_OrdenesCompraDetalleUpdate") @@ -1336,8 +1218,8 @@ Public Class ClsOC .Add("@Cantidad", SqlDbType.Float).Value = pCantidad .Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida .Add("@CvePS", SqlDbType.Int).Value = pCvePS - .Add("@Descuento", SqlDbType.Float).Value = Descuento - .Add("@Importe", SqlDbType.Float).Value = pImporte + .Add("@Descuento", SqlDbType.Decimal).Value = Descuento + .Add("@Importe", SqlDbType.Decimal).Value = pImporte .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle .Add("@CveActivoFijo", SqlDbType.Int).Value = pCveActivoFijo @@ -1346,16 +1228,16 @@ Public Class ClsOC .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario .Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS .Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA - .Add("@IVA", SqlDbType.Float).Value = IVA - .Add("@RetIVA", SqlDbType.Float).Value = RetIVA - .Add("@RetISR", SqlDbType.Float).Value = RetISR - .Add("@Total", SqlDbType.Float).Value = Total + .Add("@IVA", SqlDbType.Decimal).Value = IVA + .Add("@RetIVA", SqlDbType.Decimal).Value = RetIVA + .Add("@RetISR", SqlDbType.Decimal).Value = RetISR + .Add("@Total", SqlDbType.Decimal).Value = Total .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle - .Add("@IVAPorcentaje", SqlDbType.Float).Value = IVAPorcentaje - .Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje - .Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje - .Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje - .Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje + .Add("@IVAPorcentaje", SqlDbType.Decimal).Value = IVAPorcentaje + .Add("@RetIVAPorcentaje", SqlDbType.Decimal).Value = RetIVAPorcentaje + .Add("@RetISRPorcentaje", SqlDbType.Decimal).Value = RetISRPorcentaje + .Add("@IEPSPSPorcentaje", SqlDbType.Decimal).Value = IEPSPSPorcentaje + .Add("@IEPSPSIVAPorcentaje", SqlDbType.Decimal).Value = IEPSPSIVAPorcentaje .Add("@CveTipoGastoObra", SqlDbType.Int).Value = CveTipoGastoObra End With @@ -2412,7 +2294,7 @@ Public Class ClsOC Return Retorno 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 DataAdapter("PA_OC_SolicitudAnticipoAdd") @@ -2496,16 +2378,16 @@ Public Class ClsOC End Function #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 DataAdapter("OC_OrdenesCompraDetalleSaldosInvCompraAdd") With SqlAdapter.SelectCommand.Parameters .Add("@CveOCDetalle", SqlDbType.Int).Value = CveOCDetalle .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("@CantidadVinculada", SqlDbType.Float).Value = CantidadVinculada + .Add("@CantidadVinculada", SqlDbType.Decimal).Value = CantidadVinculada End With Try diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index ae57244f9..21be0f560 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -838,7 +838,7 @@ Public Class ClsVentas Return Retorno 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 DataAdapter("PA_Vta_VentasEstatusUpdate") @@ -848,6 +848,8 @@ Public Class ClsVentas .Add("@CveEstatusFactura", SqlDbType.Int).Value = CveEstatusFactura .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Num2", SqlDbType.Float).Value = Num2 + .Add("@CveEstatusRefacturacion", SqlDbType.Int).Value = CveEstatusRefacturacion + .Add("@CveMotivoCancelacion", SqlDbType.Int).Value = CveMotivoCancelacion End With Try diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index b49be482e..e6fbe82fd 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -4845,7 +4845,8 @@ Namespace Modelos End If '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 End If diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx index abcf5dcf1..028df676e 100644 --- a/Bancos/DepositosCaja.aspx +++ b/Bancos/DepositosCaja.aspx @@ -562,8 +562,8 @@ function txtSumaTntermediario(txt) { var comision2 = ToDouble($('#C_TxtComisionIntermediario').val()); if (comision2 > ValorTotalSeleccionado) { - $('#C_TxtComisionIntermediario').val(ComisionIntermediario); - alert("No es posible poner un importe superior a lo seleccionado"); + //$('#C_TxtComisionIntermediario').val(ComisionIntermediario); + //alert("No es posible poner un importe superior a lo seleccionado"); } else { saldo = ValorTotalSeleccionado - descuento + comision - comision2 - IVA; $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 52bbddd73..399a06781 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -2149,18 +2149,8 @@ Partial Class Compras_Compras Private Sub CargaRetIVAConcepto(Optional Cambio As Boolean = False) - - - - If TrRetIVA.Visible Then TdRetIVAConcepto.Visible = True - - - - - - End If If Cambio Then @@ -2174,15 +2164,12 @@ Partial Class Compras_Compras End If DdlRetIVAConcepto.Items.Add(New ListItem("Arrendamiento", "4")) - - 'If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then - DdlRetIVAConcepto.Items.Add(New ListItem("Ret IVA Servicios", "5")) - 'End If - + ''If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then + 'DdlRetIVAConcepto.Items.Add(New ListItem("Ret IVA Servicios", "5")) + ''End If End If - UpPS.Update() End Sub @@ -5262,7 +5249,7 @@ Partial Class Compras_Compras '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 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 Exit For End If diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 70fed873b..e18d8db03 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1011,14 +1011,17 @@ Partial Class PopUpVerFactura Dim Usuario As String = $" Usuario: {Nombre}" 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 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) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("AgrupoPor", $"{FechaCorte}{Usuario}")) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", LogoRuta)) Else params.Add(New ReportParameter("LogoPath", "")) End If @@ -1124,7 +1127,7 @@ Partial Class PopUpVerFactura 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 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 ObjContratos As New ClsContratos @@ -1158,7 +1161,9 @@ Partial Class PopUpVerFactura End If params.Add(New ReportParameter("Utilidad", $"$ {(SumaUtilidad - SumaGasto).ToString.FormatoNumero()}")) 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 params.Add(New ReportParameter("LogoPath", "")) End If @@ -1306,14 +1311,9 @@ Partial Class PopUpVerFactura If Dt.Rows.Count > 0 Then Dim params As New List(Of ReportParameter) 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) - - If Imagen.Exists Then params.Add(New ReportParameter("LogoPath", LogoRuta)) Else @@ -1733,7 +1733,7 @@ Partial Class PopUpVerFactura If DtConceptos.Rows.Count > 0 Then Dim params As New List(Of ReportParameter) 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 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("Responsable", Personal)) 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) - params.Add(New ReportParameter("LogoPath", logouri)) + 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + 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 params.Add(New ReportParameter("MostrarSerieLote", "1")) Else @@ -3336,8 +3343,14 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("NombreEntrego", Capturo.ToUpper)) params.Add(New ReportParameter("Responsable", 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) - params.Add(New ReportParameter("LogoPath", logouri)) + 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + 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 params.Add(New ReportParameter("MostrarSerieLote", "1")) Else @@ -4775,7 +4788,8 @@ Partial Class PopUpVerFactura End If 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 params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) @@ -4783,7 +4797,8 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) 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 params.Add(New ReportParameter("LogoPath", "")) End If @@ -4979,10 +4994,9 @@ Partial Class PopUpVerFactura ObjAF.Dispose() 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 - params.Add(New ReportParameter("LogoPath", logouri)) + Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName) + params.Add(New ReportParameter("LogoPath", LogoRuta)) Else params.Add(New ReportParameter("LogoPath", "")) End If @@ -6070,7 +6084,9 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("CodigoTD", CodigoTD)) 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 params.Add(New ReportParameter("LogoPath", "")) End If @@ -6128,7 +6144,7 @@ Partial Class PopUpVerFactura ObjPS.Dispose() 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 params As New List(Of ReportParameter) @@ -6207,7 +6223,9 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("CodigoTD", CodigoTD)) 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 params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index e5bf7f1a8..d3aa6c1f6 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1777,7 +1777,7 @@ Partial Class Inventarios_EntradasSalidas If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True TipoMovtoOtro = Not TipoMovtoAlmacen - Dim CveConceptoContable As Integer = 78 + Dim CveConceptoContable As Integer = 260 Dim CveClasificacion As Integer = -1 Select Case DdlConcepto.SelectedValue.ToEntero Case 28, 31 diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 39c4acfad..2c7a86278 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -533,11 +533,7 @@ Partial Class Inventarios_RecepcionAlmacen Private Sub CargaAlmacenes(CveSubProyecto As Integer, Optional CveTiposAlmacen As String = "", Optional CveTipoCompra As Integer = -1) Dim StrAlmacenes As String = "" - If UsuarioActual.CveSubProyecto = 8804 Then 'AGS - 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 + StrAlmacenes = $"CveTipoAlmacen IN ({If(CveTiposAlmacen.Length > 0, CveTiposAlmacen, "1,2,15,14,19")}) {If(CveSubProyecto > 0, $"And CveSubProyecto = {CveSubProyecto}", "")}" If CveTipoCompra = 10 Then StrAlmacenes = $"Modalidad = 0" @@ -3693,7 +3689,7 @@ Partial Class Inventarios_RecepcionAlmacen If Not ErrorMovInv And CveOCSurtir > 0 Then If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then 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 Exit For End If diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index d9425c0b0..ea04c720e 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -518,32 +518,32 @@ Partial Class OC Private Property NumRow As Integer - Private Property SaldoOCAnticipo As Double + Private Property SaldoOCAnticipo As Decimal Get If ViewState("SaldoOCAnticipo") Is Nothing Then Return 0 Else - Return ViewState("SaldoOCAnticipo").ToString.ToDouble + Return ViewState("SaldoOCAnticipo").ToString.ToDecimal End If End Get - Set(value As Double) + Set(value As Decimal) ViewState("SaldoOCAnticipo") = value End Set End Property - Private Property ImporteAnticipos As Double + Private Property ImporteAnticipos As Decimal Get If ViewState("ImporteAnticipos") Is Nothing Then Return 0 Else - Return ViewState("ImporteAnticipos").ToString.ToDouble + Return ViewState("ImporteAnticipos").ToString.ToDecimal End If End Get - Set(value As Double) + Set(value As Decimal) ViewState("ImporteAnticipos") = value End Set End Property @@ -924,18 +924,18 @@ Partial Class OC Exit Sub End If - If Math.Round(DdlIVA.SelectedValue.ToDouble, 2) = 1 Then + If Math.Round(DdlIVA.SelectedValue.ToDecimal, 2) = 1 Then Alert("Para aplicar un IVA, debe de seleccionar un porcentaje en el combo de IVA.", TipoMensaje.MsgAdvertencia) TxtIVA.Text = "0.00" CalculaGenerales() Exit Sub End If - Dim Total As Double = 0 + Dim Total As Decimal = 0 For Each Dr As DataRow In DtDetalle.Rows Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=Dr("CvePS").ToString.ToEntero).FiltroPrimero("") If DrPS IsNot Nothing AndAlso DrPS("IVA").ToString.ToEntero = -1 Then - Total += Dr("Total").ToString.ToDouble + Total += Dr("Total").ToString.ToDecimal End If Next @@ -1056,21 +1056,21 @@ Partial Class OC Private Sub CreaDTDetalles() DtDetalle = New DataTable - DtDetalle.Columns.Add("Cantidad", GetType(Double)) + DtDetalle.Columns.Add("Cantidad", GetType(Decimal)) DtDetalle.Columns.Add("CveUnidadMedida", GetType(Integer)) DtDetalle.Columns.Add("UM", GetType(String)) DtDetalle.Columns.Add("CvePS", GetType(Integer)) DtDetalle.Columns.Add("PS", GetType(String)) - DtDetalle.Columns.Add("IVA", GetType(Double)) - DtDetalle.Columns.Add("IVAPorcentaje", GetType(Double)) - DtDetalle.Columns.Add("IEPSPS", GetType(Double)) - DtDetalle.Columns.Add("IEPSPSPorcentaje", GetType(Double)) - DtDetalle.Columns.Add("IEPSPSIVA", GetType(Double)) - DtDetalle.Columns.Add("IEPSPSIVAPorcentaje", GetType(Double)) - DtDetalle.Columns.Add("RetIVA", GetType(Double)) - DtDetalle.Columns.Add("RetIVAPorcentaje", GetType(Double)) - DtDetalle.Columns.Add("RetISR", GetType(Double)) - DtDetalle.Columns.Add("RetISRPorcentaje", GetType(Double)) + DtDetalle.Columns.Add("IVA", GetType(Decimal)) + DtDetalle.Columns.Add("IVAPorcentaje", GetType(Decimal)) + DtDetalle.Columns.Add("IEPSPS", GetType(Decimal)) + DtDetalle.Columns.Add("IEPSPSPorcentaje", GetType(Decimal)) + DtDetalle.Columns.Add("IEPSPSIVA", GetType(Decimal)) + DtDetalle.Columns.Add("IEPSPSIVAPorcentaje", GetType(Decimal)) + DtDetalle.Columns.Add("RetIVA", GetType(Decimal)) + DtDetalle.Columns.Add("RetIVAPorcentaje", GetType(Decimal)) + DtDetalle.Columns.Add("RetISR", GetType(Decimal)) + DtDetalle.Columns.Add("RetISRPorcentaje", GetType(Decimal)) DtDetalle.Columns.Add("Observacion", GetType(String)) DtDetalle.Columns.Add("CveClasificacion", GetType(Integer)) DtDetalle.Columns.Add("Clasificacion", GetType(String)) @@ -1081,9 +1081,9 @@ Partial Class OC DtDetalle.Columns.Add("Proyecto", GetType(String)) DtDetalle.Columns.Add("CveSubProyecto", GetType(Integer)) DtDetalle.Columns.Add("SubProyecto", GetType(String)) - DtDetalle.Columns.Add("Importe", GetType(Double)) - DtDetalle.Columns.Add("Descuento", GetType(Double)) - DtDetalle.Columns.Add("Total", GetType(Double)) + DtDetalle.Columns.Add("Importe", GetType(Decimal)) + DtDetalle.Columns.Add("Descuento", GetType(Decimal)) + DtDetalle.Columns.Add("Total", GetType(Decimal)) DtDetalle.Columns.Add("Codigo", GetType(String)) DtDetalle.Columns.Add("CodigoAF", GetType(String)) @@ -1112,7 +1112,7 @@ Partial Class OC DtDetalle.Columns.Add("CveProveedor", GetType(Integer)) DtDetalle.Columns.Add("CveContratoDetalle", GetType(Integer)) - DtDetalle.Columns.Add("CantidadNoEditable", GetType(Double)) + DtDetalle.Columns.Add("CantidadNoEditable", GetType(Decimal)) DtDetalle.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer)) @@ -1146,15 +1146,15 @@ Partial Class OC dr("CvePS") = RowV("CvePS") dr("PS") = RowV("CodigoPS") dr("IVA") = 0 - dr("IVAPorcentaje") = DrPS("IVA").ToString.ToDouble + dr("IVAPorcentaje") = DrPS("IVA").ToString.ToDecimal dr("RetIVA") = 0 - dr("RetIVAPorcentaje") = DrPS("RetIVA").ToString.ToDouble + dr("RetIVAPorcentaje") = DrPS("RetIVA").ToString.ToDecimal dr("RetISR") = 0 - dr("RetISRPorcentaje") = DrPS("RetISR").ToString.ToDouble + dr("RetISRPorcentaje") = DrPS("RetISR").ToString.ToDecimal dr("IEPSPS") = 0 - dr("IEPSPSPorcentaje") = DrPS("IEPSPorcentaje").ToString.ToDouble + dr("IEPSPSPorcentaje") = DrPS("IEPSPorcentaje").ToString.ToDecimal dr("IEPSPSIVA") = 0 - dr("IEPSPSIVAPorcentaje") = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0) + dr("IEPSPSIVAPorcentaje") = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0) dr("Observacion") = RowV("Obs") dr("CveClasificacion") = RowV("CveClasificacion") dr("Clasificacion") = RowV("Clasificacion") @@ -1377,7 +1377,7 @@ Partial Class OC TxtJustificacion.Text = objOC.Justificacion DdlMoneda.SelectedValueExist(objOC.CveMoneda.ToString) MonedaTexto = DdlMoneda.SelectedItem.Text - Select Case objOC.PorcentajeIVA.ToString.ToDouble + Select Case objOC.PorcentajeIVA.ToString.ToDecimal Case 0 DdlIVA.SelectedValue = "1" Case 0.16 @@ -1385,7 +1385,7 @@ Partial Class OC Case 0.08 DdlIVA.SelectedValue = "1.08" End Select - 'If objOC.PorcentajeIVA.ToString.ToDouble = 0 Then DdlIVA.SelectedValue = "1" Else DdlIVA.SelectedValue = "1.16" + 'If objOC.PorcentajeIVA.ToString.ToDecimal = 0 Then DdlIVA.SelectedValue = "1" Else DdlIVA.SelectedValue = "1.16" DdlPrioridad.SelectedValueExist(objOC.Prioridad.ToString) ChkCotizacion.Checked = objOC.RequiereCotizacion @@ -1654,7 +1654,11 @@ Partial Class OC UPProv.Update() End If - If objOC.CveEstatus = 0 Then CboE.Items.Add(New ListItem("Pre Solicitud", "0")) + If objOC.CveEstatus = 0 Then + CboE.Items.Add(New ListItem("Pre Solicitud", "0")) + ElseIf objOC.TipoTermino = 0 AndAlso objOC.Tipo = "REQ" Then ' no autorizada, está en proceso + CboE.Items.Add(New ListItem("Pre Solicitud", "0")) + End If CboE.SelectedValueExist(objOC.CveEstatus.ToString) 'es decir, si tiene permiso por ser el usuario que aprueba en el estatus actual o tiene el permiso para cancelar en el catalogo @@ -2144,21 +2148,21 @@ Partial Class OC If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then Dim ObjCon As New ClsContratos Dim CvePresupuesto As Integer = 0 - Dim Autorizado As Double = 0 - Dim Ejercido As Double = 0 + Dim Autorizado As Decimal = 0 + Dim Ejercido As Decimal = 0 If ObjCon.GetPresupuestos(-1, "-1", DdlSubProyecto.SelectedValue.ToEntero, 2, -1, UsuarioActual.CveEmpresa) Then If ObjCon.DtResultados.Rows.Count > 0 Then CvePresupuesto = ObjCon.DtResultados.Rows(0)("CvePresupuesto").ToString.ToEntero If CvePresupuesto > 0 Then If ObjCon.GetPresupuestosDetalle(CvePresupuesto, -1, UsuarioActual.CveEmpresa) Then If ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows.Count > 0 Then - Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows(0)("Importe").ToString.ToDouble + Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows(0)("Importe").ToString.ToDecimal End If End If If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{DateTime.Now.Year - 1}".ToDate, Now, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveUsuario, DdlClasificacion.SelectedValue.ToEntero) Then If ObjCon.DtResultados.Rows.Count > 0 Then - Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDouble + Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDecimal End If End If End If @@ -2167,7 +2171,7 @@ Partial Class OC ObjCon.Dispose() If CvePresupuesto > 0 And Autorizado > 0 Then - Dim Diferencia As Double = (Ejercido + If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0)) - Autorizado + Dim Diferencia As Decimal = (Ejercido + If(txtPrecioUnitario.Text.ToDecimal > 0, (txtPrecioUnitario.Text.ToDecimal * TxtCant.Text.ToDecimal) - TxtDescuentoAdd.Text.ToDecimal, 0)) - Autorizado If Diferencia > 0 Then Alert($"No hay presupuesto disponible en el subproyecto {DdlSubProyecto.SelectedItem.Text} y la clasificación {DdlClasificacion.SelectedItem.Text} se excede por {Diferencia.FormatoNumero}", TipoMensaje.MsgAdvertencia) Exit Sub @@ -2176,22 +2180,22 @@ Partial Class OC End If - Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble - Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble - Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble + Dim RetISR As Decimal = DrPS("RetISR").ToString.ToDecimal + Dim RetIVA As Decimal = DrPS("RetIVA").ToString.ToDecimal + Dim IvaPS As Decimal = DrPS("IVA").ToString.ToDecimal 'If IvaPS = -1 Then 'IVA DE LA SUCURSAL - ' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble + ' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDecimal 'End If - Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble - Dim IEPSPSIVA As Double = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0) + Dim IEPSPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal + Dim IEPSPSIVA As Decimal = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0) Dim IdCuentaPorEjercer As Integer = If(HdnCveCuentaPorEjercer.Value = String.Empty, -1, HdnCveCuentaPorEjercer.Value.ToEntero) Dim IdCuentaComprometido As Integer = If(HdnCveCuentaComprometido.Value = String.Empty, -1, HdnCveCuentaComprometido.Value.ToEntero) Dim Proyecto As String = If(DdlProyecto.SelectedValue.ToString.ToEntero > 0, DdlProyecto.SelectedItem.Text, "Sin Proyecto") Dim SubProyecto As String = If(DdlSubProyecto.SelectedValue.ToString.ToEntero > 0, DdlSubProyecto.SelectedItem.Text, "Sin SubProyecto") - Dim TotalPS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0) - Dim ImportePS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, txtPrecioUnitario.Text.ToDouble, 0) + Dim TotalPS As Decimal = If(txtPrecioUnitario.Text.ToDecimal > 0, (txtPrecioUnitario.Text.ToDecimal * TxtCant.Text.ToDecimal) - TxtDescuentoAdd.Text.ToDecimal, 0) + Dim ImportePS As Decimal = If(txtPrecioUnitario.Text.ToDecimal > 0, txtPrecioUnitario.Text.ToDecimal, 0) Dim CveOrdenCompraDetalle As Integer = DtDetalle.MAX("CveOrdenCompraDetalle").ToEntero + 100 Dim CantidadVentaMinima As Decimal = DrPS("VentaMinima").ToString.ToDecimal @@ -2204,41 +2208,41 @@ Partial Class OC 'Si es Proveedor Extranjero el IVA es 0% If GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {DdlProveedores.SelectedValue} AND RFC = 'XEXX010101000'").Rows.Count = 1 Then - IvaPS = 0 - End If + IvaPS = 0 + End If - AddPS(TxtCant.Text, DdlP2.SelectedValue.ToEntero, DdlP2.SelectedText, TxtObsPS.Text, ImportePS, TxtDescuentoAdd.Text.ToDouble, TotalPS, + AddPS(TxtCant.Text, DdlP2.SelectedValue.ToEntero, DdlP2.SelectedText, TxtObsPS.Text, ImportePS, TxtDescuentoAdd.Text.ToDecimal, TotalPS, CboUnidadMedida.SelectedValue.ToEntero, IvaPS, IEPSPS, IEPSPSIVA, DdlClasificacion.SelectedValue.ToEntero, CboUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedItem.Text, DdlProyecto.SelectedValue.ToEntero, Proyecto, DdlSubProyecto.SelectedValue.ToEntero, SubProyecto, LblCodigo.Text, HdnCveActivoFijo.Value.ToEntero, 0, CveOrdenCompraDetalle, CveOrdenCompra, IdCuentaPorEjercer, IdCuentaComprometido, DdlACGeneral1.SelectedValue.ToEntero, DdlACGeneral2.SelectedValue.ToEntero, DdlACGeneral3.SelectedValue.ToEntero, DdlACGeneral4.SelectedValue.ToEntero, DdlACGeneral5.SelectedValue.ToEntero, RetIVA, RetISR, CveCultivoCuadroDetalle:=DdlCultivosCuadro.SelectedValue.ToEntero, Cuadro:=DdlCultivosCuadro.SelectedItem.Text) - TxtCant.Text = "" - CboUnidadMedida.SelectedIndex = 0 - DdlClasificacion.SelectedIndex = 0 - DdlP2.SelectedValue = "-1" - DdlP2.SelectedText = "Seleccione un producto o servicio" - txtPrecioUnitario.Text = "" - TxtObsPS.Text = "" - HdnCveActivoFijo.Value = "" - LblCodigo.Text = "" - LblCvePOA.Text = "" - TxtCant.Focus() + TxtCant.Text = "" + CboUnidadMedida.SelectedIndex = 0 + DdlClasificacion.SelectedIndex = 0 + DdlP2.SelectedValue = "-1" + DdlP2.SelectedText = "Seleccione un producto o servicio" + txtPrecioUnitario.Text = "" + TxtObsPS.Text = "" + HdnCveActivoFijo.Value = "" + LblCodigo.Text = "" + LblCvePOA.Text = "" + TxtCant.Focus() - Total.Text = "0.00" - TxtDescuentoAdd.Text = "0.00" + Total.Text = "0.00" + TxtDescuentoAdd.Text = "0.00" - End If + End If - CargaSuperior() + CargaSuperior() CargaDatosDetalles() UPPDetalle.Update() End Sub - Private Sub AddPS(Cantidad As String, CvePS As Integer, PS As String, Observaciones As String, Importe As Double, Descuento As Double, Total As Double, CveUnidadMedida As Integer, IVAPS As Double, IEPSPS As Double, IEPSPSIVA As Double, CveClasificacion As Integer, + Private Sub AddPS(Cantidad As String, CvePS As Integer, PS As String, Observaciones As String, Importe As Decimal, Descuento As Decimal, Total As Decimal, CveUnidadMedida As Integer, IVAPS As Decimal, IEPSPS As Decimal, IEPSPSIVA As Decimal, CveClasificacion As Integer, UM As String, Clasificacion As String, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, CodigoAF As String, CveActivoFijo As Integer, TipoDato As Integer, CveOrdenCompraDetalle As Integer, CveOrdenCompra As Integer, IdCuentaPorEjercer As Integer, IdCuentaComprometido As Integer, CveProgramaOperativo As Integer, CveUnidadAdministrativa As Integer, - CveFuenteFinanciamiento As Integer, CveTipoGasto As Integer, CveClasificacionOG As Integer, RetIVA As Double, RetISR As Double, Optional CveContratoDetalle As Integer = -1, Optional CveTipoGastoObra As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1, + CveFuenteFinanciamiento As Integer, CveTipoGasto As Integer, CveClasificacionOG As Integer, RetIVA As Decimal, RetISR As Decimal, Optional CveContratoDetalle As Integer = -1, Optional CveTipoGastoObra As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1, Optional Cuadro As String = "") If DtDetalle IsNot Nothing Then @@ -2256,10 +2260,10 @@ Partial Class OC dr("IEPSPS") = Math.Round(IEPSPS * Total, 2) dr("IEPSPSIVAPorcentaje") = IEPSPSIVA dr("IEPSPSIVA") = Math.Round(IEPSPSIVA * Total, 2) - dr("IVAPorcentaje") = If(IVAPS = -1, Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVAPS) + dr("IVAPorcentaje") = If(IVAPS = -1, Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVAPS) Dim TotalGravado As Decimal = Total If IEPSPSIVA > 0 Then TotalGravado = Total * (1 + IEPSPSIVA) 'grava para iva, el importe del IEPS - dr("IVA") = Math.Round(dr("IVAPorcentaje").ToString.ToDouble * TotalGravado, 2) + dr("IVA") = Math.Round(dr("IVAPorcentaje").ToString.ToDecimal * TotalGravado, 2) dr("RetIVAPorcentaje") = RetIVA dr("RetIVA") = Math.Round(RetIVA * Total, 2) dr("RetISRPorcentaje") = RetISR @@ -2588,19 +2592,19 @@ Partial Class OC If Not TieneError Then ' AGREGAR REQUISICION If OC.AddOrdenCompra("REQ", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CboE.SelectedValue.ToEntero, If(TxtFechaEstimadaEntrega.Text.Trim = "", "-1", TxtFechaEstimadaEntrega.Text.Trim), LugarEntrega, UsuarioActual.CveUsuario, CveEmpresaActual, GvD.Rows(0).FCHiddenField("HdnCvePresupuestoEgreso").Value.ToString.ToEntero, pCveProveedor:=CveProveedor, pCveProveedorSucursal:=CveProveedorSucursal, - RequiereCotizacion:=ChkCotizacion.Checked, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, + RequiereCotizacion:=ChkCotizacion.Checked, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto) Then CveOrdenCompraPadre = OC.CveOrdenCompra If CveOrdenCompraPadre > 0 Then For Each dr As DataRow In DtDetalle.Rows - If Not OC.AddOrdenCompraDetalle(CveOrdenCompraPadre, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, - dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, Descuento:=dr("Descuento").ToString.ToDouble, - IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, - RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, - RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, - IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then + If Not OC.AddOrdenCompraDetalle(CveOrdenCompraPadre, dr("Cantidad").ToString.ToDecimal(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDecimal, + dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, Descuento:=dr("Descuento").ToString.ToDecimal, + IEPSPS:=dr("IEPSPS").ToString.ToDecimal, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDecimal, IVA:=dr("IVA").ToString.ToDecimal, RetIVA:=dr("RetIVA").ToString.ToDecimal, + RetISR:=dr("RetISR").ToString.ToDecimal, Total:=dr("Total").ToString.ToDecimal, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDecimal, + RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDecimal, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDecimal, + IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDecimal, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then TieneError = True Exit For End If @@ -2623,7 +2627,7 @@ Partial Class OC If OC.AddOrdenCompra(If(TipoOS, "OS", TipoOC), -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusNuevo, If(TxtFechaEstimadaEntrega.Text.Trim = "", "-1", TxtFechaEstimadaEntrega.Text.Trim), LugarEntrega, UsuarioActual.CveUsuario, CveEmpresaActual, GvD.Rows(0).FCHiddenField("HdnCvePresupuestoEgreso").Value.ToString.ToEntero, pCveProveedor:=CveProveedor, pCveProveedorSucursal:=CveProveedorSucursal, RequiereCotizacion:=ChkCotizacion.Checked, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, - PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), + PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto) Then CveOrdenCompra = OC.CveOrdenCompra @@ -2674,11 +2678,11 @@ Partial Class OC For Each dr As DataRow In DtDetalle.Rows - If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, - dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, pCveOrdenCompraPadre:=CveOrdenCompraPadre, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, - IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, - IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, - IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(), CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then + If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDecimal(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDecimal, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, + dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, pCveOrdenCompraPadre:=CveOrdenCompraPadre, Descuento:=dr("Descuento").ToString.ToDecimal, IEPSPS:=dr("IEPSPS").ToString.ToDecimal, + IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDecimal, IVA:=dr("IVA").ToString.ToDecimal, RetIVA:=dr("RetIVA").ToString.ToDecimal, RetISR:=dr("RetISR").ToString.ToDecimal, Total:=dr("Total").ToString.ToDecimal, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, + IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDecimal, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDecimal, + IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDecimal, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(), CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then TieneError = True Exit For End If @@ -2789,7 +2793,7 @@ Partial Class OC LugarEntrega, DdlMoneda.SelectedValue.ToEntero, CveProveedor, CveOrdenCompra, UsuarioActual.CveUsuario, Ddlcliente.txtValue.Value.ToEntero, DdlVendedor.SelectedValue.ToEntero, txtobsprioridad.Text, IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveProveedorContacto:=CveProveedorContacto, - PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)) Then + PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2)) Then If CveProveedorOriginal <> CveProveedor Then If Not ObjConta.UpdateProveedorPoliza(CveOrdenCompra, CveProveedor, Proveedor) Then TieneError = True @@ -2814,7 +2818,7 @@ Partial Class OC 'inserto los nuevos detalles If Not TieneError Then For Each dr As DataRow In DtDetalle.FiltraParametros("TipoDato = 0").Rows - If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then + If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDecimal(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDecimal, dr("CveSubProyecto").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), Descuento:=dr("Descuento").ToString.ToDecimal, IEPSPS:=dr("IEPSPS").ToString.ToDecimal, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDecimal, IVA:=dr("IVA").ToString.ToDecimal, RetIVA:=dr("RetIVA").ToString.ToDecimal, RetISR:=dr("RetISR").ToString.ToDecimal, Total:=dr("Total").ToString.ToDecimal, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDecimal, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDecimal, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDecimal, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then TieneError = True Exit For Else @@ -2831,10 +2835,10 @@ Partial Class OC DtInvOCDiferencias.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) DtInvOCDiferencias.Columns.Add("CveAlmacen", GetType(Integer)) DtInvOCDiferencias.Columns.Add("CveMovimiento", GetType(Integer)) - DtInvOCDiferencias.Columns.Add("Diferencia", GetType(Double)) - DtInvOCDiferencias.Columns.Add("ImporteMovto", GetType(Double)) - DtInvOCDiferencias.Columns.Add("ImporteMovtoDLLS", GetType(Double)) - DtInvOCDiferencias.Columns.Add("TipoCambioAjuste", GetType(Double)) + DtInvOCDiferencias.Columns.Add("Diferencia", GetType(Decimal)) + DtInvOCDiferencias.Columns.Add("ImporteMovto", GetType(Decimal)) + DtInvOCDiferencias.Columns.Add("ImporteMovtoDLLS", GetType(Decimal)) + DtInvOCDiferencias.Columns.Add("TipoCambioAjuste", GetType(Decimal)) DtInvOCDiferencias.Columns.Add("ConceptoSalida", GetType(Integer)) DtInvOCDiferencias.Columns.Add("PS", GetType(String)) @@ -2844,9 +2848,9 @@ Partial Class OC If Not TieneError Then For Each dr As DataRow In DtDetalle.FiltraParametros("TipoDato IN (1)").Rows - If OC.UpdateOrdenCompraDetalle(dr("Cantidad").ToString.ToDouble, dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero, - dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, dr("CveOrdenCompraDetalle").ToString.ToEntero, If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), dr("Descuento").ToString.ToDouble, - IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) <= 0 Then + If OC.UpdateOrdenCompraDetalle(dr("Cantidad").ToString.ToDecimal, dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDecimal, dr("CveSubProyecto").ToString.ToEntero, + dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, dr("CveOrdenCompraDetalle").ToString.ToEntero, If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), dr("Descuento").ToString.ToDecimal, + IEPSPS:=dr("IEPSPS").ToString.ToDecimal, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDecimal, IVA:=dr("IVA").ToString.ToDecimal, RetIVA:=dr("RetIVA").ToString.ToDecimal, RetISR:=dr("RetISR").ToString.ToDecimal, Total:=dr("Total").ToString.ToDecimal, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDecimal, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDecimal, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDecimal) <= 0 Then TieneError = True Exit For Else @@ -2856,12 +2860,12 @@ Partial Class OC Dim DrInvOCDiferencias As DataRow For Each DrInv As DataRow In DtInvOC.FiltraParametros($"CveOrdenCompraDetalle = {dr("CveOrdenCompraDetalle").ToString.ToEntero} AND CveCompraDetalle < 1").Rows DrInvOCDiferencias = DtInvOCDiferencias.NewRow - DrInvOCDiferencias("TipoCambioAjuste") = DrInv("TipoCambioAjuste").ToString.ToDouble - DrInvOCDiferencias("Diferencia") = ((dr("Importe").ToString.ToDouble * DrInv("TipoCambioAjuste").ToString.ToDouble) - DrInv("PUOriginal").ToString.ToDouble) * DrInv("Cantidad").ToString.ToDouble + DrInvOCDiferencias("TipoCambioAjuste") = DrInv("TipoCambioAjuste").ToString.ToDecimal + DrInvOCDiferencias("Diferencia") = ((dr("Importe").ToString.ToDecimal * DrInv("TipoCambioAjuste").ToString.ToDecimal) - DrInv("PUOriginal").ToString.ToDecimal) * DrInv("Cantidad").ToString.ToDecimal DrInvOCDiferencias("CveAlmacen") = DrInv("CveAlmacen").ToString.ToEntero DrInvOCDiferencias("CveOrdenCompraDetalle") = DrInv("CveOrdenCompraDetalle").ToString.ToEntero - DrInvOCDiferencias("ImporteMovto") = dr("Importe").ToString.ToDouble * DrInv("TipoCambioAjuste").ToString.ToDouble - DrInvOCDiferencias("ImporteMovtoDLLS") = If(DrInv("TipoCambioAjuste").ToString.ToDouble > 1, dr("Importe").ToString.ToDouble, -1) + DrInvOCDiferencias("ImporteMovto") = dr("Importe").ToString.ToDecimal * DrInv("TipoCambioAjuste").ToString.ToDecimal + DrInvOCDiferencias("ImporteMovtoDLLS") = If(DrInv("TipoCambioAjuste").ToString.ToDecimal > 1, dr("Importe").ToString.ToDecimal, -1) DrInvOCDiferencias("CveMovimiento") = DrInv("CveMovimiento").ToString.ToEntero DrInvOCDiferencias("ConceptoSalida") = DrInv("ConceptoSalida").ToString.ToEntero DrInvOCDiferencias("PS") = dr("PS").ToString @@ -3030,7 +3034,7 @@ Partial Class OC ' 'MODIFICACIÓN CONCEPTO ' If ConceptoSalida = 0 Then ' For Each DrAjuste As DataRow In DtInvOC.FiltraParametros($"CveMovimiento = {CveMovimientoAlmacen} And ConceptoSalida = 0").Rows - ' If Not ObjInventarios.UpdateMovimientoDetalle(DrAjuste("Cantidad").ToString.ToDouble, DrAjuste("CveUM").ToString.ToEntero, DrAjuste("CvePS").ToString.ToEntero, DtInvOCDiferencias.FiltroPrimeroValor("ImporteMovto", $"CveOrdenCompraDetalle = {DrAjuste("CveOrdenCompraDetalle").ToString.ToEntero}").ToDouble, -1, DrAjuste("CveMovimientoDetalle").ToString.ToEntero, PUTC:=DtInvOCDiferencias.FiltroPrimeroValor("ImporteMovtoDLLS", $"CveOrdenCompraDetalle = {DrAjuste("CveOrdenCompraDetalle").ToString.ToEntero}").ToDouble) Then + ' If Not ObjInventarios.UpdateMovimientoDetalle(DrAjuste("Cantidad").ToString.ToDecimal, DrAjuste("CveUM").ToString.ToEntero, DrAjuste("CvePS").ToString.ToEntero, DtInvOCDiferencias.FiltroPrimeroValor("ImporteMovto", $"CveOrdenCompraDetalle = {DrAjuste("CveOrdenCompraDetalle").ToString.ToEntero}").ToDecimal, -1, DrAjuste("CveMovimientoDetalle").ToString.ToEntero, PUTC:=DtInvOCDiferencias.FiltroPrimeroValor("ImporteMovtoDLLS", $"CveOrdenCompraDetalle = {DrAjuste("CveOrdenCompraDetalle").ToString.ToEntero}").ToDecimal) Then ' TieneError = True ' Exit For ' End If @@ -3041,7 +3045,7 @@ Partial Class OC ' If ConceptoSalida = 2 Then ' Dim CveMovimientoSalidaAjuste = ObjInventarios.AddMovimiento(CveAlmacen, 3, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, MovimientoFijo:=True, Modulo:="OC/G") ' For Each DrAjuste As DataRow In DtInvOC.FiltraParametros($"CveMovimiento = {CveMovimientoAlmacen} And ConceptoSalida = 2").Rows - ' If Not ObjInventarios.AddMovimientoDetalle(CveMovimientoSalidaAjuste, DrAjuste("Cantidad").ToString.ToDouble, DrAjuste("CveUM").ToString.ToEntero, DrAjuste("CveUM").ToString.ToEntero, DrAjuste("PU").ToString.ToDouble, -1, CveOrdenCompraDetalle:=DrAjuste("CveOrdenCompraDetalle").ToString.ToEntero) Then + ' If Not ObjInventarios.AddMovimientoDetalle(CveMovimientoSalidaAjuste, DrAjuste("Cantidad").ToString.ToDecimal, DrAjuste("CveUM").ToString.ToEntero, DrAjuste("CveUM").ToString.ToEntero, DrAjuste("PU").ToString.ToDecimal, -1, CveOrdenCompraDetalle:=DrAjuste("CveOrdenCompraDetalle").ToString.ToEntero) Then ' TieneError = True ' Exit For ' End If @@ -3049,7 +3053,7 @@ Partial Class OC ' Dim CveMovimientoEntradaAjuste = ObjInventarios.AddMovimiento(CveAlmacen, 2, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Modulo:="OC/G") ' If ObjInventarios.GetMovimientosDetalle(CveMovimientoSalidaAjuste, UsuarioActual.CveEmpresa) Then ' For Each Dr As DataRow In ObjInventarios.DtResultados.Rows - ' If Not ObjInventarios.AddMovimientoDetalle(CveMovimientoEntradaAjuste, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, DtInvOCDiferencias.FiltroPrimeroValor("ImporteMovto", $"CveOrdenCompraDetalle = {Dr("CveOrdenCompraDetalle").ToString.ToEntero}").ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then + ' If Not ObjInventarios.AddMovimientoDetalle(CveMovimientoEntradaAjuste, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, DtInvOCDiferencias.FiltroPrimeroValor("ImporteMovto", $"CveOrdenCompraDetalle = {Dr("CveOrdenCompraDetalle").ToString.ToEntero}").ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then ' TieneError = True ' Exit For ' End If @@ -3253,7 +3257,7 @@ Partial Class OC CveProveedor = dr("CveProveedor").ToString.ToEntero - PorIVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) 'GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros(String.Format("CveProveedor = {0}", CveProveedor)).Rows(0)("IVA").ToString.ToDouble + PorIVA = Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2) 'GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros(String.Format("CveProveedor = {0}", CveProveedor)).Rows(0)("IVA").ToString.ToDecimal IVACot = IVA '(DtDetalle.SUM("Total", String.Format("CveProveedor = {0}", CveProveedor)) * PorIVA).ToString.ToDecimal RetIVA = TxtRetIVA.Text.ToDecimal RetISR = TxtRetISR.Text.ToDecimal @@ -3297,15 +3301,15 @@ Partial Class OC End If 'AGREGA DETALLES - If Not objOrdenCompra.AddOrdenCompraDetalle(objOrdenCompra.CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, - dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), + If Not objOrdenCompra.AddOrdenCompraDetalle(objOrdenCompra.CveOrdenCompra, dr("Cantidad").ToString.ToDecimal(), dr("CveUnidadMedida").ToString.ToEntero, + dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDecimal, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CveOrdenCompra, - CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, Descuento:=dr("Descuento").ToString.ToDouble, - IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, - RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, - CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, - RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, - IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, + CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, Descuento:=dr("Descuento").ToString.ToDecimal, + IEPSPS:=dr("IEPSPS").ToString.ToDecimal, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDecimal, IVA:=dr("IVA").ToString.ToDecimal, + RetIVA:=dr("RetIVA").ToString.ToDecimal, RetISR:=dr("RetISR").ToString.ToDecimal, Total:=dr("Total").ToString.ToDecimal, + CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDecimal, + RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDecimal, + IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDecimal, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDecimal, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then HuboError = True Exit For @@ -3328,7 +3332,7 @@ Partial Class OC Else If objOrdenCompra.AddOrdenCompra("OC", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega, CveUsuario, CveEmpresaActual, 0, pCveProveedor:=DdlProveedores.SelectedValue.ToEntero, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero(), CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, - PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, IDPoliza:=IDPolizaPresupuestal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, + PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, IDPoliza:=IDPolizaPresupuestal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion) Then @@ -3347,7 +3351,7 @@ Partial Class OC 'CveOrdenCompra = objOrdenCompra.CveOrdenCompra If Not HuboError Then For Each dr As DataRow In DtDetalle.Rows - If Not objOrdenCompra.AddOrdenCompraDetalle(objOrdenCompra.CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CveOrdenCompra, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then + If Not objOrdenCompra.AddOrdenCompraDetalle(objOrdenCompra.CveOrdenCompra, dr("Cantidad").ToString.ToDecimal(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDecimal, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CveOrdenCompra, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, Descuento:=dr("Descuento").ToString.ToDecimal, IEPSPS:=dr("IEPSPS").ToString.ToDecimal, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDecimal, IVA:=dr("IVA").ToString.ToDecimal, RetIVA:=dr("RetIVA").ToString.ToDecimal, RetISR:=dr("RetISR").ToString.ToDecimal, Total:=dr("Total").ToString.ToDecimal, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDecimal, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDecimal, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDecimal, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero, CveCultivoCuadroDetalle:=dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then HuboError = True Exit For End If @@ -3760,7 +3764,7 @@ Partial Class OC Drr = GlobalDTOCEstatus(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveEstatus = {0}", CveEstatus))(0) If Drr IsNot Nothing AndAlso UsuarioActual.TienePermisoProceso(203) AndAlso Drr("TipoTermino").ToString.ToEntero = 3 AndAlso Drr("Tipo").ToString = "OC" Then If e.Row.DataKey("CveCompra").ToEntero > 0 Then - If e.Row.DBCampo("CantidadNoEditable").ToDouble >= e.Row.DBCampo("Cantidad").ToDouble Then '[IPP] PARA PODER EDITAR + If e.Row.DBCampo("CantidadNoEditable").ToDecimal >= e.Row.DBCampo("Cantidad").ToDecimal Then '[IPP] PARA PODER EDITAR e.Row.FCLinkButton("imgE").Enabled = False e.Row.FCLinkButton("imgE").ToolTip = "El concepto no se puede editar porque ya esta asignado a una compra" e.Row.FCLinkButton("imgD").Enabled = False @@ -3770,7 +3774,7 @@ Partial Class OC End If 'SI EL CONCEPTO YA TIENE ALGUNA RECEPCIÓN A ALMACÉN O VINCULACIÓN A COMPRA NO SE PUEDE ELIMINAR - If e.Row.DBCampo("CantidadNoEditable").ToDouble > 0 Then + If e.Row.DBCampo("CantidadNoEditable").ToDecimal > 0 Then e.Row.FCLinkButton("imgD").Enabled = False e.Row.FCLinkButton("imgD").ToolTip = "El concepto no se puede eliminar porque ya esta asignado a una compra" e.Row.FCLinkButton("imgD").Attributes.Remove("Data-toggle") @@ -3795,12 +3799,12 @@ Partial Class OC FiltroClasificacion = String.Format("CveClasificacion = {0}", e.Row.DBCampo("CveClasificacion")) End If - If CveOrdenCompra > 0 AndAlso (e.Row.DBCampo("CantidadVinculadaCompra").ToDouble > 0 OrElse e.Row.DBCampo("CantidadSurtidaAlmacen").ToDouble > 0 OrElse e.Row.DBCampo("CantidadVinculada").ToDouble > 0) Then + If CveOrdenCompra > 0 AndAlso (e.Row.DBCampo("CantidadVinculadaCompra").ToDecimal > 0 OrElse e.Row.DBCampo("CantidadSurtidaAlmacen").ToDecimal > 0 OrElse e.Row.DBCampo("CantidadVinculada").ToDecimal > 0) Then e.Row.FCDropDownList("DdlPS").Enabled = False e.Row.FCDropDownList("DdlClasificacion").Enabled = False e.Row.FCDropDownList("CboUnidadMedidaEdit").Enabled = False 'que tenga el permiso que no bloquee - If Not UsuarioActual.TienePermisoProceso(329) AndAlso e.Row.DBCampo("CantidadVinculadaCompra").ToDouble = 0 Then 'permite editar pu, aun estando recibida + If Not UsuarioActual.TienePermisoProceso(329) AndAlso e.Row.DBCampo("CantidadVinculadaCompra").ToDecimal = 0 Then 'permite editar pu, aun estando recibida e.Row.FCTextBox("TxtImporteEdit").Enabled = False e.Row.FCTextBox("TxtDescuentoEdit").Enabled = False End If @@ -3876,7 +3880,7 @@ Partial Class OC e.Row.FCTextBox("TxtDescuentoEdit").Attributes.Add("onkeyup", String.Format("FormatoMoneda(this);ValidaDescuentoDetalle(this,{0});", e.Row.FCTextBox("TxtImporteEdit").ClientID)) e.Row.FCTextBox("TxtImporteEdit").Attributes.Add("onkeyup", String.Format("ValidaDescuentoDetalle({0},this);", e.Row.FCTextBox("TxtImporteEdit").ClientID)) - e.Row.FCTextBox("TxtCantEdit").Attributes.Add("onblur", $"ValidarCantidadMenor(this,{e.Row.DBCampo("CantidadNoEditable").ToDouble});") + e.Row.FCTextBox("TxtCantEdit").Attributes.Add("onblur", $"ValidarCantidadMenor(this,{e.Row.DBCampo("CantidadNoEditable").ToDecimal});") End If @@ -3926,14 +3930,14 @@ Partial Class OC End Sub Protected Sub GvD_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvD.RowUpdating - Dim Cantidad, Importe, Descuento As Double + Dim Cantidad, Importe, Descuento As Decimal Dim CveUnidad, CveClasificacion, CveActivoFijo, CvePS, CveSubProyecto, CveProyecto, CveCultivoCuadroDetalle As Integer Dim Obs, UM, Clasificacion, Codigo, PS, SubProyecto, Proyecto, Cuadro As String Dim gvr As GridViewRow = GvD.Rows(e.RowIndex) - Cantidad = gvr.FCTextBox("TxtCantEdit").Text.Trim.ToDouble - Importe = gvr.FCTextBox("TxtImporteEdit").Text.Trim.ToDouble - Descuento = gvr.FCTextBox("TxtDescuentoEdit").Text.Trim.ToDouble + Cantidad = gvr.FCTextBox("TxtCantEdit").Text.Trim.ToDecimal + Importe = gvr.FCTextBox("TxtImporteEdit").Text.Trim.ToDecimal + Descuento = gvr.FCTextBox("TxtDescuentoEdit").Text.Trim.ToDecimal Obs = gvr.FCTextBox("TxtObsPS").Text.Trim CveUnidad = gvr.FCDropDownList("CboUnidadMedidaEdit").SelectedValue.ToEntero UM = gvr.FCDropDownList("CboUnidadMedidaEdit").SelectedItem.Text @@ -3943,11 +3947,11 @@ Partial Class OC 'SE TOMAN VALORES EN CASO DE QUE LA CvePS SEA DIFERENTE DE LA ANTERIOR Dim CvePSAnterior = gvr.DataKey("CvePS").ToEntero PS = gvr.DataKey("PS").ToString - Dim RetISR = gvr.DataKey("RetISRPorcentaje").ToDouble - Dim RetIVA = gvr.DataKey("RetIVAPorcentaje").ToDouble - 'Dim IvaPS = gvr.DataKey("IVAPorcentaje").ToDouble - Dim IEPSPS = gvr.DataKey("IEPSPSPorcentaje").ToDouble - Dim IEPSPSIVA = gvr.DataKey("IEPSPSIVAPorcentaje").ToDouble + Dim RetISR = gvr.DataKey("RetISRPorcentaje").ToDecimal + Dim RetIVA = gvr.DataKey("RetIVAPorcentaje").ToDecimal + 'Dim IvaPS = gvr.DataKey("IVAPorcentaje").ToDecimal + Dim IEPSPS = gvr.DataKey("IEPSPSPorcentaje").ToDecimal + Dim IEPSPSIVA = gvr.DataKey("IEPSPSIVAPorcentaje").ToDecimal Dim Total = Importe * Cantidad - Descuento @@ -3961,17 +3965,17 @@ Partial Class OC Exit Sub End If Dim IvaPS = DrPS("IVA").ToString.ToDecimal - IEPSPS = DrPS("IEPSPorcentaje").ToString.ToDouble + IEPSPS = DrPS("IEPSPorcentaje").ToString.ToDecimal IEPSPSIVA = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0) If CvePS <> CvePSAnterior Or Not CveOrdenCompra > 0 Then - RetISR = DrPS("RetISR").ToString.ToDouble - RetIVA = DrPS("RetIVA").ToString.ToDouble + RetISR = DrPS("RetISR").ToString.ToDecimal + RetIVA = DrPS("RetIVA").ToString.ToDecimal 'If IvaPS = -1 Then 'IVA DE LA SUCURSAL - ' IvaPS = GlobalDTSubProyectos(-1, gvr.FCDropDownList("DdlSubProyectoEdit").SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble + ' IvaPS = GlobalDTSubProyectos(-1, gvr.FCDropDownList("DdlSubProyectoEdit").SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDecimal 'End If - ' IEPSPSIVA = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0) + ' IEPSPSIVA = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0) End If @@ -3999,21 +4003,21 @@ Partial Class OC If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then Dim ObjCon As New ClsContratos Dim CvePresupuesto As Integer = 0 - Dim Autorizado As Double = 0 - Dim Ejercido As Double = 0 + Dim Autorizado As Decimal = 0 + Dim Ejercido As Decimal = 0 If ObjCon.GetPresupuestos(-1, "-1", CveSubProyecto, 2, -1, UsuarioActual.CveEmpresa) Then If ObjCon.DtResultados.Rows.Count > 0 Then CvePresupuesto = ObjCon.DtResultados.Rows(0)("CvePresupuesto").ToString.ToEntero If CvePresupuesto > 0 Then If ObjCon.GetPresupuestosDetalle(CvePresupuesto, -1, UsuarioActual.CveEmpresa) Then If ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {CveClasificacion} And Importe > 0").Rows.Count > 0 Then - Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {CveClasificacion} And Importe > 0").Rows(0)("Importe").ToString.ToDouble + Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {CveClasificacion} And Importe > 0").Rows(0)("Importe").ToString.ToDecimal End If End If If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{DateTime.Now.Year - 1}".ToDate, Now, UsuarioActual.CveEmpresa, CveProyecto, CveSubProyecto, UsuarioActual.CveUsuario, CveClasificacion) Then If ObjCon.DtResultados.Rows.Count > 0 Then - Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDouble + Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDecimal End If End If End If @@ -4022,7 +4026,7 @@ Partial Class OC ObjCon.Dispose() If CvePresupuesto > 0 And Autorizado > 0 Then - Dim Diferencia As Double = (Ejercido + Total) - Autorizado + Dim Diferencia As Decimal = (Ejercido + Total) - Autorizado If Diferencia > 0 Then Alert($"No hay presupuesto disponible en el subproyecto {SubProyecto} y la clasificación {Clasificacion} se excede por {Diferencia.FormatoNumero}", TipoMensaje.MsgAdvertencia) Exit Sub @@ -4069,11 +4073,11 @@ Partial Class OC dr(0)("IEPSPSIVA") = IEPSPSIVA * Total dr(0)("IEPSPSIVAPorcentaje") = IEPSPSIVA - 'If DdlIVA.SelectedValue.ToDouble = 1 Then dr(0)("IVA") = 0 Else dr(0)("IVA") = IvaPS * Total - dr(0)("IVAPorcentaje") = If(IvaPS = -1, Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), 0) + 'If DdlIVA.SelectedValue.ToDecimal = 1 Then dr(0)("IVA") = 0 Else dr(0)("IVA") = IvaPS * Total + dr(0)("IVAPorcentaje") = If(IvaPS = -1, Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), 0) Dim TotalGravado As Decimal = Total If IEPSPSIVA > 0 Then TotalGravado = Total * (1 + IEPSPSIVA) 'grava para iva, el importe del IEPS - dr(0)("IVA") = Math.Round(dr(0)("IVAPorcentaje").ToString.ToDouble * TotalGravado, 2) + dr(0)("IVA") = Math.Round(dr(0)("IVAPorcentaje").ToString.ToDecimal * TotalGravado, 2) dr(0)("RetIVA") = RetIVA * Total dr(0)("RetIVAPorcentaje") = RetIVA @@ -4476,7 +4480,7 @@ Partial Class OC If UsuarioActual.Empresa.UsaAC And VerificaPresupuesto Then Dim ContPaq As New ClsContPAQi(UsuarioActual.Empresa) - Dim disponible As Double + Dim disponible As Decimal Dim ErrorPresupuesto = False Dim Ddl1 As DropDownList @@ -4484,7 +4488,7 @@ Partial Class OC Dim Ddl3 As DropDownList Dim Ddl4 As DropDownList Dim Ddl5 As DropDownList - Dim Total As Double + Dim Total As Decimal Dim DtPresupuestosTemp As DataTable Dim Filtro As New StringBuilder @@ -4495,7 +4499,7 @@ Partial Class OC Ddl3 = grid.FCDropDownList("DdlAC3") Ddl4 = grid.FCDropDownList("DdlAC4") Ddl5 = grid.FCDropDownList("DdlAC5") - Total = grid.FCLiteral("LtlTotal").Text.ToDouble + Total = grid.FCLiteral("LtlTotal").Text.ToDecimal 'OBTENEMOS EL REGISTRO DEL PE SELECCIONADO Filtro.AppendFormat("CveProgramaOperativo = {0} and CveUnidadAdministrativa = {1} and CveFuenteFinanciamiento = {2} and CveTipoGasto= {3} and CveClasificacion = {4}", If(Ddl1.SelectedValue.ToString = "", "-1", Ddl1.SelectedValue.ToString), If(Ddl2.SelectedValue.ToString = "", "-1", Ddl2.SelectedValue.ToString), If(Ddl3.SelectedValue.ToString = "", "-1", Ddl3.SelectedValue.ToString), If(Ddl4.SelectedValue.ToString = "", "-1", Ddl4.SelectedValue.ToString), If(Ddl5.SelectedValue.ToString = "", "-1", Ddl5.SelectedValue.ToString)) @@ -4640,8 +4644,8 @@ Partial Class OC End If 'ACTUALIZO DATO EN DB - If OC.UpdateOrdenCompraDetalle(dr("Cantidad").ToString.ToDouble, dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, - dr("Observacion").ToString.ToString, UsuarioActual.CveUsuario, dr("CveOrdenCompraDetalle").ToString.ToEntero, dr("CvePresupuestoEgreso").ToString.ToEntero, dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) <= 0 Then + If OC.UpdateOrdenCompraDetalle(dr("Cantidad").ToString.ToDecimal, dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDecimal, dr("CveSubProyecto").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, + dr("Observacion").ToString.ToString, UsuarioActual.CveUsuario, dr("CveOrdenCompraDetalle").ToString.ToEntero, dr("CvePresupuestoEgreso").ToString.ToEntero, dr("Descuento").ToString.ToDecimal, IEPSPS:=dr("IEPSPS").ToString.ToDecimal, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDecimal, IVA:=dr("IVA").ToString.ToDecimal, RetIVA:=dr("RetIVA").ToString.ToDecimal, RetISR:=dr("RetISR").ToString.ToDecimal, Total:=dr("Total").ToString.ToDecimal, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDecimal, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDecimal, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDecimal) <= 0 Then TieneError = True End If @@ -4688,31 +4692,31 @@ Partial Class OC e.Row.CssClass = "SubTotales" For i As Integer = 1 To NumCotizaciones Dim Btn As Button = e.Row.FCButton(String.Format("Btn{0}", i)) - Btn.Text = e.Row.DBCampo(String.Format("PU{0}", i)).ToDouble.ToString("N2") + Btn.Text = e.Row.DBCampo(String.Format("PU{0}", i)).ToDecimal.ToString("N2") Btn.Visible = True 'Btn.Enabled = True 'Btn.OnClientClick = "return false;" - e.Row.Cells(2 + i).Text = String.Format("{0}", e.Row.DBCampo(String.Format("PU{0}", i)).ToDouble.ToString("N2")) + e.Row.Cells(2 + i).Text = String.Format("{0}", e.Row.DBCampo(String.Format("PU{0}", i)).ToDecimal.ToString("N2")) Next Else Dim CellMasBarato As Integer = -1 - Dim Monto As Double = -1 + Dim Monto As Decimal = -1 For i As Integer = 1 To NumCotizaciones Dim Btn As Button = e.Row.FCButton(String.Format("Btn{0}", i)) - Btn.Text = e.Row.DBCampo("PU" & i).ToDouble.ToString("N2") + Btn.Text = e.Row.DBCampo("PU" & i).ToDecimal.ToString("N2") Btn.CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo(String.Format("CveCotizacionDetalle{0}", i)), False, DtCotizaciones.Rows(i - 1)("CveProveedor").ToString) Btn.Style.Add("cursor:", "pointer") - If e.Row.DBCampo(String.Format("PU{0}", i)).ToDouble > 0 Then + If e.Row.DBCampo(String.Format("PU{0}", i)).ToDecimal > 0 Then If Monto.ToString = "-1" Then - Monto = e.Row.DBCampo(String.Format("PU{0}", i)).ToDouble + Monto = e.Row.DBCampo(String.Format("PU{0}", i)).ToDecimal CellMasBarato = i End If - If e.Row.DBCampo(String.Format("PU{0}", i)).ToDouble < Monto Then + If e.Row.DBCampo(String.Format("PU{0}", i)).ToDecimal < Monto Then CellMasBarato = i - Monto = e.Row.DBCampo(String.Format("PU{0}", i)).ToDouble + Monto = e.Row.DBCampo(String.Format("PU{0}", i)).ToDecimal End If Else Btn.Text = "Sin captura" @@ -4735,7 +4739,7 @@ Partial Class OC Dim i As Integer = 1 For Each dr As DataRow In DtCotizaciones.Rows Dim Btn As Button = e.Row.FCButton("Btn" & i) - ' Btn.Text = e.Row.DBCampo("PU" & i).ToDouble.ToString("N2") + ' Btn.Text = e.Row.DBCampo("PU" & i).ToDecimal.ToString("N2") If e.Row.DBCampo("EsGanadora" & i).ToString = "True" Then @@ -5264,7 +5268,7 @@ Partial Class OC Dim TieneError = False If ObjOI.AddEventoTarea(Asunto, Descripcion.ToString, 1, UsuarioActual.CveUsuario, DdlSAUsuario.SelectedValue.ToString.ToEntero, DateTime.Now, DateTime.Now.AddMinutes(15), -1, 1, -1, "-1", -1, -1, -1, -1, -1, CveOrdenCompra.ToEntero, -1, -1, UsuarioActual.CveUsuario, -1, CveEmpresaActual) Then - If Not ObjOC.AddSolicitudAnticipo(CveOrdenCompra, TxtSAImporte.Text.ToDouble, CveEmpresaActual) Then + If Not ObjOC.AddSolicitudAnticipo(CveOrdenCompra, TxtSAImporte.Text.ToDecimal, CveEmpresaActual) Then TieneError = True End If Else @@ -5378,7 +5382,7 @@ Partial Class OC strBody.Append("
") strBody.Append("
") strBody.Append("
") - strBody.Append($" Solicitud de anticipo {If(importe.ToDouble > 0, "", " CANCELADA ")}") + strBody.Append($" Solicitud de anticipo {If(importe.ToDecimal > 0, "", " CANCELADA ")}") strBody.Append("
") strBody.Append("
") strBody.Append("
") @@ -5415,13 +5419,13 @@ Partial Class OC strBody.Append(" ") strBody.Append(folio) strBody.Append(" ") - If importe.ToDouble > 0 Then + If importe.ToDecimal > 0 Then strBody.Append(" Importe Anticipo:") strBody.Append(" ") strBody.AppendFormat("{0} {1}", importe, Abreviatura) strBody.Append(" ") End If - If LblTotal.Text.Trim.ToDouble > 0 Then + If LblTotal.Text.Trim.ToDecimal > 0 Then strBody.Append(" Importe OC:") strBody.Append(" ") strBody.AppendFormat("{0} {1}", LblTotal.Text, Abreviatura) @@ -5556,7 +5560,7 @@ Partial Class OC If dtpresupuestos.Rows.Count > 0 AndAlso dtpresupuestos.Select(psclasificacion).Count > 0 Then Dim rowpresupuesto As DataRow = dtpresupuestos.Select(psclasificacion)(0) - rowpresupuesto("Importe") = rowpresupuesto("Importe").ToString.ToDouble - dr("Total").ToString.ToDouble() + rowpresupuesto("Importe") = rowpresupuesto("Importe").ToString.ToDecimal - dr("Total").ToString.ToDecimal() Else If subproyectos.Contains(dr("CveSubProyecto").ToString.ToEntero) Then notienerecursos = True @@ -5570,7 +5574,7 @@ Partial Class OC dtpresupuestos.AcceptChanges() ' For Each rowpresupuesto As DataRow In dtpresupuestos.Rows - If (rowpresupuesto("Importe").ToString.ToDouble() < 0) Then + If (rowpresupuesto("Importe").ToString.ToDecimal() < 0) Then If Not subproyectosSr.Contains(rowpresupuesto("CveSubProyecto").ToString.ToEntero) Then subproyectosSr.Add(rowpresupuesto("CveSubProyecto").ToString.ToEntero) SinRecursos.AppendFormat(",{0}", rowpresupuesto("SubProyecto").ToString) @@ -6522,7 +6526,7 @@ Partial Class OC Dim Proyecto As String = Row("Proyecto").ToString.Trim.ToUpper Dim Observaciones As String = Row("Observaciones").ToString Dim PrecioUnitario As String = Row("PU").ToString - Dim Descuento As Double = Row("Descuento").ToString.ToDouble * Cantidad.ToDouble 'RMF, cambio a multiplicar por cantidad 2018.04.21 + Dim Descuento As Decimal = Row("Descuento").ToString.ToDecimal * Cantidad.ToDecimal 'RMF, cambio a multiplicar por cantidad 2018.04.21 Dim CvePS As Integer = 0 Dim CveProyecto As Integer = 0 Dim CveSubProyecto As Integer = 0 @@ -6590,19 +6594,19 @@ Partial Class OC Alert("Ocurrió un error al cargar la información de los productos del archivo. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) Continue For End If - Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble - Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble + Dim RetIVA As Decimal = DrPS("RetIVA").ToString.ToDecimal + Dim RetISR As Decimal = DrPS("RetISR").ToString.ToDecimal Dim PS As String = DrPS("PS").ToString - Dim TotalPS As Double = If(PrecioUnitario.ToDouble > 0, PrecioUnitario.ToDouble * Cantidad.ToDouble - Descuento, 0) + Dim TotalPS As Decimal = If(PrecioUnitario.ToDecimal > 0, PrecioUnitario.ToDecimal * Cantidad.ToDecimal - Descuento, 0) Dim CveUnidadMedida As Integer = DrPS("CveUnidadMedida").ToString.ToEntero Dim UM As String = DrPS("UnidadMedida").ToString - Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble + Dim IvaPS As Decimal = DrPS("IVA").ToString.ToDecimal 'If IvaPS = -1 Then ' Dim Drr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero())(0) - ' IvaPS = Drr("IVA").ToString().ToDouble() + ' IvaPS = Drr("IVA").ToString().ToDecimal() 'End If - Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble - Dim IEPSPSIVA As Double = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0) + Dim IEPSPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal + Dim IEPSPSIVA As Decimal = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0) Dim CveClasificacion As Integer = DrPS("CveClasificacion").ToString.ToEntero Dim Clasificacion As String = DrPS("Clasificacion").ToString Dim CveActivoFijo = HdnCveActivoFijo.Value.ToEntero @@ -6610,7 +6614,7 @@ Partial Class OC Dim IdCuentaComprometido As Integer = If(HdnCveCuentaComprometido.Value = String.Empty, -1, HdnCveCuentaComprometido.Value.ToEntero) Dim CveOrdenCompraDetalle As Integer = DtDetalle.MAX("CveOrdenCompraDetalle").ToEntero + 100 - AddPS(Cantidad, CvePS, PS, Observaciones, PrecioUnitario.ToDouble, Descuento, TotalPS, CveUnidadMedida, IvaPS, IEPSPS, IEPSPSIVA, CveClasificacion, UM, Clasificacion, CveSubProyecto, Proyecto, CveSubProyecto, SubProyecto, LblCodigo.Text, + AddPS(Cantidad, CvePS, PS, Observaciones, PrecioUnitario.ToDecimal, Descuento, TotalPS, CveUnidadMedida, IvaPS, IEPSPS, IEPSPSIVA, CveClasificacion, UM, Clasificacion, CveSubProyecto, Proyecto, CveSubProyecto, SubProyecto, LblCodigo.Text, CveActivoFijo, 0, CveOrdenCompraDetalle, CveOrdenCompra, IdCuentaPorEjercer, IdCuentaComprometido, DdlACGeneral1.SelectedValue.ToEntero, DdlACGeneral2.SelectedValue.ToEntero, DdlACGeneral3.SelectedValue.ToEntero, DdlACGeneral4.SelectedValue.ToEntero, DdlACGeneral5.SelectedValue.ToEntero, RetIVA, RetISR) @@ -7179,13 +7183,13 @@ Partial Class OC 'SE ACTUALIZA EL IVA DEL DtDetalle SI ES QUE AHORA SE VA A TOMAR EN CUENTA EL IVA For Each Row As DataRow In DtDetalle.Rows - If Not Math.Round(DdlIVA.SelectedValue.ToDouble, 2) = 1 Then + If Not Math.Round(DdlIVA.SelectedValue.ToDecimal, 2) = 1 Then Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=Row("CvePS").ToString.ToEntero).FiltroPrimero("") If DrPS IsNot Nothing Then - Row("IVAPorcentaje") = If(DrPS("IVA").ToString.ToEntero = -1, Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), 0) - Row("IVA") = Row("IVAPorcentaje").ToString.ToDouble * Row("Total").ToString.ToDouble - Row("RetIVAPorcentaje") = DrPS("RetIVA").ToString.ToDouble - Row("RetIVA") = Row("RetIVAPorcentaje").ToString.ToDouble * Row("Total").ToString.ToDouble + Row("IVAPorcentaje") = If(DrPS("IVA").ToString.ToEntero = -1, Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), 0) + Row("IVA") = Row("IVAPorcentaje").ToString.ToDecimal * Row("Total").ToString.ToDecimal + Row("RetIVAPorcentaje") = DrPS("RetIVA").ToString.ToDecimal + Row("RetIVA") = Row("RetIVAPorcentaje").ToString.ToDecimal * Row("Total").ToString.ToDecimal End If Else Row("IVA") = 0 @@ -7199,13 +7203,13 @@ Partial Class OC End Sub Private Sub CalculaGenerales() - Dim Subtotal As Double = DtDetalle.SUM("Total", "Total > 0") + DtDetalle.SUM("Descuento") - Dim Descuento As Double = DtDetalle.SUM("Descuento") - Dim SubTotalIEPSIVA As Double = DtDetalle.SUM("IEPSPSIVA") - Dim IVA As Double = DtDetalle.SUM("IVA") + SubTotalIEPSIVA - Dim SubTotalIEPS As Double = DtDetalle.SUM("IEPSPS") - Dim SubTotalRetIVA As Double = DtDetalle.SUM("RetIVA") - Dim SubTotalRetISR As Double = DtDetalle.SUM("RetISR") + Dim Subtotal As Decimal = DtDetalle.SUM("Total", "Total > 0") + DtDetalle.SUM("Descuento") + Dim Descuento As Decimal = DtDetalle.SUM("Descuento") + Dim SubTotalIEPSIVA As Decimal = DtDetalle.SUM("IEPSPSIVA") + Dim IVA As Decimal = DtDetalle.SUM("IVA") + SubTotalIEPSIVA + Dim SubTotalIEPS As Decimal = DtDetalle.SUM("IEPSPS") + Dim SubTotalRetIVA As Decimal = DtDetalle.SUM("RetIVA") + Dim SubTotalRetISR As Decimal = DtDetalle.SUM("RetISR") 'SUBTOTAL LblSubTotal.Text = (Subtotal).FormatoNumero @@ -7267,9 +7271,9 @@ Partial Class OC TrIEPS.Visible = True Else ImgAplicaRetenciones.ImageUrl = "/Metronic/assets/global/img/portlet-collapse-icon.png" - If Not TxtRetIVA.Text.ToDouble > 0 Then TrRetIVA.Visible = False - If Not TxtRetISR.Text.ToDouble > 0 Then TrRetISR.Visible = False - If Not TxtIEPS.Text.ToDouble > 0 Then TrIEPS.Visible = False + If Not TxtRetIVA.Text.ToDecimal > 0 Then TrRetIVA.Visible = False + If Not TxtRetISR.Text.ToDecimal > 0 Then TrRetISR.Visible = False + If Not TxtIEPS.Text.ToDecimal > 0 Then TrIEPS.Visible = False End If 'ImgAplicaRetenciones.ImageUrl = If(TrRetIVA.Visible, "/Metronic/assets/global/img/portlet-collapse-icon.png", "/Metronic/assets/global/img/portlet-expand-icon.png") @@ -7279,15 +7283,15 @@ Partial Class OC TxtRetISR.Text = TxtRetISR.Text.FormatoNumero TxtIEPS.Text = TxtIEPS.Text.FormatoNumero End Sub - Private Sub CargaRetenciones(RetIVA As Double, RetISR As Double, IEPS As Double) + Private Sub CargaRetenciones(RetIVA As Decimal, RetISR As Decimal, IEPS As Decimal) If RetIVA > 0 Or RetISR > 0 Or IEPS > 0 Then TrRetIVA.Visible = True - TxtRetIVA.Text = RetIVA.ToString.ToDouble.FormatoNumero + TxtRetIVA.Text = RetIVA.ToString.ToDecimal.FormatoNumero TrRetISR.Visible = True - TxtRetISR.Text = RetISR.ToString.ToDouble.FormatoNumero + TxtRetISR.Text = RetISR.ToString.ToDecimal.FormatoNumero TrIEPS.Visible = True - TxtIEPS.Text = IEPS.ToString.ToDouble.FormatoNumero + TxtIEPS.Text = IEPS.ToString.ToDecimal.FormatoNumero End If End Sub @@ -7366,7 +7370,7 @@ Partial Class OC Dim Retorno = True Dim DescuentoConceptos = DtDetalle.SUM("Descuento") - Dim DescuentoGeneral = TxtDescuento.Text.ToDouble + Dim DescuentoGeneral = TxtDescuento.Text.ToDecimal If DescuentoConceptos <> DescuentoGeneral Then Alert(String.Format("Los descuentos no cuadran. Por favor de verificar.({0}-{1})", DescuentoConceptos, DescuentoGeneral), TipoMensaje.MsgAdvertencia) @@ -7571,7 +7575,7 @@ Partial Class OC End If For Each row As GridViewRow In GvContratos.Rows - If row.FCTextBox("TxtCantContrato").Text.Trim.ToDouble > 0 And row.FCTextBox("TxtPrecioContrato").Text.Trim.ToDouble > 0 Then + If row.FCTextBox("TxtCantContrato").Text.Trim.ToDecimal > 0 And row.FCTextBox("TxtPrecioContrato").Text.Trim.ToDecimal > 0 Then Selecciono = True Exit For End If @@ -7584,9 +7588,9 @@ Partial Class OC DtDetalle.Rows.Clear() For Each row As GridViewRow In GvContratos.Rows - If row.FCTextBox("TxtCantContrato").Text.Trim.ToDouble > 0 And row.FCTextBox("TxtPrecioContrato").Text.Trim.ToDouble > 0 Then - Dim Cantidad As Double = row.FCTextBox("TxtCantContrato").Text.Trim.ToDouble - Dim Importe As Double = row.FCTextBox("TxtPrecioContrato").Text.Trim.ToDouble + If row.FCTextBox("TxtCantContrato").Text.Trim.ToDecimal > 0 And row.FCTextBox("TxtPrecioContrato").Text.Trim.ToDecimal > 0 Then + Dim Cantidad As Decimal = row.FCTextBox("TxtCantContrato").Text.Trim.ToDecimal + Dim Importe As Decimal = row.FCTextBox("TxtPrecioContrato").Text.Trim.ToDecimal Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=row.DataKey("CvePS").ToEntero).FiltroPrimero("") If DrPS Is Nothing Then @@ -7594,20 +7598,20 @@ Partial Class OC Exit Sub End If - Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble - Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble - Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble + Dim RetISR As Decimal = DrPS("RetISR").ToString.ToDecimal + Dim RetIVA As Decimal = DrPS("RetIVA").ToString.ToDecimal + Dim IvaPS As Decimal = DrPS("IVA").ToString.ToDecimal 'If IvaPS = -1 Then 'IVA DE LA SUCURSAL - ' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble + ' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDecimal 'End If - Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble - Dim IEPSPSIVA As Double = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0) + Dim IEPSPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal + Dim IEPSPSIVA As Decimal = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0) Dim IdCuentaPorEjercer As Integer = If(HdnCveCuentaPorEjercer.Value = String.Empty, -1, HdnCveCuentaPorEjercer.Value.ToEntero) Dim IdCuentaComprometido As Integer = If(HdnCveCuentaComprometido.Value = String.Empty, -1, HdnCveCuentaComprometido.Value.ToEntero) - Dim TotalPS As Double = If(Importe > 0, (Importe * Cantidad), 0) - Dim ImportePS As Double = If(Importe > 0, Importe, 0) + Dim TotalPS As Decimal = If(Importe > 0, (Importe * Cantidad), 0) + Dim ImportePS As Decimal = If(Importe > 0, Importe, 0) Dim CveOrdenCompraDetalle As Integer = DtDetalle.MAX("CveOrdenCompraDetalle").ToEntero + 100 @@ -7956,8 +7960,8 @@ Partial Class OC Dim CveUnidadMedida As Integer = RowPS("CveUnidadMedida").ToString().ToEntero() Dim Fecha As String = If(String.IsNullOrEmpty(dr("FechaEntrega").ToString()), "", If(IsDate(dr("FechaEntrega").ToString()), dr("FechaEntrega").ToString(), "")) - TieneError = Not objCotizacion.AddCotizacionDetalle(objCotizacion.CveCotizacion, CvePS, dr("PrecioUnitario").ToString().ToDecimal(), dr("Cantidad").ToString().ToDouble, CveUnidadMedida, - dr("Cantidad").ToString().ToDouble, Fecha, dr("Observacion").ToString(), CveOrdenCompraDetalle) + TieneError = Not objCotizacion.AddCotizacionDetalle(objCotizacion.CveCotizacion, CvePS, dr("PrecioUnitario").ToString().ToDecimal(), dr("Cantidad").ToString().ToDecimal, CveUnidadMedida, + dr("Cantidad").ToString().ToDecimal, Fecha, dr("Observacion").ToString(), CveOrdenCompraDetalle) If TieneError = True Then Exit For Next End If @@ -8179,7 +8183,7 @@ Partial Class OC ' Dim Promocion = TxtPromocion.Text.Trim ' Dim TCDecimal As Decimal = TxtTCCambioMoneda.Text.ToDecimal - ' Dim TCDouble As Double = TxtTCCambioMoneda.Text.ToDouble + ' Dim TCDouble As Double = TxtTCCambioMoneda.Text.ToDecimal ' If TipoMoneda = "2" Then ' Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OC/OC-(OCAlmacen)", 74, 0.0D, 0.0D, 1, Now, DdlProveedores.SelectedText, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) @@ -8196,16 +8200,16 @@ Partial Class OC ' LugarEntrega, 1, CveProveedor, CveOrdenCompra, UsuarioActual.CveUsuario, Ddlcliente.txtValue.Value.ToEntero, DdlVendedor.SelectedValue.ToEntero, txtobsprioridad.Text, IVA:=(IVA * TCDecimal), RetIVA:=(TxtRetIVA.Text.ToDecimal * TCDecimal), ' RetISR:=(TxtRetISR.Text.ToDecimal * TCDecimal), FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), ' Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveProveedorContacto:=CveProveedorContacto, - ' PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)) Then + ' PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2)) Then ' Err = True ' Else ' For Each dr As DataRow In DtDetalle.FiltraParametros("TipoDato IN (1)").Rows - ' If OC.UpdateOrdenCompraDetalle(dr("Cantidad").ToString.ToDouble, dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, (dr("Importe").ToString.ToDouble * TCDouble), dr("CveSubProyecto").ToString.ToEntero, + ' If OC.UpdateOrdenCompraDetalle(dr("Cantidad").ToString.ToDecimal, dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, (dr("Importe").ToString.ToDecimal * TCDouble), dr("CveSubProyecto").ToString.ToEntero, ' dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, dr("CveOrdenCompraDetalle").ToString.ToEntero, If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), - ' (dr("Descuento").ToString.ToDouble * TCDouble), IEPSPS:=(dr("IEPSPS").ToString.ToDouble * TCDouble), IEPSPSIVA:=(dr("IEPSPSIVA").ToString.ToDouble * TCDouble), IVA:=(dr("IVA").ToString.ToDouble * TCDouble), - ' RetIVA:=(dr("RetIVA").ToString.ToDouble * TCDouble), RetISR:=(dr("RetISR").ToString.ToDouble * TCDouble), Total:=(dr("Total").ToString.ToDouble * TCDouble), CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, - ' IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, - ' IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) <= 0 Then + ' (dr("Descuento").ToString.ToDecimal * TCDouble), IEPSPS:=(dr("IEPSPS").ToString.ToDecimal * TCDouble), IEPSPSIVA:=(dr("IEPSPSIVA").ToString.ToDecimal * TCDouble), IVA:=(dr("IVA").ToString.ToDecimal * TCDouble), + ' RetIVA:=(dr("RetIVA").ToString.ToDecimal * TCDouble), RetISR:=(dr("RetISR").ToString.ToDecimal * TCDouble), Total:=(dr("Total").ToString.ToDecimal * TCDouble), CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, + ' IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDecimal, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDecimal, + ' IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDecimal) <= 0 Then ' Err = True ' Exit For ' End If @@ -8233,16 +8237,16 @@ Partial Class OC ' LugarEntrega, 2, CveProveedor, CveOrdenCompra, UsuarioActual.CveUsuario, Ddlcliente.txtValue.Value.ToEntero, DdlVendedor.SelectedValue.ToEntero, txtobsprioridad.Text, IVA:=(IVA / TCDecimal), ' RetIVA:=(TxtRetIVA.Text.ToDecimal / TCDecimal), RetISR:=(TxtRetISR.Text.ToDecimal / TCDecimal), FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), ' Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveProveedorContacto:=CveProveedorContacto, - ' PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)) Then + ' PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2)) Then ' Err = True ' Else ' For Each dr As DataRow In DtDetalle.FiltraParametros("TipoDato IN (1)").Rows - ' If OC.UpdateOrdenCompraDetalle(dr("Cantidad").ToString.ToDouble, dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, (dr("Importe").ToString.ToDouble / TCDouble), dr("CveSubProyecto").ToString.ToEntero, + ' If OC.UpdateOrdenCompraDetalle(dr("Cantidad").ToString.ToDecimal, dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, (dr("Importe").ToString.ToDecimal / TCDouble), dr("CveSubProyecto").ToString.ToEntero, ' dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, dr("CveOrdenCompraDetalle").ToString.ToEntero, If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), - ' (dr("Descuento").ToString.ToDouble / TCDouble), IEPSPS:=(dr("IEPSPS").ToString.ToDouble / TCDouble), IEPSPSIVA:=(dr("IEPSPSIVA").ToString.ToDouble / TCDouble), IVA:=(dr("IVA").ToString.ToDouble / TCDouble), - ' RetIVA:=(dr("RetIVA").ToString.ToDouble / TCDouble), RetISR:=(dr("RetISR").ToString.ToDouble / TCDouble), Total:=(dr("Total").ToString.ToDouble / TCDouble), CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, - ' IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, - ' IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) <= 0 Then + ' (dr("Descuento").ToString.ToDecimal / TCDouble), IEPSPS:=(dr("IEPSPS").ToString.ToDecimal / TCDouble), IEPSPSIVA:=(dr("IEPSPSIVA").ToString.ToDecimal / TCDouble), IVA:=(dr("IVA").ToString.ToDecimal / TCDouble), + ' RetIVA:=(dr("RetIVA").ToString.ToDecimal / TCDouble), RetISR:=(dr("RetISR").ToString.ToDecimal / TCDouble), Total:=(dr("Total").ToString.ToDecimal / TCDouble), CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, + ' IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDecimal, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDecimal, + ' IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDecimal) <= 0 Then ' Err = True ' Exit For ' End If @@ -8425,7 +8429,7 @@ Partial Class OC Dim CvePS As Integer = DRow("CvePS").ToString.ToEntero - Dim PrecioUnitario As Double = 0 + Dim PrecioUnitario As Decimal = 0 Dim dr As DataRow = DtDetalle.NewRow Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("") @@ -8433,19 +8437,19 @@ Partial Class OC Alert("Ocurrió un error al cargar la información de los productos del archivo. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) Continue For End If - Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble - Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble + Dim RetIVA As Decimal = DrPS("RetIVA").ToString.ToDecimal + Dim RetISR As Decimal = DrPS("RetISR").ToString.ToDecimal Dim PS As String = DrPS("PS").ToString - Dim TotalPS As Double = If(PrecioUnitario > 0, PrecioUnitario * Cantidad, 0) + Dim TotalPS As Decimal = If(PrecioUnitario > 0, PrecioUnitario * Cantidad, 0) Dim CveUnidadMedida As Integer = DrPS("CveUnidadMedida").ToString.ToEntero Dim UM As String = DrPS("UnidadMedida").ToString - Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble + Dim IvaPS As Decimal = DrPS("IVA").ToString.ToDecimal 'If IvaPS = -1 Then ' Dim Drr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero())(0) - ' IvaPS = Drr("IVA").ToString().ToDouble() + ' IvaPS = Drr("IVA").ToString().ToDecimal() 'End If - Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble - Dim IEPSPSIVA As Double = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0) + Dim IEPSPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal + Dim IEPSPSIVA As Decimal = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0) Dim CveClasificacion As Integer = DrPS("CveClasificacion").ToString.ToEntero Dim Clasificacion As String = DrPS("Clasificacion").ToString Dim CveActivoFijo = HdnCveActivoFijo.Value.ToEntero @@ -8547,11 +8551,11 @@ Partial Class OC Dim CveContratoDetalle As Integer = GvRow.DataKey("CveContratoDetalle").ToEntero - Dim Cantidad As Double = GvRow.FCTextBox("TxtCantidad").Text.ToDouble + Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidad").Text.ToDecimal Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero Dim PS As String = GvRow.DataKey("PS") - Dim PU As Double = GvRow.DataKey("PU").ToDouble - Dim TotalPS As Double = GvRow.FCTextBox("TxtImporte").Text.ToDouble + Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal + Dim TotalPS As Decimal = GvRow.FCTextBox("TxtImporte").Text.ToDecimal Dim CveUnidadMedida As Integer = GvRow.DataKey("CveUnidadMedida") Dim UMAbreviatura As String = GvRow.DataKey("Abreviatura").ToString @@ -8562,16 +8566,16 @@ Partial Class OC Dim Proyecto As String = GvRow.DataKey("Proyecto") Dim CveProyecto As Integer = GvRow.DataKey("CveProyecto").ToEntero - Dim RetISR As Double = GvRow.DataKey("RetISR").ToString.ToDouble - Dim RetIVA As Double = GvRow.DataKey("RetIVA").ToString.ToDouble - Dim IvaPS As Double = GvRow.DataKey("IVA").ToString.ToDouble + Dim RetISR As Decimal = GvRow.DataKey("RetISR").ToString.ToDecimal + Dim RetIVA As Decimal = GvRow.DataKey("RetIVA").ToString.ToDecimal + Dim IvaPS As Decimal = GvRow.DataKey("IVA").ToString.ToDecimal Dim CveClasificacion As Integer = GvRow.DataKey("CveClasificacion").ToString.ToEntero Dim Clasificacion As String = GvRow.DataKey("Clasificacion") - Dim IEPSPS As Double = GvRow.DataKey("IEPSPorcentaje").ToString.ToDouble - Dim IEPSPSIVA As Double = If(GvRow.DataKey("IEPSGrabaIVA").ToString = "True", IEPSPS, 0) + Dim IEPSPS As Decimal = GvRow.DataKey("IEPSPorcentaje").ToString.ToDecimal + Dim IEPSPSIVA As Decimal = If(GvRow.DataKey("IEPSGrabaIVA").ToString = "True", IEPSPS, 0) Dim IdCuentaPorEjercer As Integer = -1 Dim IdCuentaComprometido As Integer = -1 diff --git a/OC/RepCotizacionesDetalle.aspx b/OC/RepCotizacionesDetalle.aspx index eeecd680b..09c87921f 100644 --- a/OC/RepCotizacionesDetalle.aspx +++ b/OC/RepCotizacionesDetalle.aspx @@ -294,158 +294,158 @@ - diff --git a/OC/RepCotizacionesDetalle.aspx.vb b/OC/RepCotizacionesDetalle.aspx.vb index 787112c96..5cbca26e8 100644 --- a/OC/RepCotizacionesDetalle.aspx.vb +++ b/OC/RepCotizacionesDetalle.aspx.vb @@ -208,8 +208,8 @@ Partial Class PopOCCotizacionesDetalle End If 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, - dr.DataKey("CveUnidadMedida").ToEntero, dr.FCTextBox("txtCantidadSurtir").Text.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.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").ToString.ToEntero) If TieneError = True Then Exit For @@ -230,12 +230,12 @@ Partial Class PopOCCotizacionesDetalle For Each dr As GridViewRow In GvDC.Rows 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 Dim strTemp = dr.DataKey("CveOrdenCompraDetalle").ToString 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 diff --git a/Ventas/RepCancelacionesPorRespuesta.aspx b/Ventas/RepCancelacionesPorRespuesta.aspx index 3c079264a..a159d3b16 100644 --- a/Ventas/RepCancelacionesPorRespuesta.aspx +++ b/Ventas/RepCancelacionesPorRespuesta.aspx @@ -41,7 +41,7 @@
-
+
" style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> @@ -49,12 +49,12 @@
- +
- + @@ -70,7 +70,7 @@ - + @@ -88,7 +88,7 @@
-
+
" style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> @@ -96,14 +96,14 @@
- +
- + @@ -115,7 +115,7 @@ - + @@ -123,10 +123,19 @@ - +
+
+ +
+
+
+
+ +
+
- +
diff --git a/Ventas/RepCancelacionesPorRespuesta.aspx.cs b/Ventas/RepCancelacionesPorRespuesta.aspx.cs index f00369605..e86360122 100644 --- a/Ventas/RepCancelacionesPorRespuesta.aspx.cs +++ b/Ventas/RepCancelacionesPorRespuesta.aspx.cs @@ -68,9 +68,9 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas } 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) { DivRefacturar.Visible = true; @@ -177,9 +177,25 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas string Nombre = GvRow.DataKey("Nombre"); 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 != "") { - 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) { @@ -463,7 +479,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas retorno.Mensaje = sb.ToString(); 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; var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion: true); @@ -480,12 +496,22 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas factura.CveEstatusRefacturacion = CveEstatusRefacturacion; } + if (CveMotivoCancelacion > 0) + { + factura.CveMotivoCancelacion = CveMotivoCancelacion; + } + int CveEstatusFactura = -1; //SI LA FACTURA YA ESTA CANCELADA, LA ASIGNA YA COMO CANCELADA if (CveEstatus == 5) { CveEstatusFactura = CveEstatus; } + //NO DEBE DE ASIGNAR ESTATUS + if (CveEstatus == -2) + { + CveEstatusFactura = -1; + } 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) { 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); - // string UsuarioServicio = "rene.molina@adsistemas.mx"; - // string ClaveServicio = "rene2018"; - // string UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + this.CveVenta = GvRow.DataKey("CveVentaSustitucion").ToEntero(); - // 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"); - // decimal Total = GvRow.DataKey("Total").ToDecimal(); - // 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); + int CveVentaOriginal = GvRow.DataKey("CveVenta").ToEntero(); + string SerieFolioOriginal = GvRow.DataKey("SerieFolio"); - // if (a.CodigoError != 0) - // { - // //no se pudo obtener, la mandamos cancelar - // Timbrado ObjCancelacion = new Timbrado(); + //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(); - // if (ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, Uuid, Total, RFCCliente, UsuarioActual.Empresa.RFC, 4, ValidaFactura:false, CveSATMotivoCancelacion: 1, FolioSustitucion: FolioFiscalSustitucion )) - // { - // string b = ObjCancelacion.CancelacionAcuse; - // //falta actualizar - // Alert("Se regeneró la solicitud de cancelación"); - // } + if (CveVenta > 0 && FolioSustitucion != "") + { + var respCancelacion = CancelarDocumento(CveVenta, -2, CveCliente, "", FolioSustitucion, "", DateTime.Now, TipoDocto, Total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: true, FolioSustitucion: "", CveEstatusRefacturacion: 4, CveMotivoCancelacion: CveMotivoCancelacion); + 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 {SerieFolioSustitucion} fue cambiado a 'Cancelación en proceso'."); + sb.Append("El documento se canceló correctamente."); + sb.Append($"
Imprimir Acuse"); + } + 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 {SerieFolioSustitucion} fue cambiado a 'Cancelada'."); + sb.Append("El documento se canceló correctamente."); + sb.Append($"
Imprimir Acuse"); + } - //} + if (respCancelacion.CveEstatus.Contiene(5,20)) + { + if (ObjVentas.UpdateEstatusVenta(CveVentaOriginal, 23, UsuarioActual.CveEmpresa, CveEstatusRefacturacion:4, CveMotivoCancelacion: CveMotivoCancelacion)) + { + sb.Append($"
La Factura {SerieFolioOriginal} 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("
Folio Fiscal: {0}
", FolioSustitucion); + sb.AppendFormat("Código Estado: {0}
", resp.CodigoEstatus); + sb.AppendFormat("Estado: {0}
", resp.Estado); + sb.AppendFormat("Es Cancelable: {0}
", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable); + sb.AppendFormat("Estatus de Cancelación: {0}

", 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}
", FolioSustitucion); + sb.AppendFormat("Código Estado: {0}
", resp.CodigoEstatus); + sb.AppendFormat("Estado: {0}
", resp.Estado); + sb.AppendFormat("Es Cancelable: {0}
", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable); + sb.AppendFormat("Estatus de Cancelación: {0}

", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion); + } + + sb.Append(respCancelacion.Mensaje); + } + + if (EnviarAcuse) + { + sb.Append("

¿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 { diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index e17048cde..879b6f7fd 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -3853,7 +3853,7 @@ <%----%> - + diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index e97a4095f..60ba09742 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -1266,6 +1266,14 @@ Partial Class Ventas ViewState("CveEstatusRefacturacion") = value End Set 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 Get @@ -4393,10 +4401,13 @@ Partial Class Ventas '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"))) If TienePermiso <> "" Then LkRefacturacion.Visible = True + If (CveEstatus = 5 AndAlso DbRowVenta("CveEstatusRefacturacion").ToString().ToEntero() = 4) Then + RefacturarCancelada = True + End If End If End If @@ -9106,6 +9117,15 @@ Partial Class Ventas 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 ObjVentas.Commit() @@ -9124,6 +9144,10 @@ Partial Class Ventas AutoConta = False End If + If UsuarioActual.CveEmpresa = 140 Then + AutoConta = True + End If + If AutoConta Then If idCuentaContabilizacion > 0 Then If ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then @@ -9134,13 +9158,14 @@ Partial Class Ventas End If Else 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 - - 'If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() - 'RMF, cuando es pedido, se manda autorización. If ObjFactura.TipoDocto.Contiene("PA") Then @@ -9156,9 +9181,6 @@ Partial Class Ventas ViewState("CveVenta") = ObjFactura.CveVenta - - - 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 @@ -9167,7 +9189,6 @@ Partial Class Ventas End If GVAnticipos.DataBind() - Try Dim DirectoriArchivoXML As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto) ' System.IO.Path.Combine() If Not Directory.Exists(DirectoriArchivoXML) Then @@ -9268,7 +9289,7 @@ Partial Class Ventas 'CANCELAR FACTURA ANTERIOR 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 MsgCancelacionRefacturacion = Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, FolioFiscalFactura) End If @@ -11975,8 +11996,13 @@ Partial Class Ventas factura.Alfa3 = "DEV" factura.DevolucionImportePagado = ObjFacturaNC.Total / ObjFacturaNC.PagadoBancos 'falta tomar el dato 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 = "" @@ -12162,9 +12188,33 @@ Partial Class Ventas 'Si es devolucion se agregan a la tabla de Vta_VentasDetalleDevolucion If factura.AplicaDevolucion Then - If Not ObjVentas.AddVentaDetalleDevolucion(Row("CveVentaDetalle").ToString().ToEntero(), ObjVentas.CveVentaDetalle, Row("Cantidad").ToString().ToDouble) Then + 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.") - End If + End Try + If ErrorList.Count = 0 Then If Not ObjEventos.AddEventoBitacora(String.Format("Se aplicó una devolución en Folio: {1}", factura.CveVenta, factura.SerieFolio), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVentaDevolucion) Then ErrorList.Add("Ocurrió un error al agregar la bitacora de devolución.") @@ -20881,129 +20931,134 @@ Partial Class Ventas 'End Sub Private Sub BtnNuevaFactura_Click(sender As Object, e As EventArgs) Handles LkRefacturacion.Click 'Nos vamos a la nueva factura - Dim script As String = "" - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then - Dim sb As New StringBuilder() + If RefacturarCancelada Then + Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1") + 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 - sb.Append("La factura se encuentra en el siguiente estatus del SAT:
") + 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:
") - Dim TotalT As Decimal = TxtTotal.Text.ToDecimal - Dim RFCReceptor As String = LblRFC.Text.Trim + Dim TotalT As Decimal = TxtTotal.Text.ToDecimal + Dim RFCReceptor As String = LblRFC.Text.Trim - 'SI SE FACTURO LA SUCURSAL DEL CLIENTE TOMA EL RFC DE ESTA - If FacturarSucursal AndAlso Me.ClienteSucursal IsNot Nothing Then - RFCReceptor = Me.ClienteSucursal.RFC - End If + 'SI SE FACTURO LA SUCURSAL DEL CLIENTE TOMA EL RFC DE ESTA + If FacturarSucursal AndAlso Me.ClienteSucursal IsNot Nothing Then + RFCReceptor = Me.ClienteSucursal.RFC + End If - Dim SWatch As New Stopwatch - SWatch.Start() + Dim SWatch As New Stopwatch + SWatch.Start() - Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True) - SWatch.Stop() + Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True) + SWatch.Stop() - Dim SegundosRespuesta As Double = SWatch.ElapsedMilliseconds / 1000 - SegundosRespuesta = SegundosRespuesta.ToEntero + Dim SegundosRespuesta As Double = SWatch.ElapsedMilliseconds / 1000 + SegundosRespuesta = SegundosRespuesta.ToEntero - If SegundosRespuesta >= 5 Then - Alert($"Los servicios de validacion del SAT presentan lentitud en la respuesta [{ SegundosRespuesta } s].", TipoMensaje.ToastError, "") - End If + If SegundosRespuesta >= 5 Then + Alert($"Los servicios de validacion del SAT presentan lentitud en la respuesta [{ SegundosRespuesta } s].", TipoMensaje.ToastError, "") + End If - If Vigencia IsNot Nothing Then + If Vigencia IsNot Nothing Then - If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then - sb.AppendFormat("{0}
", Vigencia.EsCancelable) + If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then + sb.AppendFormat("{0}
", Vigencia.EsCancelable) - DivRelacionadasRefacturacion.Visible = True - BtnMotivoRefacturacion.Visible = False - DivMotivoRefacturacionTexto.Visible = False + DivRelacionadasRefacturacion.Visible = True + BtnMotivoRefacturacion.Visible = False + DivMotivoRefacturacionTexto.Visible = False - Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) - If Relacionados IsNot Nothing Then - Dim sbExtra As New StringBuilder() - If Relacionados.Codigo = 500 Then - sbExtra.Append("El servicio de verificación de documentos relacionados no esta disponible.") - Else - sbExtra.Append(Relacionados.Mensaje) + Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) + If Relacionados IsNot Nothing Then + Dim sbExtra As New StringBuilder() + If Relacionados.Codigo = 500 Then + sbExtra.Append("El servicio de verificación de documentos relacionados no esta disponible.") + Else + sbExtra.Append(Relacionados.Mensaje) - Dim SbHijos = New StringBuilder() - Dim SbPadres = New StringBuilder() + Dim SbHijos = New StringBuilder() + Dim SbPadres = New StringBuilder() - 'If Relacionados.RelacionadosHijo IsNot Nothing Then - ' For Each hijo In Relacionados.RelacionadosHijo - ' SbHijos.AppendFormat("{0};", hijo.Uuid) - ' Next - ' If SbHijos.Length > 0 Then - ' 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() + 'If Relacionados.RelacionadosHijo IsNot Nothing Then + ' For Each hijo In Relacionados.RelacionadosHijo + ' SbHijos.AppendFormat("{0};", hijo.Uuid) + ' Next + ' If SbHijos.Length > 0 Then + ' SbHijos.Remove(SbHijos.Length - 1, 1) ' End If 'End If - If SbPadres.Length > 0 Then - If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then - GvFacturasPadreRefacturar.DataSource = ObjVentas.DtResultados.FiltraParametros($"CveVenta <> {CveVenta}") + 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 - 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 = $"
*{sbExtra.ToString()}" + End If - 'GvFacturasHijosCancelar.DataBind() - GvFacturasPadreRefacturar.DataBind() End If - - If sbExtra.Length > 0 Then - LbExtraRefacturacion.Text = $"
*{sbExtra.ToString()}" - End If - End If - End If - If Vigencia.EsCancelable = "Cancelable sin aceptación" Then - 'script = "BtnRefacturacionConfirmarAceptacion();" - Me.CveEstadoCancelacion = 1 - sb.AppendFormat("{0}
", Vigencia.EsCancelable) - sb.Append("Está seguro de realizar la refacturación?.") - End If + If Vigencia.EsCancelable = "Cancelable sin aceptación" Then + 'script = "BtnRefacturacionConfirmarAceptacion();" + Me.CveEstadoCancelacion = 1 + sb.AppendFormat("{0}
", Vigencia.EsCancelable) + sb.Append("Está seguro de realizar la refacturación?.") + End If - If Vigencia.EsCancelable = "Cancelable con aceptación" OrElse String.IsNullOrEmpty(Vigencia.EsCancelable) Then - 'script = "BtnRefacturacionConfirmar();" - Me.CveEstadoCancelacion = 2 - sb.AppendFormat("{0}
", "Cancelable con aceptación") - sb.Append("Está seguro de cancelar el documento para realizar la refacturación?.") + If Vigencia.EsCancelable = "Cancelable con aceptación" OrElse String.IsNullOrEmpty(Vigencia.EsCancelable) Then + 'script = "BtnRefacturacionConfirmar();" + Me.CveEstadoCancelacion = 2 + sb.AppendFormat("{0}
", "Cancelable con aceptació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("No encontrado
") End If Else - 'If Not UsuarioActual.Empresa.FacturaProduccion Then - ' script = "BtnRefacturacionConfirmar();" - 'End If - sb.Append("No encontrado
") + 'sb.Append("¿Desea realizar la refacturación?
") + script = "BtnRefacturacionConfirmarAceptacion();" End If - Else - 'sb.Append("¿Desea realizar la refacturación?
") - script = "BtnRefacturacionConfirmarAceptacion();" + + LblEstatusRefacturacion.Text = sb.ToString() + UpMotivoRefac.Update() + + RegistraScript("$('#DivMotivoRefacturacion').modal({ backdrop: 'static', keyboard: false });", "R1") + 'Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, JSBtnAceptar:=script, TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") End If - - LblEstatusRefacturacion.Text = sb.ToString() - UpMotivoRefac.Update() - - RegistraScript("$('#DivMotivoRefacturacion').modal({ backdrop: 'static', keyboard: false });", "R1") - 'Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, JSBtnAceptar:=script, TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") End If + End Sub 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()))) 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()))) DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) Else @@ -29656,6 +29711,11 @@ Partial Class Ventas CargaVendedores() + If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso Not TbDescuentosRNC.Visible Then + TbDescuentosRNC.Visible = True + LnkDescuentosRNC.Visible = UsuarioActual.TienePermisoProceso(328) + End If + UpPS.Update() UPPDescuento.Update() UPObservaciones.Update() @@ -31529,6 +31589,11 @@ Partial Class Ventas End Function 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 Alert("La sucursal no tiene asignada un RFC.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -34374,5 +34439,38 @@ Partial Class Ventas UpEmitirTransitorio.Update() End Sub #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.

Ver Poliza", IDPoliza) + End If + + ObjVentas.Dispose() + + 'Si se facturó la cotización hay que vincular la venta + Msgok.AppendFormat("Abono Registrado Correctamente.

Ver Poliza", IDPoliza) + + Else + ErrorList.Add("Ocurrió un error al generar A.C. en la Factura.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") + End If + + Else + Msgok.Append("Movimiento Registrado Correctamente.

") + End If + ObjAC.dispose + End Sub End Class