diff --git a/AF/AF.aspx.vb b/AF/AF.aspx.vb index 2dcae1e8e..d2779e6d3 100644 --- a/AF/AF.aspx.vb +++ b/AF/AF.aspx.vb @@ -1070,16 +1070,16 @@ Partial Class AF_AF TmpServicios.Columns.Add("OdHorometro", GetType(Double)) TmpServicios.Columns.Add("Observaciones", GetType(String)) - Dim Row As DataRow = TmpServicios.NewRow - Row("CveProveedor") = 3100 - Row("CveCompra") = 181656 - Row("Tipo") = "Preventivo" - Row("Fecha") = "01/02/2016" - Row("Proveedor") = "EMPRESAS MATCO, S.A. DE C.V." - Row("Factura") = "HERAA-158591" - Row("OdHorometro") = "198,567" - Row("Observaciones") = "Servicio Preventivo 200,000 Kilometros - Servicio Completo" - TmpServicios.Rows.Add(Row) + 'Dim Row As DataRow = TmpServicios.NewRow + 'Row("CveProveedor") = 3100 + 'Row("CveCompra") = 181656 + 'Row("Tipo") = "Preventivo" + 'Row("Fecha") = "01/02/2016" + 'Row("Proveedor") = "EMPRESAS MATCO, S.A. DE C.V." + 'Row("Factura") = "HERAA-158591" + 'Row("OdHorometro") = "198,567" + 'Row("Observaciones") = "Servicio Preventivo 200,000 Kilometros - Servicio Completo" + 'TmpServicios.Rows.Add(Row) GvServiciosMant.DataSource = TmpServicios GvServiciosMant.DataBind() diff --git a/Acumuladores/CatFoliosGarantia.aspx b/Acumuladores/CatFoliosGarantia.aspx index 5ca6a7a2a..06291a483 100644 --- a/Acumuladores/CatFoliosGarantia.aspx +++ b/Acumuladores/CatFoliosGarantia.aspx @@ -386,12 +386,12 @@
+ DataKeyNames="Consecutivo,CodigoCliente,Codigo,CodigoTipoUso,CodigoTipoDefecto,CodigoEnsamble,CodigoLinea,CodigoInspeccion,FechaVenta,FechaReclamacion,TipoComprobante,Comprobante,Autorizo,Comentarios,ClaveAutorizacion" BorderColor="#D3D3D3" GridLines="None"> - + diff --git a/Acumuladores/CatFoliosGarantia.aspx.vb b/Acumuladores/CatFoliosGarantia.aspx.vb index 512e7e593..3acab2744 100644 --- a/Acumuladores/CatFoliosGarantia.aspx.vb +++ b/Acumuladores/CatFoliosGarantia.aspx.vb @@ -265,7 +265,7 @@ Partial Class Acumuladores_CatFoliosGarantia '2.- Cliente-->100407 SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoCliente")) '3. Codigo De Articulo --> 171402 - SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoProducto")) + SbTxt.AppendFormat("{0}@", GvRow.DataKey("Codigo")) '4. Tipo De Uso --> A SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoTipoUso")) '5. Defecto --> P diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index d82eed1e6..4956aa129 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -1410,6 +1410,8 @@ Public Class ClsContabilidad _ContaIdPoliza = tIdPoliza _ContaFolio = ObjConta.Folio End If + Else + StrLog.AppendFormat(" Error 0.2 - ") End If Else diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 0fd71e90d..c4c0b3881 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -2918,11 +2918,12 @@ Public Class ClsInventarios #End Region #Region " INVENTARIOS - VENTAS " - Public Function EntregaAlmacenGet(CveVenta As Integer) As Boolean + Public Function EntregaAlmacenGet(CveVenta As Integer, Optional CveAlmacen As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_EntregaAlmacenGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 9ea0c4866..3672bca91 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -1517,7 +1517,7 @@ Public Class ClsMovimientos Optional CveCuenta As Integer = -1, Optional Grupo As String = "-1", Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, Optional CveMoneda As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional Tipo As Integer = -1, - Optional EsDistribuidor As Integer = -1) As Boolean + Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = Nothing, Optional FechaAplicadoF As Date = Nothing) As Boolean Dim Retorno As Boolean = False @@ -1546,7 +1546,12 @@ Public Class ClsMovimientos .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion .Add("@Tipo", SqlDbType.Int).Value = Tipo - .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + + + .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString + .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString + End With Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index ee26608db..1203a0395 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5276,14 +5276,14 @@ Public Class ClsPaginas Usuario.CerrarSession() End Sub - Public Sub Alert(Mensaje As String, Optional pOpcion As TipoMensaje = TipoMensaje.MsgInformacion, Optional JSBtnAceptar As String = "", Optional timeout As Integer = 5) + Public Sub Alert(Mensaje As String, Optional pOpcion As TipoMensaje = TipoMensaje.MsgInformacion, Optional JSBtnAceptar As String = "", Optional timeout As Integer = 5, Optional ShowCloseButton As Boolean = True) If DirectCast(pOpcion, Integer) >= 5 Then Mensaje = Mensaje.Replace("'"c, "\'").Replace(vbCrLf, "").Replace("""", "\'").Replace(vbLf, " ") JSBtnAceptar = JSBtnAceptar.Replace("'"c, "\'") Dim toastscript As String = String.Format("alertatoast({3},'{0}',function(){{{1}}},{2});", Mensaje, JSBtnAceptar, timeout, DirectCast(pOpcion, Integer)) ViewState("strToastMsglargonoreplace") = String.Format("{0}{1}", If(Not IsNothing(ViewState("strToastMsglargonoreplace")) AndAlso ViewState("strToastMsglargonoreplace").ToString().Length > 0, ViewState("strToastMsglargonoreplace").ToString(), ""), toastscript) Else - Mensaje.Alert(Mensaje, pOpcion, JSBtnAceptar, TimeoutToast:=timeout) + Mensaje.Alert(Mensaje, pOpcion, JSBtnAceptar, TimeoutToast:=timeout, ShowCloseButton:=ShowCloseButton) End If End Sub Protected Overridable Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender diff --git a/App_Code/ClsSubProyectos.vb b/App_Code/ClsSubProyectos.vb index 508c6f3de..f14b98c57 100644 --- a/App_Code/ClsSubProyectos.vb +++ b/App_Code/ClsSubProyectos.vb @@ -333,7 +333,7 @@ Public Class ClsSubProyectos Public Function AddCentroCosto(SubProyecto As String, IdSegNeg As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveProyecto As Integer, Optional Serie As String = "", Optional IVA As Double = 0.0, Optional Calle As String = "", Optional NoExt As String = "", Optional NoInt As String = "", Optional Colonia As String = "", Optional Localidad As String = "", Optional Municipio As String = "", Optional Estado As String = "", Optional Pais As String = "", Optional CP As String = "", Optional TipoSucursal As Integer = 0, Optional EsSucursal As Integer = 0, Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional AplicaComercioExterior As Boolean = False, Optional Correo As String = "", Optional CvePrecioLista As Integer = -1, - Optional Telefono As String = "") As Boolean + Optional Telefono As String = "", Optional NoVerificaAlmacen As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CentroCostoAdd") @@ -365,6 +365,7 @@ Public Class ClsSubProyectos .Add("@Correo", SqlDbType.VarChar).Value = Correo .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista .Add("@Telefono", SqlDbType.VarChar).Value = Telefono + .Add("@NoVerificaAlmacen", SqlDbType.Bit).Value = NoVerificaAlmacen .Add("@CveSubProyecto", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -387,7 +388,7 @@ Public Class ClsSubProyectos Public Function UpdateCentroCosto(CveSubProyecto As Integer, SubProyecto As String, IdSegNeg As Integer, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveProyecto As Integer, Optional Serie As String = "", Optional IVA As Double = 0.0, Optional Calle As String = "", Optional NoExt As String = "", Optional NoInt As String = "", Optional Colonia As String = "", Optional Localidad As String = "", Optional Municipio As String = "", Optional Estado As String = "", Optional Pais As String = "", Optional CP As String = "", Optional TipoSucursal As Integer = 0, Optional EsSucursal As Integer = 0, Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional AplicaComercioExterior As Boolean = False, Optional Correo As String = "", Optional CvePrecioLista As Integer = -1, - Optional Telefono As String = "", Optional HorarioVerano As Integer = Nothing, Optional HorarioInvierno As Integer = Nothing) As Boolean + Optional Telefono As String = "", Optional HorarioVerano As Integer = Nothing, Optional HorarioInvierno As Integer = Nothing, Optional NoVerificaAlmacen As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CentroCostoUpdate") @@ -423,6 +424,7 @@ Public Class ClsSubProyectos .Add("@Telefono", SqlDbType.VarChar).Value = Telefono .Add("@HorarioVerano", SqlDbType.Int).Value = HorarioVerano .Add("@HorarioInvierno", SqlDbType.Int).Value = HorarioInvierno + .Add("@NoVerificaAlmacen", SqlDbType.Bit).Value = NoVerificaAlmacen End With Try diff --git a/App_Code/ClsValidaCFDi.vb b/App_Code/ClsValidaCFDi.vb index 4707619ca..66d701fa5 100644 --- a/App_Code/ClsValidaCFDi.vb +++ b/App_Code/ClsValidaCFDi.vb @@ -83,18 +83,18 @@ Public Class ClsValidaCFDi Return Me.EsValida End Function - Private Sub VerificaCFDI() - + Private Sub VerificaCFDI() + Dim Importe As String = LImporte.ToString("F6").PadLeft(17, "0") + Dim MsgError As String = "" + Dim MsgError2 As String = "" Try Dim wsConsultaCFDI As New wsValidaCFDi2.ConsultaCFDIServiceClient - Dim oAcuse As New wsValidaCFDi2.Acuse - - 'oAcuse = wsConsultaCFDI.Consulta("?re=BEN9501023I0&rr=SARM8209281F1&tt=440.000000&id=EC609EC1-5F63-4333-A2B8-2EDC10B68075") - '?re=BEN9501023I0&rr=SARM8209281F1&tt=440.000000&id=EC609EC1-5F63-4333-A2B8-2EDC10B68075 - - Dim Importe As String = LImporte.ToString("F6").PadLeft(17, "0") - + Dim oAcuse As New wsValidaCFDi2.Acuse + + 'oAcuse = wsConsultaCFDI.Consulta("?re=BEN9501023I0&rr=SARM8209281F1&tt=440.000000&id=EC609EC1-5F63-4333-A2B8-2EDC10B68075") + '?re=BEN9501023I0&rr=SARM8209281F1&tt=440.000000&id=EC609EC1-5F63-4333-A2B8-2EDC10B68075 + oAcuse = wsConsultaCFDI.Consulta(String.Format("?re={0}&rr={1}&tt={2}&id={3}", LRFCEmisor, LRFCReceptor, Importe, LFolioFiscal.ToUpper)) 'oAcuse = wsConsultaCFDI.Consulta("?re=LESA6211234B2&rr=GCO890418M56&tt=0000001360.000000&id=0C8BAD9C-A8C6-4A48-8FF5-0687AC6F1581") 'Alert(oAcuse.Estado) @@ -106,18 +106,25 @@ Public Class ClsValidaCFDi End If If oAcuse.ValidacionEFOS = "100" Then - EnListaEFOS = True + EnListaEFOS = True Else EnListaEFOS = False - End If - - 'SI NO PUEDE ENCONTRAR EL ESTATUS UTILIZA EL SERVICIO PARA ESTATUS DE CANCELACION + End If + Catch ex As Exception + MsgError = "Op1. No se pudo validar la vigencia ante el SAT " + GuardaLog(String.Format("Op1. {0}", ex.Message)) + End Try + + Try + + + 'SI NO PUEDE ENCONTRAR EL ESTATUS UTILIZA EL SERVICIO PARA ESTATUS DE CANCELACION If EsValida = 0 Then Dim Vigencia = Timbrado.VerificarVigenciaSAT(LFolioFiscal.ToUpper, LRFCEmisor, LRFCReceptor, Importe, True) If Vigencia IsNot Nothing Then - If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then + If Not Vigencia.Estado.ToUpper().Contains("NO ENCONTRADO") AndAlso Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then EsValida = 1 End If If Vigencia.Estado.ToUpper().Contains("CANCELADO") Then @@ -132,18 +139,24 @@ Public Class ClsValidaCFDi End If Else EsValida = 0 + End If Else EsValida = 0 End If - End If - - Catch ex As Exception - OnError("Ocurrió un error al consultar la vigencia ante el SAT", ex) - End Try + End If + Catch ex As Exception + MsgError2 = "Op2. No se pudo validar la vigencia ante el SAT " + GuardaLog(String.Format("Op2. {0}", ex.Message)) + End Try + 'sino se pudo validar, que muestre el mensaje de error, pero solo un mensaje + If EsValida = 0 AndAlso (MsgError <> "" OrElse MsgError2 <> "") Then + If MsgError <> "" Then Alert(MsgError, TipoMensaje.MsgError) Else If MsgError2 <> "" Then Alert(MsgError2, TipoMensaje.MsgError) + End If + End Sub - Private Sub Verificar() + Private Sub VerificaWeb() Try Dim URL As String = "https://verificacfdi.facturaelectronica.sat.gob.mx/" diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 391461856..e864519ea 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -4507,11 +4507,16 @@ Public Class ClsVentas End Try Return retorno End Function - Public Function GetMetasVendedores(CveEmpresa As Integer) As Boolean + Public Function GetMetasVendedores(CveEmpresa As Integer, Optional CveSubProyecto As Integer = -1, Optional CveVendedor As Integer = -1, Optional CveMarca As Integer = -1, Optional Mes As Integer = -1, Optional Anio As Integer = -1) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_MetasVendedoresGet", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca + .Add("@Mes", SqlDbType.Int).Value = Mes + .Add("@Anio", SqlDbType.Int).Value = Anio End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index da8ccef26..ee3b331f1 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -311,7 +311,7 @@ Namespace Extensiones ToastAdventencia = 8 'Warning End Enum - Public Sub Alert(Obj As Object, Mensaje As String, pOpcion As TipoMensaje, Optional JSBtnAceptar As String = "", Optional TextoConfirmacion As String = "Aceptar", Optional TextoCancelacion As String = "Cancelar", Optional TimeoutToast As Integer = 5) + Public Sub Alert(Obj As Object, Mensaje As String, pOpcion As TipoMensaje, Optional JSBtnAceptar As String = "", Optional TextoConfirmacion As String = "Aceptar", Optional TextoCancelacion As String = "Cancelar", Optional TimeoutToast As Integer = 5, Optional ShowCloseButton As Boolean = True) If System.Web.HttpContext.Current IsNot Nothing AndAlso System.Web.HttpContext.Current.Handler IsNot Nothing AndAlso System.Web.HttpContext.Current.Handler.GetType().IsSubclassOf(GetType(Page)) Then Dim Titulo As String = "" @@ -331,6 +331,7 @@ Namespace Extensiones Dim b3title As String = "" Dim b3clas As String = "hide" Dim b3js As String = "" + Dim closeButtonOption As String = "" Select Case pOpcion Case TipoMensaje.MsgInformacion Titulo = " Información" @@ -371,15 +372,18 @@ Namespace Extensiones End Select Try - + 'No cerrar el alert obliga a hacer click en los botones de opcion + If Not ShowCloseButton Then + closeButtonOption = "backdrop : ""static"", keyboard : false, closeButton: false," + End If Dim Pag As Page = DirectCast(System.Web.HttpContext.Current.Handler, Page) Dim script As String = "" If showalert Then - script = String.Format("bootbox.dialog({{message: ""{0} "",className: ""{11}"",onEscape: function() {{ {12} }},title: ""{1}"",buttons: {{ success: {{ label: ""{2}"", className: "" {3}""," & + script = String.Format("bootbox.dialog({{message: ""{0} "", className: ""{11}"", {12} onEscape: function() {{ {12} }},title: ""{1}"",buttons: {{ success: {{ label: ""{2}"", className: "" {3}""," & "callback: function() {{ {4} }} }}, danger: {{ label: ""{5}"", className: "" {6}"",callback: function() {{ {7} }} }}," & "main: {{ label: ""{8}"", className: "" {9}"", callback: function() {{ {10} }} }} }} }});", - Mensaje, Titulo, b3title, b3clas, b3js, b2title, b2clas, b2js, b1title, b1clas, b1js, headerclas, onEscape) + Mensaje, Titulo, b3title, b3clas, b3js, b2title, b2clas, b2js, b1title, b1clas, b1js, headerclas, onEscape, closeButtonOption) Else script = String.Format("alertatoast({3},'{0}',function(){{{1}}},{2});", Mensaje, JSBtnAceptar, TimeoutToast, DirectCast(pOpcion, Integer)) @@ -3592,9 +3596,9 @@ Namespace Extensiones - End Class + End Class #End Region - + #Region "A T R I B U T O S" Public Class BasicAuthenticationAttribute Inherits AuthorizationFilterAttribute @@ -3660,7 +3664,7 @@ Namespace Extensiones actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized) actionContext.Response.Headers.Add("WWW-Authenticate", "Basic Scheme='Data' location = 'http://localhost:") End Sub - End Class + End Class #End Region - + End Namespace diff --git a/Bancos/FluctuacionCambiaria.aspx.vb b/Bancos/FluctuacionCambiaria.aspx.vb index 56901e562..bbc74193e 100644 --- a/Bancos/FluctuacionCambiaria.aspx.vb +++ b/Bancos/FluctuacionCambiaria.aspx.vb @@ -303,10 +303,8 @@ Partial Class Bancos_FluctuacionCambiaria Protected Sub BtnGeneraVentas_Click(sender As Object, e As EventArgs) - Dim Total As Decimal = 0 - Dim Conta As New ClsContabilidad - Conta.IniciaTransacSQL() - Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaV", 1, 0, 0, 1, TxtFecha.Text.ToDate, TxtConceptoVentas.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim Total As Decimal = 0 + Dim idCta As Integer = 0 Dim CveCuenta As Integer = 0 Dim CveCuentaPerdida, CveCuentaGanancia As Integer @@ -336,6 +334,15 @@ Partial Class Bancos_FluctuacionCambiaria TipoMovto = False End If + If Total = 0 Then + Alert("El Importe tiene que ser diferente a cero", TipoMensaje.MsgError) + Exit Sub + End If + + Dim Conta As New ClsContabilidad + Conta.IniciaTransacSQL() + Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaV", 1, 0, 0, 1, TxtFecha.Text.ToDate, TxtConceptoVentas.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Ventas", CveConceptoContable, "Fluctuación Ventas", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlsubProyectoVentas.SelectedValue.ToEntero) Then ErrorRegistrar = True End If diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 11f56d18e..fa3ad4341 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -690,7 +690,7 @@ Partial Class Bancos_PopIEVentas If Not UsuarioActual.Empresa.Funcionalidad(529) = "1" Then - Dim Valida As New ClsValidaCFDi(dr("FolioFiscal").ToString(), dr("ClienteRFC").ToString, UsuarioActual.Empresa.RFC) + Dim Valida As New ClsValidaCFDi(dr("FolioFiscal").ToString(), UsuarioActual.Empresa.RFC, dr("ClienteRFC").ToString, dr("Total").ToString.ToDecimal) If Valida.EsValida > 0 Then If Valida.EsValida = 2 Then @@ -713,9 +713,9 @@ Partial Class Bancos_PopIEVentas Else Validada = True End If - Else - 'no se pudo validar, pero ya tuvo la primera vuelta de validacion - Validada = True + Else + 'no se pudo validar, pero ya tuvo la primera vuelta de validacion + Validada = False End If Valida.Dispose() Else diff --git a/Bancos/RepCortes.aspx b/Bancos/RepCortes.aspx index c1a194e31..2f90c1b90 100644 --- a/Bancos/RepCortes.aspx +++ b/Bancos/RepCortes.aspx @@ -237,7 +237,7 @@ - + diff --git a/CRM/CatEmpresasCRM.aspx.cs b/CRM/CatEmpresasCRM.aspx.cs index 7a539f16b..61451a357 100644 --- a/CRM/CatEmpresasCRM.aspx.cs +++ b/CRM/CatEmpresasCRM.aspx.cs @@ -221,7 +221,7 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas } else { - Alert(String.Format("El Giro de Empresa '{0}'", Giro), ModExtensiones.TipoMensaje.MsgAdvertencia); + Alert(String.Format("El Giro de Empresa '{0}', No está especificado", Giro), ModExtensiones.TipoMensaje.MsgAdvertencia); TieneError = true; break; } diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 66bddceac..283f3403f 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -3217,6 +3217,12 @@
+
+ +
+ +
+
-
- - +
+
+
+ + +
+
+
+
+ + +
+
+ diff --git a/Planeacion/CatSubProyectos.aspx.vb b/Planeacion/CatSubProyectos.aspx.vb index 0d8a3fcd5..60ad9a7b2 100644 --- a/Planeacion/CatSubProyectos.aspx.vb +++ b/Planeacion/CatSubProyectos.aspx.vb @@ -296,6 +296,7 @@ Partial Class CatSubProyectos CargaColonia() DdlColonia.SelectedValueExist(GvRow.DataKey("CveColonia")) AplicaComercio() + ChkNoVerificaAlmacen.Checked = If(GvRow.DataKey("NoVerificaAlmacen").ToString = "True", True, False) BtnGuardar.Text = "Actualizar" CargaRequired() @@ -365,7 +366,7 @@ Partial Class CatSubProyectos If Not ObjSubproyectos.AddCentroCosto(TxtCentroCosto.Text.Trim, IdSeg, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExt.Text.Trim, NoInt:=TxtNoInt.Text.Trim, Colonia:=TxtColonia.Text.Trim, Localidad:=TxtLocalidad.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstado.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal, CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, Correo:=TxtCorreo.Text, CvePrecioLista:=DdlPrecioLista.SelectedValue.ToEntero, - Telefono:=TxtTelefono.Text) Then + Telefono:=TxtTelefono.Text, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked) Then TieneError = True Else CveSubProyecto = ObjSubproyectos.CveSubProyecto @@ -375,7 +376,7 @@ Partial Class CatSubProyectos If Not ObjSubproyectos.UpdateCentroCosto(CveCentroCosto, TxtCentroCosto.Text.Trim, IdSeg, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExt.Text.Trim, NoInt:=TxtNoInt.Text.Trim, Colonia:=TxtColonia.Text.Trim, Localidad:=TxtLocalidad.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstado.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal, CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, Correo:=TxtCorreo.Text, CvePrecioLista:=DdlPrecioLista.SelectedValue.ToEntero, - Telefono:=TxtTelefono.Text, HorarioVerano:=TxtHorarioVerano.Text.ToEntero, HorarioInvierno:=TxtHorarioInvierno.Text.ToEntero) Then + Telefono:=TxtTelefono.Text, HorarioVerano:=TxtHorarioVerano.Text.ToEntero, HorarioInvierno:=TxtHorarioInvierno.Text.ToEntero, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked) Then TieneError = True End If Else diff --git a/RH/Personal.aspx b/RH/Personal.aspx index f98389e8e..7470dab84 100644 --- a/RH/Personal.aspx +++ b/RH/Personal.aspx @@ -833,7 +833,7 @@ - @@ -1302,7 +1302,7 @@
- + @@ -1311,7 +1311,7 @@
- + diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index 0224875e2..c54647919 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -5183,6 +5183,10 @@ Partial Class RH_Personal If row.DataKey("AplicaSerie").ToString = "True" Then divSerie.Visible = True + TxtLiberarSerie.Text = row.DataKey("Serie") + TxtLiberarSerie.Enabled = False + TxtCantidadResguardo.Enabled = False + TxtCantidadResguardo.Text = "1" End If diff --git a/Sistemas/CatSesiones.aspx.vb b/Sistemas/CatSesiones.aspx.vb index 0d7a489d3..9e6d1ed9b 100644 --- a/Sistemas/CatSesiones.aspx.vb +++ b/Sistemas/CatSesiones.aspx.vb @@ -533,6 +533,7 @@ Partial Class Sistemas_CatSesiones End If End If ObjGral.Dispose() + Application("TipoCambioActual") = Nothing End Sub Private Sub CargarEquivalencias() diff --git a/Ventas/CatClientesClasificaciones.aspx.vb b/Ventas/CatClientesClasificaciones.aspx.vb index 76768a4da..709c823c9 100644 --- a/Ventas/CatClientesClasificaciones.aspx.vb +++ b/Ventas/CatClientesClasificaciones.aspx.vb @@ -119,9 +119,7 @@ Partial Class Ventas_ClientesClasificaciones Private Sub CargaGlobal() - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClienteClasificacion(-1) Then Application("GlobalDTClienteClasificaciones") = ObjClientes.DtResultados Else Application("GlobalDTClienteClasificaciones") = Nothing - ObjClientes.Dispose() + GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa) = Nothing End Sub diff --git a/Ventas/CatMetasVendedores.aspx b/Ventas/CatMetasVendedores.aspx index 555c0f8b9..d02cb68a3 100644 --- a/Ventas/CatMetasVendedores.aspx +++ b/Ventas/CatMetasVendedores.aspx @@ -1,171 +1,261 @@ -<%@ Page Title="Catálogo de metas para vendedores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatMetasVendedores.aspx.vb" Inherits="CatMetasVendedores" %> - -<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> - - - - - - - - Catálogo de metas para vendedores - - - - -
  • - Agregar Meta -
  • -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +<%@ Page Title="Catálogo de metas para vendedores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatMetasVendedores.aspx.vb" Inherits="CatMetasVendedores" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de metas para vendedores + + + + +
  • + Agregar Meta +
  • +
    +
    +
  • + Importar Listado +
  • +
    + + + +
    +
    +
    + + +
    +
    +
    + +
    + + +
    + +
    +
    + + + + +
    + + +
    + +
    + + +
    + +
    + + +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%--CARGA EXCEL--%> + +
    + + diff --git a/Ventas/CatMetasVendedores.aspx.vb b/Ventas/CatMetasVendedores.aspx.vb index 5a956cdb6..db8d9ff24 100644 --- a/Ventas/CatMetasVendedores.aspx.vb +++ b/Ventas/CatMetasVendedores.aspx.vb @@ -1,7 +1,7 @@ -Imports System.Data -Imports System.Linq +Imports System.Data Imports Extensiones - +Imports GemBox.Spreadsheet + Partial Class CatMetasVendedores Inherits ClsPaginas Private Property CveMetaVendedor() As Integer 'Guardamos el ID de registro para saber cual registro Editar @@ -14,21 +14,50 @@ Partial Class CatMetasVendedores End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - CargaDatos() + If Not IsPostBack Then CargaDatosModal() + CargaCombos() + CargaDatos() End If End Sub - Private Sub CargaDatos() + Private Sub CargaDatos() + Dim Mes As Integer = -1, Anio As Integer = -1 + If Not String.IsNullOrEmpty(txtMesAnio.Text) Then + Dim FechaRef As DateTime = txtMesAnio.Text.ToDate() + Mes = FechaRef.Month + Anio = FechaRef.Year + End If + Dim ObjVentas As New ClsVentas - If ObjVentas.GetMetasVendedores(UsuarioActual.CveEmpresa) Then + If ObjVentas.GetMetasVendedores(UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveMarca:=DdlMarca.SelectedValue.ToEntero(), Mes:=Mes, Anio:=Anio) Then GvDatos.DataSource = ObjVentas.DtResultados End If ObjVentas.Dispose() GvDatos.DataBind() End Sub + Private Sub CargaCombos() + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem("Todas", "-1")) + + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedor.DataBind() + DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1")) + + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetMarcas(UsuarioActual.CveEmpresa) Then + DdlMarca.DataSource = ObjPS.DtResultados + End If + ObjPS.Dispose() + + DdlMarca.DataBind() + DdlMarca.Items.Insert(0, New ListItem("Todas", "-1")) + + + End Sub + Private Sub CargaDatosModal() DdlVendedores.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) DdlVendedores.DataBind() @@ -122,5 +151,238 @@ Partial Class CatMetasVendedores ObjVentas.Dispose() CargaDatos() UpDatos.Update() + End Sub + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + UpDatos.Update() + End Sub + + Private Sub BtnDescargarFormato_Click(sender As Object, e As EventArgs) Handles BtnDescargarFormato.Click + + Dim DtExcel As New DataTable + DtExcel.TableName = "Metas" + DtExcel.Columns.Add(New DataColumn("Vendedor", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Clasificación Superior", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Clasificación", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Marca", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Mes", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Año", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Cantidad", GetType(Decimal))) + DtExcel.Columns.Add(New DataColumn("Importe", GetType(Decimal))) + + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + + Dim FileExcel As New ExcelFile() + + Dim worksheet = FileExcel.Worksheets.Add(DtExcel.TableName) + worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With + { + .ColumnHeaders = True, + .StartRow = 0, + .StartColumn = 0 + }) + worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255) + + Dim columnCount = worksheet.CalculateMaxUsedColumns() + For i = 0 To columnCount + worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1)) + Next + + worksheet.Cells.Style.Locked = False + worksheet.Cells.Style.FormulaHidden = False + + worksheet.Rows(0).Cells.Style.Locked = True + + worksheet.Protected = True + + Dim protectionSettings = worksheet.ProtectionSettings + protectionSettings.AllowDeletingColumns = False + protectionSettings.AllowDeletingRows = True + protectionSettings.AllowEditingObjects = True + protectionSettings.AllowEditingScenarios = True + protectionSettings.AllowFormattingCells = True + protectionSettings.AllowFormattingColumns = True + protectionSettings.AllowFormattingRows = True + protectionSettings.AllowInsertingColumns = False + protectionSettings.AllowInsertingRows = True + protectionSettings.AllowSelectingLockedCells = True + protectionSettings.AllowSelectingUnlockedCells = True + protectionSettings.AllowSelectingUnlockedCells = True + protectionSettings.AllowSorting = True + protectionSettings.AllowUsingAutoFilter = True + protectionSettings.AllowUsingPivotTableReports = True + protectionSettings.SetPassword(ModExtensiones.IMEI) + + FileExcel.Save(Response, "Metas.xlsx", SaveOptions.XlsxDefault) + + End Sub + + Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click + If TxtExcel.getfiles().Archivos.Count > 0 Then + Dim file As Archivo = TxtExcel.getfiles().Archivos(0) + Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch + CargarArchivo(Directorio, file.filename) + Else + Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError) + End If End Sub + Private Sub CargarArchivo(Ruta As String, FileName As String) + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + Dim Tipo As String = "EXCEL" + Dim dt As DataTable = Nothing + Dim ErrorArchivo = False + + Try + dt = ReadExcelFile(Ruta + FileName, True) + Catch ex As Exception + ErrorArchivo = True + OnError("Ocurrio un error al leer el archivo
    " & ex.Message, ex) + End Try + If Not ErrorArchivo AndAlso dt IsNot Nothing Then + + If Not dt.Columns(0).ColumnName = "Vendedor" Then + Alert("El nombre de la primera columna debe ser 'Vendedor'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(1).ColumnName = "Clasificación Superior" Then + Alert("El nombre de la segunda columna debe ser 'Clasificación Superior'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(2).ColumnName = "Clasificación" Then + Alert("El nombre de la tercera columna debe ser 'Clasificación'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(3).ColumnName = "Marca" Then + Alert("El nombre de la cuarta columna debe ser 'Marca'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(4).ColumnName = "Mes" Then + Alert("El nombre de la quinta columna debe ser 'Marca'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(5).ColumnName = "Año" Then + Alert("El nombre de la sexta columna debe ser 'Año'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(6).ColumnName = "Cantidad" Then + Alert("El nombre de la sexta columna debe ser 'Cantidad'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(7).ColumnName = "Importe" Then + Alert("El nombre de la septima columna debe ser 'Importe'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + Dim DtMarcas As DataTable = Nothing + Dim ObjMarcas As New ClsProductosServicios + If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then + DtMarcas = ObjMarcas.DtResultados.Copy() + End If + ObjMarcas.Dispose() + + dt.TableName = "Datos" + Dim ProductosNoCargados As New StringBuilder() + Dim RowsCargados As Integer = 0 + Dim RowsNoCargados As Integer = 0 + Dim ObjMetas As New ClsVentas + 'ObjPS.IniciaTransacSQL() + Try + Dim DtVendedores As DataTable = GlobalDTVendedores(UsuarioActual.CveEmpresa) + Dim DtClasificaciones As DataTable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + Dim DtClasificaciones2 As DataTable = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) + + For Each row As DataRow In dt.Rows + Dim Correcto As Boolean = False + Dim TieneError As Boolean = False + Dim CveVendedor As Integer = DtVendedores.FiltroPrimeroValor("CveVendedor", String.Format("Vendedor LIKE '%{0}%'", row("Vendedor").ToString().TrimStart().TrimEnd())).ToEntero + Dim CveClasificacion As Integer = DtClasificaciones.FiltroPrimeroValor("CveClasificacion", String.Format("Clasificacion='{0}'", row("Clasificación Superior").ToString().TrimStart().TrimEnd())).ToEntero + Dim CveClasificacion2 As Integer = DtClasificaciones2.FiltroPrimeroValor("CveClasificacion", String.Format("Clasificacion='{0}'", row("Clasificación").ToString().TrimStart().TrimEnd())).ToEntero + Dim CveMarca As Integer = DtMarcas.FiltroPrimeroValor("CveMarca", String.Format("Marca='{0}'", row("Marca").ToString().TrimStart().TrimEnd())).ToEntero + + Dim Mes As Decimal = row("Mes").ToString().ToDecimal() + Dim Anio As Decimal = row("Año").ToString().ToDecimal() + Dim Cantidad As Decimal = row("Cantidad").ToString().ToDecimal() + Dim Importe As Decimal = row("Importe").ToString().ToDecimal() + + Dim FechaRef As New DateTime(Anio, Mes, 1) + If CveVendedor > 0 AndAlso CveVendedor > 0 AndAlso CveClasificacion > 0 AndAlso CveClasificacion2 > 0 AndAlso CveMarca > 0 Then + Correcto = ObjMetas.AddMetasVendedores(CveVendedor, FechaRef, CveMarca, Cantidad, Importe, CveClasificacion2, CveClasificacion) + If Correcto Then + RowsCargados += 1 + End If + End If + + If Not Correcto Then + RowsNoCargados += 1 + End If + Next + Catch ex As Exception + OnError("Ocurrió un error al cargar los precios.", ex) + Finally + ObjMarcas.Dispose() + + Dim MensajeFinal As New StringBuilder() + If RowsNoCargados = 0 AndAlso RowsCargados > 0 Then + MensajeFinal.Append("Las metas se cargaron correctamente.

    ") + End If + If RowsCargados > 0 Then + MensajeFinal.Append("Se cargaron " & RowsCargados & " metas correctamente.") + End If + If RowsNoCargados > 0 Then + MensajeFinal.Append("No se pudieron actualizar " & RowsNoCargados & " metas.
    ") + End If + + Alert(MensajeFinal.ToString()) + + End Try + + End If + End Sub + + Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath) + + Dim unnamed As Integer = 0 + Dim cols As Integer + Dim columns As String() + Dim curRow As Integer = 0 + Dim curCol As Integer = 0 + Dim dataTable As DataTable = New DataTable() + Dim worksheet As ExcelWorksheet = excelFile.Worksheets(0) + + For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1 + + If firstRowHasHeaders Then + + If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then + dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString()) + Else + dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed))) + End If + + curRow = 1 + Else + dataTable.Columns.Add("Column " & (cols + 1)) + End If + Next + + While curRow < worksheet.Rows.Count + columns = New String(cols - 1) {} + + For curCol = 0 To cols - 1 + + If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then + columns(curCol) = "" + Else + columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString() + End If + Next + + dataTable.Rows.Add(columns) + curRow += 1 + End While + + Return dataTable + End Function End Class diff --git a/Ventas/MetasVendedores.aspx.vb b/Ventas/MetasVendedores.aspx.vb index 93278664a..984b62242 100644 --- a/Ventas/MetasVendedores.aspx.vb +++ b/Ventas/MetasVendedores.aspx.vb @@ -79,24 +79,24 @@ Partial Class MetasVendedores e.Row.FCLabel("lblRealAcumuladoPorcentaje").Text = String.Format("{0}{1}", e.Row.FCLabel("lblRealAcumuladoPorcentaje").Text, "%") 'e.Row.FCLabel("lblVarVSAAPerc").Text = String.Format("{0}{1}", e.Row.FCLabel("lblVarVSAAPerc").Text, "%") - Select Case e.Row.DataKey("Etiqueta") - Case "GrupoSuperior" - e.Row.CssClass = "GrupoSuperior" - ' e.Row.FCLabel("lblRealMes").Text = "" - ' e.Row.FCLabel("lblVtaMesAA").Text = "" - ' e.Row.FCLabel("lblObjMes").Text = "" - ' e.Row.FCLabel("lblRealAcumulado").Text = "" - ' e.Row.FCLabel("lblRealMesPorcentaje").Text = "" - ' e.Row.FCLabel("lblAAntAcumulado").Text = "" - ' e.Row.FCLabel("lblObjAcumulado").Text = "" - ' e.Row.FCLabel("lblVarVSAAPerc").Text = "" - ' e.Row.FCLabel("lblVarVSAA").Text = "" - ' e.Row.FCLabel("lblVarVSObjAcum").Text = "" - Case "Categoria" + Select Case e.Row.DBCampo("TipoFila") + Case "1" + e.Row.CssClass = "GrupoSuperior" + ' e.Row.FCLabel("lblRealMes").Text = "" + ' e.Row.FCLabel("lblVtaMesAA").Text = "" + ' e.Row.FCLabel("lblObjMes").Text = "" + ' e.Row.FCLabel("lblRealAcumulado").Text = "" + ' e.Row.FCLabel("lblRealMesPorcentaje").Text = "" + ' e.Row.FCLabel("lblAAntAcumulado").Text = "" + ' e.Row.FCLabel("lblObjAcumulado").Text = "" + ' e.Row.FCLabel("lblVarVSAAPerc").Text = "" + ' e.Row.FCLabel("lblVarVSAA").Text = "" + ' e.Row.FCLabel("lblVarVSObjAcum").Text = "" + Case "2" e.Row.CssClass = "Totales" - Case "Clasificacion" + Case "3" e.Row.CssClass = "SubTotales2" - Case "Clasificacion2" + Case "4" e.Row.CssClass = "SubTotales" End Select diff --git a/Ventas/RepRecuperacion.aspx b/Ventas/RepRecuperacion.aspx index 502929933..977e05630 100644 --- a/Ventas/RepRecuperacion.aspx +++ b/Ventas/RepRecuperacion.aspx @@ -179,7 +179,7 @@
    -
    Fecha Inicio:
    +
    Fecha Aplicado Inicio:
    @@ -194,7 +194,7 @@
    -
    Fecha Fin:
    +
    Fecha Aplicado Fin:
    diff --git a/Ventas/RepRecuperacion.aspx.vb b/Ventas/RepRecuperacion.aspx.vb index d6303d9a0..c3c3b4e99 100644 --- a/Ventas/RepRecuperacion.aspx.vb +++ b/Ventas/RepRecuperacion.aspx.vb @@ -158,11 +158,12 @@ Partial Class Ventas_RepRecuperacion Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim Css As String = "Texto" - Dim FechaI, FechaF As String + Dim FechaI, FechaF, FechaAplicadoI, FechaAplicadoF As String Dim CveClienteSucursal As Integer = -1 FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") - FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") - + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") + FechaAplicadoI = If(IsDate(TxtFechaAplicadoI.Text.Trim()), TxtFechaAplicadoI.Text.Trim(), MinFecha.ToShortDateString.ToString) + FechaAplicadoF = If(IsDate(TxtFechaAplicadoF.Text.Trim()), TxtFechaAplicadoF.Text.Trim(), MaxFecha.ToShortDateString.ToString) If e.Row.DBCampo("Orden") = "" Then e.Row.CssClass = "Totales" End If @@ -174,15 +175,15 @@ Partial Class Ventas_RepRecuperacion End If End If - Dim Liga4 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}", + Dim Liga4 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}&FechaAplicadoI={20}&FechaAplicadoF={21}", DdlGrupo.SelectedValue, e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), - e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 2, e.Row.DBCampo("EsDistribuidor")) + e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 2, e.Row.DBCampo("EsDistribuidor"), FechaAplicadoI, FechaAplicadoF) e.Row.FCHyperLink("HplPagado").NavigateUrl = Liga4 - Dim Liga5 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}", + Dim Liga5 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}&FechaAplicadoI={20}&FechaAplicadoF={21}", DdlGrupo.SelectedValue, e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), - e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 1, e.Row.DBCampo("EsDistribuidor")) + e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 1, e.Row.DBCampo("EsDistribuidor"), FechaAplicadoI, FechaAplicadoF) e.Row.FCHyperLink("HplVendido").NavigateUrl = Liga5 diff --git a/Ventas/RepRecuperacionDetalle.aspx b/Ventas/RepRecuperacionDetalle.aspx index b674b640d..a4b0ca3b5 100644 --- a/Ventas/RepRecuperacionDetalle.aspx +++ b/Ventas/RepRecuperacionDetalle.aspx @@ -186,6 +186,36 @@
    +
    Fecha Aplicado Inicio:
    +
    +
    + + + + +
    + + + + + + +
    +
    Fecha Aplicado Fin:
    +
    +
    + + + + +
    + + + + + + +
    diff --git a/Ventas/RepRecuperacionDetalle.aspx.vb b/Ventas/RepRecuperacionDetalle.aspx.vb index 586baddf7..76a99761f 100644 --- a/Ventas/RepRecuperacionDetalle.aspx.vb +++ b/Ventas/RepRecuperacionDetalle.aspx.vb @@ -85,7 +85,7 @@ Partial Class Ventas_RepRecuperacionDetalle Private Sub CargaCombos() Dim CveCliente, CveVendedor, CveUsuario, CveSubProyecto, CveEstatus, CveResponsable, CveAgrupador, CveBanco, CveCuenta, CveClienteSucursal, CveMoneda, CveClienteClasificacion As Integer - Dim FechaI, FechaF, TipoDocto, TipoCambio As String + Dim FechaI, FechaF, TipoDocto, TipoCambio, FechaAplicadoI, FechaAplicadoF As String 'Carga Clientes If (UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1") Then @@ -144,7 +144,17 @@ Partial Class Ventas_RepRecuperacionDetalle End If If FechaI <> "-1" Then txtFechaI.Text = FechaI + End If + + FechaAplicadoI = If(Request("FechaAplicadoI") IsNot Nothing, Request("FechaAplicadoI").ToString, "-1").ToString + FechaAplicadoF = If(Request("FechaAplicadoF") IsNot Nothing, Request("FechaAplicadoF").ToString, "-1").ToString + If FechaAplicadoF <> "-1" Then + TxtFechaAplicadoF.Text = FechaAplicadoF End If + If FechaAplicadoI <> "-1" Then + TxtFechaAplicadoI.Text = FechaAplicadoI + End If + TipoDocto = IfNull(Request("TipoDocto"), "-1").ToString CveClienteSucursal = IfNull(Request("CveClienteSucursal"), "-1").ToString.ToEntero @@ -229,7 +239,7 @@ Partial Class Ventas_RepRecuperacionDetalle Iva.ToString, DdlGrupo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlResponsable.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveBanco:=DdlBanco.SelectedValue.ToEntero, CveCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero, Grupo:=Grupo, TipoCambio:=RblTipoCambio.SelectedValue.ToEntero, TCEspecifico:=TCEspecifico, CveMoneda:=DdlMoneda.SelectedValue.ToEntero, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, Tipo:=Tipo, - EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero()) Then + EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero(), FechaAplicadoI:=TxtFechaAplicadoI.Text.ToDate, FechaAplicadoF:=TxtFechaAplicadoF.Text.ToDate) Then GvDatos.DataSource = ObjMovtos.DtResultados DtDatos = ObjMovtos.DtResultados diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 38f0a6c74..fb94fa794 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5459,7 +5459,9 @@ Partial Class Ventas DdlMetodoPago33.Enabled = True End If - If CveVenta <= 0 Or EsCreaApartirDe Or NuevaFactura = 1 Then + Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() + + If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 Then CveMetodoPagoCliente = ObjCliente.CveMetodoPago @@ -6241,7 +6243,9 @@ Partial Class Ventas ViewState("CliNoInt") = ObjCliente.NoInt PlazoCobranza = ObjCliente.PlazoCobranza - If CveVenta <= 0 Then + Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() + + If CveVenta <= 0 AndAlso CveCotizacion <= 0 Then CveMetodoPagoCliente = ObjCliente.CveMetodoPago DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33) @@ -21405,7 +21409,7 @@ Partial Class Ventas LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ObjetoPDF, .NombreArchivo = $"AcuseCancelacion{Serie}-{Folio}.pdf"}) If ObjMail.SendMail(EmpresaActual, Mail, Asunto, Cuerpo, MailCC, LSRutasMail, Displayname:=DisplayName) Then ResultadoMail = 1 - Alert("El acuse de cancelación ha sido envíado correctamente.") + Alert("El acuse de cancelación ha sido envíado correctamente.", JSBtnAceptar:="BtnRefrescarPagina();") Else ResultadoMail = 0 End If @@ -26497,6 +26501,12 @@ Partial Class Ventas End Sub Private Sub BtnEditarCotizacion_Click(sender As Object, e As EventArgs) Handles BtnEditarCotizacion.Click + Dim VaFacturarCotizacion As Boolean = False + 'SI CARGA UNA COTIZACION DEBE GUARDAR TAMBIEN + If IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() > 0 Then + ViewState("CveVenta") = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() + VaFacturarCotizacion = True + End If If Not TmpDT.Rows.Count > 0 Then Alert("Es necesario agregar al menos un producto o servicio a la factura.", TipoMensaje.MsgAdvertencia) @@ -26567,14 +26577,14 @@ Partial Class Ventas End If End If - If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - If ObjConta.ValorPolizaDescuadre = 2 Then - OcurrioError = True - MensajeError = ObjConta.MensajePolizaDescuadre - End If - End If - End If + 'If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then + ' If ObjConta.ValorPolizaDescuadre > 0 Then + ' If ObjConta.ValorPolizaDescuadre = 2 Then + ' OcurrioError = True + ' MensajeError = ObjConta.MensajePolizaDescuadre + ' End If + ' End If + 'End If If OcurrioError Then ObjVentas.RollBack() @@ -26590,7 +26600,12 @@ Partial Class Ventas 'GENERA PDF NUEVO GeneraPDFCotizacion(ChkEnviarFactura.Checked) - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta & "&&Tipo=Cot"";") + If VaFacturarCotizacion Then + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveCotizacion=" & CveVenta & """;") + Else + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta & "&&Tipo=Cot"";") + End If + End If ObjVentas.Dispose() @@ -26807,82 +26822,77 @@ Partial Class Ventas Private Function CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable) As List(Of MVentaDetalleCotizacion) Dim Retorno As New List(Of MVentaDetalleCotizacion) - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then + Dim DTTamanios As DataTable = GlobalDTAcumTamaños() - Dim DTTamanios As DataTable = GlobalDTAcumTamaños() + Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"}) - Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"}) + For Each Dr As DataRow In DTSeleccionadas.Rows + Dim tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal + Dr("Cantidad") = tCantidad + Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero(), .Cantidad = tCantidad}) - For Each Dr As DataRow In DTSeleccionadas.Rows - Dim tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal - Dr("Cantidad") = tCantidad + Next - Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero(), .Cantidad = tCantidad}) + Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray() - Next + Dim DTPSTemp As New DataTable '= TmpDT.Clone - Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray() + DTPSTemp.Columns.Add("CveVenta", GetType(Integer)) + DTPSTemp.Columns.Add("Cantidad", GetType(Integer)) + DTPSTemp.Columns.Add("CvePS", GetType(Integer)) + DTPSTemp.Columns.Add("PU", GetType(Decimal)) - Dim DTPSTemp As New DataTable '= TmpDT.Clone + For Each DrowPartidas As DataRow In TmpDTCalculo + Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero() + Dim CveVenta As Integer = DrowPartidas("CveVenta").ToString().ToEntero() - DTPSTemp.Columns.Add("CveVenta", GetType(Integer)) - DTPSTemp.Columns.Add("Cantidad", GetType(Integer)) - DTPSTemp.Columns.Add("CvePS", GetType(Integer)) - DTPSTemp.Columns.Add("PU", GetType(Decimal)) + If CveTamanioTemp > 0 Then - For Each DrowPartidas As DataRow In TmpDTCalculo - Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero() - Dim CveVenta As Integer = DrowPartidas("CveVenta").ToString().ToEntero() + Dim DTTamanioTemp As New DataTable + Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString().ToEntero() - If CveTamanioTemp > 0 Then + Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal - Dim DTTamanioTemp As New DataTable - Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString().ToEntero() + If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then - Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal + For Each dRowUpdate As DataRow In DTPSTemp.Rows - If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then + If (dRowUpdate("CvePS").ToString().ToEntero() = CvePsTemp) Then + dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString().ToDecimal + DrowPartidas("Cantidad").ToString().ToDecimal + dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString().ToDecimal + ImporteCargo + dRowUpdate("CveVenta") = CveVenta + End If + Next - For Each dRowUpdate As DataRow In DTPSTemp.Rows + DTPSTemp.AcceptChanges() - If (dRowUpdate("CvePS").ToString().ToEntero() = CvePsTemp) Then - dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString().ToDecimal + DrowPartidas("Cantidad").ToString().ToDecimal - dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString().ToDecimal + ImporteCargo - dRowUpdate("CveVenta") = CveVenta - End If - Next + Else + Dim dRowNuevo As DataRow = DTPSTemp.NewRow - DTPSTemp.AcceptChanges() - - Else - Dim dRowNuevo As DataRow = DTPSTemp.NewRow - - dRowNuevo("CvePS") = CvePsTemp - dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal - dRowNuevo("PU") = Cargo - dRowNuevo("CveVenta") = CveVenta - - DTPSTemp.Rows.Add(dRowNuevo) - DTPSTemp.AcceptChanges() - End If + dRowNuevo("CvePS") = CvePsTemp + dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal + dRowNuevo("PU") = Cargo + dRowNuevo("CveVenta") = CveVenta + DTPSTemp.Rows.Add(dRowNuevo) + DTPSTemp.AcceptChanges() End If - Next - For Each drowPsTamaños As DataRow In DTPSTemp.Rows + End If + Next - If drowPsTamaños("PU").ToString().ToDecimal > 0 Then + For Each drowPsTamaños As DataRow In DTPSTemp.Rows - Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero() - SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado) + If drowPsTamaños("PU").ToString().ToDecimal > 0 Then - Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = CveVentaDetalleUsado, .Cantidad = drowPsTamaños("Cantidad").ToString().ToDecimal()}) + Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero() + SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado) - End If - Next + Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = CveVentaDetalleUsado, .Cantidad = drowPsTamaños("Cantidad").ToString().ToDecimal()}) - End If + End If + Next Return Retorno End Function