diff --git a/Acumuladores/CatFoliosGarantia.aspx b/Acumuladores/CatFoliosGarantia.aspx index 81001388a..06291a483 100644 --- a/Acumuladores/CatFoliosGarantia.aspx +++ b/Acumuladores/CatFoliosGarantia.aspx @@ -385,7 +385,8 @@
- + @@ -408,9 +409,13 @@
diff --git a/Acumuladores/CatFoliosGarantia.aspx.vb b/Acumuladores/CatFoliosGarantia.aspx.vb index 9172d5c1e..3acab2744 100644 --- a/Acumuladores/CatFoliosGarantia.aspx.vb +++ b/Acumuladores/CatFoliosGarantia.aspx.vb @@ -255,4 +255,54 @@ Partial Class Acumuladores_CatFoliosGarantia Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) End Sub + Protected Sub BtnGenerarTxt_Click(sender As Object, e As EventArgs) + Dim SbTxt As New StringBuilder + + For Each GvRow As GridViewRow In GvGarantiasDetalle.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + '1.- Consecutivo Partida-->1 + SbTxt.AppendFormat("{0}@", GvRow.DataKey("Consecutivo")) + '2.- Cliente-->100407 + SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoCliente")) + '3. Codigo De Articulo --> 171402 + SbTxt.AppendFormat("{0}@", GvRow.DataKey("Codigo")) + '4. Tipo De Uso --> A + SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoTipoUso")) + '5. Defecto --> P + SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoTipoDefecto")) + '6. Codigo De Ensamble --> 1X + SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoEnsamble")) + '7. Codigo De Linea/Termico --> 9000 + SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoLinea")) + '8. Codigo De Inspeccion --> J8K + SbTxt.AppendFormat("{0}@", GvRow.DataKey("CodigoInspeccion")) + '9. Fecha De Venta --> 05/09/2009 + SbTxt.AppendFormat("{0}@", GvRow.DataKey("FechaVenta").ToDateTime().ToString("dd/MM/yyyy")) + '10. Fecha De Reclamacion --> 05/07/2010 + SbTxt.AppendFormat("{0}@", GvRow.DataKey("FechaReclamacion").ToDateTime().ToString("dd/MM/yyyy")) + '11. TipoComprobante --> 1 + SbTxt.AppendFormat("{0}@", GvRow.DataKey("TipoComprobante")) + '12. Comprobante --> N/A + SbTxt.AppendFormat("{0}@", GvRow.DataKey("Comprobante")) + '13. Autorizo --> STAN7490 + SbTxt.AppendFormat("{0}@", GvRow.DataKey("Autorizo")) + '14. Comentarios --> Cliente 100407 + SbTxt.AppendFormat("{0}@", GvRow.DataKey("Comentarios")) + '15. Clave De Autorizacion / Codigo Error --> P05TRBGX + SbTxt.AppendFormat("{0}", GvRow.DataKey("ClaveAutorizacion")) + + SbTxt.Append(vbCrLf) + End If + Next + + Dim text As String = SbTxt.ToString + Response.Clear() + Response.ClearHeaders() + Response.AddHeader("Content-Length", text.Length.ToString) + Response.ContentType = "text/plain" + Response.AppendHeader("content-disposition", $"attachment;filename=""{LblFolio.Text}.txt""") + Response.Write(text) + Response.End() + + End Sub End Class 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/ClsPaginas.vb b/App_Code/ClsPaginas.vb index fa913b16f..1203a0395 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -36,6 +36,8 @@ Public Class ClsPaginas Public Shared Property EmpresaNotificaciones() As Empresa + Public Shared Property EmpresaNotificacionesGPS() As Empresa + Public ReadOnly Property EsProduccion As Boolean @@ -5274,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/ClsSisNotificaciones.vb b/App_Code/ClsSisNotificaciones.vb index b63c12e88..be0a9a61e 100644 --- a/App_Code/ClsSisNotificaciones.vb +++ b/App_Code/ClsSisNotificaciones.vb @@ -221,7 +221,7 @@ Public Class ClsSisNotificaciones Try Dim ResultadoMail As Integer = 0 Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Mail, Asunto, Cuerpo, MailCC, LSRutasMail) Then + If ObjMail.SendMail(ClsPaginas.EmpresaNotificacionesGPS, Mail, Asunto, Cuerpo, MailCC, LSRutasMail) Then ObjNotificacion.UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1) End If Catch ex As Exception 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 a4b949dfd..e864519ea 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -4202,13 +4202,14 @@ Public Class ClsVentas Return retorno End Function - Public Function TraspasaVentasAplicadasAnt(CveVentaNueva As Integer, CveVentaAnterior As Integer, CveEmpresa As Integer) As Boolean + Public Function TraspasaVentasAplicadasAnt(CveVentaNueva As Integer, CveVentaAnterior As Integer, CveEmpresa As Integer, CvePrePoliza As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_TraspasaVentasAplicadasAnt", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters .Add("@CveVentaNueva", SqlDbType.Int).Value = CveVentaNueva .Add("@CveVentaAnterior", SqlDbType.Int).Value = CveVentaAnterior .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza End With Try SqlAdapter.Fill(Data) @@ -4506,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/Modelos.vb b/App_Code/Modelos.vb index 807954b16..8ebf065ce 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -2652,7 +2652,7 @@ Namespace Modelos Case 11 'Anticipo '[IPP] SI ES REFACTURACION LOS ANTICIPOS NO LOS DEBE APLICAR EN EL INGRESO REFACTURADO (VIEJO) - If NuevaFactura = 1 And ObjFactura.CveVenta = CveDevolucion Then + If CveEstatusRefacturacion > 0 Then Exit Select End If @@ -4458,6 +4458,10 @@ Namespace Modelos Dim CveEstatusRefacturacion As Integer = If(ObjFactura.CveEstatusRefacturacion <= 0, 0, ObjFactura.CveEstatusRefacturacion) + If Not EsRefacturacion Then + CveEstatusRefacturacion = 0 + End If + Dim CancelacionFecha As Date Dim FolioFiscal As String = ObjFactura.FolioFiscal Dim CancelacionAcuse As String = "" @@ -4485,7 +4489,7 @@ Namespace Modelos If CveEstatusFacturaAsignado <= 0 Then Try - If ObjFactura.FolioFiscal <> "" Then + If ObjFactura.FolioFiscal <> "" AndAlso UsuarioActual.Empresa.FacturaProduccion Then If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Dev", "Egs") Then 'VERIFICA SI DEBE VALIDAR ANTE EL SAT 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/RepCortes.aspx b/Bancos/RepCortes.aspx index e76a349bd..2f90c1b90 100644 --- a/Bancos/RepCortes.aspx +++ b/Bancos/RepCortes.aspx @@ -231,6 +231,15 @@ + + + + + + + + + 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.vb b/Compras/Compras.aspx.vb index c04194dcf..3ab2de74e 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -7085,11 +7085,11 @@ Partial Class Compras_Compras CveCuenta = CveCuentaProveedorExtranjera End If End If - - If CveCompraRefacturacion > 0 Then - importeMovimiento = 0 - importeMN = 0 - End If + + 'If CveCompraRefacturacion > 0 Then + ' importeMovimiento = 0 + ' importeMN = 0 + ' End If Case 59 'Documentos @@ -7337,6 +7337,8 @@ Partial Class Compras_Compras For Each Ant As Compras_Compras.Anticipos In ArrAnticipos + TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) + Dim ConceptoContableAnticipo, ConceptoContableAnticipoComplementaria As Integer Dim CveCompraNC As Integer = CveCompra @@ -7540,7 +7542,7 @@ Partial Class Compras_Compras Dim usacomplementariaAnticipo As Boolean = False usacomplementariaAnticipo = If(Ant.TCCompra > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119), True, False) - Dim TipoCambioAnt = Ant.TCCompra + Dim TipoCambioAnt As Decimal = Ant.TCCompra Dim ImporteAnt As Decimal = importeMovimiento @@ -8880,6 +8882,7 @@ Partial Class Compras_Compras End If Dim TipoCambioDiferencia = If(ChkPagarConDolares.Checked, GlobalTipoCambio(TxtFecha.Text.ToDate), TipoCambioCompra).ToDecimal + If TipoCambioDiferencia <> TipoCambioAnt Then Dim importeFluctuacion = (ImporteAnt * TipoCambioDiferencia) - (ImporteAnt * TipoCambioAnt) diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index f70555c28..60e3e291a 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1327,7 +1327,7 @@ Partial Class PopUpVerFactura Dim CveTipoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacen}").ToString.ToEntero 'VERIFICA SI TIENE MOVIMIENTO VIRTUAL RELACIONADO - If UsuarioActual.CveEmpresa = 140 AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then CveMovimientoRelacionado = ObjInventarios.DtResultados.Rows(0)("CveMtoRel").ToString().ToEntero() If CveConcepto.Contiene(2, 3, 26, 27) AndAlso ObjInventarios.DtResultados.FiltroPrimeroValor("CveMovimientoVirtual").ToEntero() > 0 Then FolioRelacionado = ObjInventarios.DtResultados.FiltroPrimeroValor("FolioVirtual") @@ -1361,7 +1361,7 @@ Partial Class PopUpVerFactura If ObjInventarios.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then DtMovimientos = ObjInventarios.DtResultados.Copy() CantidadProductos = DtMovimientos.SUM("Cantidad").ToDecimal() - If UsuarioActual.CveEmpresa = 140 AndAlso CveMovimientoRelacionado > 0 Then + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveMovimientoRelacionado > 0 Then If ObjInventarios.GetMovimientos(CveMovimientoRelacionado, -1, -1, UsuarioActual.CveEmpresa) Then Dim CveAlmacenRelacionado As Integer = ObjInventarios.CveAlmacen Dim CveTipoAlmacenRelacionado As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacenRelacionado}").ToString.ToEntero @@ -1393,7 +1393,7 @@ Partial Class PopUpVerFactura End If End If - If UsuarioActual.CveEmpresa = 140 AndAlso CveCompra > 0 Then + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCompra > 0 Then If ObjInventarios.RecepcionAlmacenGet(CveCompra, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then Dim DtFaltante As DataTable = ObjInventarios.DtResultados.FiltraParametros("CantidadF > 0") If DtFaltante.Rows.Count > 0 Then diff --git a/GPS/RepPuntosDeInteres.aspx b/GPS/RepPuntosDeInteres.aspx index 5aed250b6..adbe38c9f 100644 --- a/GPS/RepPuntosDeInteres.aspx +++ b/GPS/RepPuntosDeInteres.aspx @@ -3,6 +3,7 @@ + @@ -66,8 +199,11 @@ + + + - + @@ -83,8 +219,11 @@ + + + - + @@ -148,6 +287,43 @@
+ +
  • @@ -158,18 +334,36 @@ - + + + diff --git a/GPS/RepPuntosDeInteres.aspx.vb b/GPS/RepPuntosDeInteres.aspx.vb index 0886eacb8..3b818619e 100644 --- a/GPS/RepPuntosDeInteres.aspx.vb +++ b/GPS/RepPuntosDeInteres.aspx.vb @@ -2,9 +2,11 @@ Imports Extensiones Imports System.Data +Imports Microsoft.Reporting.WebForms + Partial Class GPS_RepPuntosDeInteres - Inherits ClsPaginas - + Inherits ClsPaginas + #Region "P R O P I E D A D E S " Private Property DispositivosLista As List(Of String) Get @@ -13,29 +15,34 @@ Partial Class GPS_RepPuntosDeInteres Set(value As List(Of String)) ViewState("DispositivosLista") = value End Set - End Property + End Property + Private Property DtDatosReporte As DataTable + Get + Return If(IsNothing(ViewState("DtDatosReporte")), Nothing, CType(ViewState("DtDatosReporte"), DataTable)) + End Get + Set(value As DataTable) + ViewState("DtDatosReporte") = value + End Set + End Property #End Region - + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then CargaDatos() End If End Sub Private Sub CargaDatos() + txtFechaF.Text = Now.ToString("dd/MM/yyyy") + txtFechaI.Text = Now.AddDays(-7).ToString("dd/MM/yyyy") + CargaDispositivos() - Dim gps As New ClsGPS - 'If gps.PuntoDeInteresGrupoGet(-1, 1) Then - ' GvGrupos.DataSource = gps.DtResultados - 'Else - ' GvGrupos.DataSource = Nothing - 'End If - If gps.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then - GvPuntos.DataSource = gps.DtResultados + Dim ObjGPS As New ClsGPS + If ObjGPS.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then + GvPuntos.DataSource = ObjGPS.DtResultados Else GvPuntos.DataSource = Nothing End If - gps.Dispose() - 'GvGrupos.DataBind() + ObjGPS.Dispose() GvPuntos.DataBind() End Sub @@ -58,8 +65,8 @@ Partial Class GPS_RepPuntosDeInteres RegistraScript("$('#dvConsulta').modal('hide');", "00") End Sub - Private Sub ReportePuntos(Dispositivos As String) - Dim GPS As New ClsGPS + Private Sub ReportePuntos(Dispositivos As String) + Dim FechaI, FechaF As Date Dim SBBody As New StringBuilder Dim CoordsPoligono = "" @@ -70,35 +77,48 @@ Partial Class GPS_RepPuntosDeInteres Dim GeoCercas = "" Dim Color = "" FechaI = If(txtFechaI.Text.Trim = "", MinFecha, txtFechaI.Text.Trim.ToDate) - FechaF = If(txtFechaF.Text.Trim = "", MaxFecha, txtFechaF.Text.Trim.ToDate) - For Each row As GridViewRow In GvPuntos.Rows - SBBody.Clear() - If row.FCCheckBox("chkGR").Checked Then - If GPS.RepPuntosGet(row.DataKey("CvePuntoDeInteres").ToEntero, Dispositivos, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then - Coords = SQLToGmaps(row.DataKey("Punto").ToString, "POINT") - SBBody.Append($"
    ") - SBBody.Append($"
    Punto: {row.DataKey("PuntoDeInteres")}
    ") + FechaF = If(txtFechaF.Text.Trim = "", MaxFecha, txtFechaF.Text.Trim.ToDate) + + Dim ObjGPS As New ClsGPS + Try + For Each row As GridViewRow In GvPuntos.Rows + SBBody.Clear() + If row.FCCheckBox("chkGR").Checked Then + If ObjGPS.RepPuntosGet(row.DataKey("CvePuntoDeInteres").ToEntero, Dispositivos, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then + + DtDatosReporte = ObjGPS.DtResultados.Copy() + GvBarra.DataSource = DtDatosReporte + + Coords = SQLToGmaps(row.DataKey("Punto").ToString, "POINT") + SBBody.Append($"
    ") + SBBody.Append($"
    Punto: {row.DataKey("PuntoDeInteres")}
    ") + + If ObjGPS.DtResultados.Rows.Count > 0 Then + Color = "#26C281" + SBBody.Append($"
    ") + For Each Cve As String In DispositivosLista + If ObjGPS.DtResultados.FiltraParametros($"CveDispositivo = {Cve} ").Rows.Count > 0 Then + SBBody.Append($"") + SBBody.Append($"") + End If + Next + SBBody.Append($"
    {ObjGPS.DtResultados.FiltroPrimeroValor("Vehiculo", $"CveDispositivo = {Cve}")}: {ObjGPS.DtResultados.FiltroPrimeroValor("Visitas", $"CveDispositivo = {Cve}")} visitas
    Última Visita: {ObjGPS.DtResultados.FiltroPrimeroValor("UltimaVisita", $"CveDispositivo = {Cve}")}
    ") + Else + Color = "#e82929" + SBBody.Append($"Este punto de interés no fue visitado en las fechas seleccionadas.") + End If + SBBody.Append($"
    ") + RegistraScript($"CreaCirculo({Coords},'{Color}');CreaMarcador({Coords},'{row.DataKey("PuntoDeInteres")}','{SBBody.ToString}');", row.DataKey("CvePuntoDeInteres")) + End If + End If + Next + Catch ex As Exception + OnError("Ocurrió un error al consultar los puntos de interes", ex) + End Try - If GPS.DtResultados.Rows.Count > 0 Then - Color = "#26C281" - SBBody.Append($"
    ") - For Each Cve As String In DispositivosLista - If GPS.DtResultados.FiltraParametros($"CveDispositivo = {Cve} ").Rows.Count > 0 Then - SBBody.Append($"") - SBBody.Append($"") - End If - Next - SBBody.Append($"
    {GPS.DtResultados.FiltroPrimeroValor("Vehiculo", $"CveDispositivo = {Cve}")}: {GPS.DtResultados.FiltroPrimeroValor("Visitas", $"CveDispositivo = {Cve}")} visitas
    Última Visita: {GPS.DtResultados.FiltroPrimeroValor("UltimaVisita", $"CveDispositivo = {Cve}")}
    ") - Else - Color = "#e82929" - SBBody.Append($"Este punto de interés no fue visitado en las fechas seleccionadas.") - End If - SBBody.Append($"
    ") - RegistraScript($"CreaCirculo({Coords},'{Color}');CreaMarcador({Coords},'{row.DataKey("PuntoDeInteres")}','{SBBody.ToString}');", row.DataKey("CvePuntoDeInteres")) - End If - End If - Next - GPS.Dispose() + ObjGPS.Dispose() + GvBarra.DataBind() + UPGV.Update() End Sub 'If GPS.GeoReferenciasEntradasSalidas(GVRow.DataKey("CveDispositivo").ToString.ToEntero, row.DataKey("CveGeoReferencia").ToString.ToEntero, FechaI, FechaF) Then @@ -152,5 +172,41 @@ Partial Class GPS_RepPuntosDeInteres GVHistorico.DataBind() UpdatePanel3.Update() RegistraScript("$('#dvHistorico').modal()") + End Sub + + 'Protected Sub GvBarra_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBarra.RowDataBound + ' If e.Row.RowType = DataControlRowType.DataRow Then + ' Dim RowID As String = $"row{e.Row.RowIndex}" + ' e.Row.Attributes("id") = RowID + ' Dim IndexGvBarra As Integer = If(String.IsNullOrEmpty(HdnIndexGvBarra.Value), -1, HdnIndexGvBarra.Value.ToEntero) + + ' RegistraScript($"GetDireccionesGV({e.Row.DBCampo("Posicion").ToString}, {e.Row.RowIndex}, 1);", $"{RowID}") + + ' End If + 'End Sub + + Protected Sub btnImprimir_Click(sender As Object, e As EventArgs) + Dim Btn As Button = CType(sender, Button) + Dim Format = Btn.CommandArgument + EnviarReporteProgramado(Format) + + End Sub + Public Sub EnviarReporteProgramado(Format As String) + Dim RutaReporte = "Empresas/Grales/ReportesProgramados/RPTPuntosInteres.rdlc" + Dim NombreReporte = "ReportePuntosInteres" + + Try + Dim RptParametro As New List(Of ReportParameter) + RptParametro.Add(New ReportParameter("FechaInicio", txtFechaI.Text)) + RptParametro.Add(New ReportParameter("FechaFin", txtFechaF.Text)) + RptParametro.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + RptParametro.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString)) + + Dim retorno = StreamPDF(RutaReporte, DtDatosReporte, RptParametro, $"{NombreReporte}{Date.Now.ToShortDateString}", Format, MR:=Nothing, RDSName:="DsOC") + + ImprimirbytesPDF(retorno, $"{NombreReporte}{Date.Now.ToShortDateString}", Format) + Catch ex As Exception + GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) + End Try End Sub End Class diff --git a/General/PopUpPaqueteriasGuias.aspx.cs b/General/PopUpPaqueteriasGuias.aspx.cs index be70f9f33..09f056b8a 100644 --- a/General/PopUpPaqueteriasGuias.aspx.cs +++ b/General/PopUpPaqueteriasGuias.aspx.cs @@ -870,7 +870,7 @@ public partial class General_PopUpPaqueteriasGuias : ClsPaginas { DataRow VentasDetalle = ObjVenta.DtResultados.Rows[0]; double Total = VentasDetalle["Total"].ToString().ToDouble(); - bool Mostrar = (Total >= 100000.00); + bool Mostrar = (Total >= 50000.00); tdLblPolizaSeguro.Visible = Mostrar; tdTxtPolizaSeguro.Visible = Mostrar; } diff --git a/Global.asax b/Global.asax index f0d2b275e..11258feff 100644 --- a/Global.asax +++ b/Global.asax @@ -620,6 +620,9 @@ Dim EmpresaNotificaciones As New Empresa With {.SendMail = "signotificaciones@adssistemas.mx", .SendMailPassword = "sig123987", .SendMailServer = "mail.adssistemas.mx", .SendMailPuerto = 587} ClsPaginas.EmpresaNotificaciones = EmpresaNotificaciones + Dim EmpresaNotificacionesGPS As New Empresa With {.SendMail = "ALERTAS@SIGNALSGPS.com", .SendMailPassword = "STJ180705IV42021ad", .SendMailServer = "mail.signalsgps.com", .SendMailPuerto = 587} + ClsPaginas.EmpresaNotificacionesGPS = EmpresaNotificacionesGPS + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 'I M P U E S T O S L O C A L E S diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 2cac3b0ce..a46d77cd0 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -1057,9 +1057,9 @@ Partial Class Inventarios_EntregaAlmacen Dim AplicaCaducidad = False If GlobalDTPS(UsuarioActual.CveEmpresa, ).FiltraParametros("").Rows(0) IsNot Nothing Then AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerie).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString() = "True", True, False) - End If - - GvSerie.Columns(1).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad") + End If + + GvSerie.Columns(1).HeaderText = UsuarioActual.Empresa.Funcionalidad(147) If AplicaCaducidad Then GvSerie.Columns(1).Visible = True @@ -1266,7 +1266,7 @@ Partial Class Inventarios_EntregaAlmacen Private Sub CargaLote(Optional CerrarCompletado As Boolean = False) RegistraScript("$('#DivLote').modal('show')") - GvLote.Columns(2).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad") + GvLote.Columns(2).HeaderText = UsuarioActual.Empresa.Funcionalidad(147) GvLote.DataSource = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC") GvLote.DataBind() @@ -2884,7 +2884,7 @@ Partial Class Inventarios_EntregaAlmacen Dim CveCliente As Integer = ObjVentas.DtResultados(0)("CveCliente").ToString().ToEntero() Dim ClienteNombre As String = ObjVentas.DtResultados(0)("ClienteNombre").ToString() Dim Serie As String = ObjVentas.DtResultados(0)("SerieFolio").ToString() - Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL() + Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundAD() Dim TotalCostoAcumulado As Decimal = 0 Dim cont As Integer = 1 @@ -2898,13 +2898,13 @@ Partial Class Inventarios_EntregaAlmacen ValorMultiplicador = -1 End If - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/RecepcionEntrega", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/EntregaAlmacen", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) 'Se agrega movimiento separado por la cuenta de ventas (ER) If CvePrePoliza > 0 Then For Each RowInv As DataRow In tmpCostos.Rows - ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL() + ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundAD() TotalCostoAcumulado += ValorInventario 'cuando es el último movimiento y hay diferencias en los importes diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 48be46fa4..fa5f9dcfa 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -1871,7 +1871,7 @@ Partial Class Inventarios_RecepcionAlmacen End Sub Private Sub CargaLote(Tipo As Integer, Optional CerrarCompletado As Boolean = False) RegistraScript("$('#DivLote').modal();", "ModalLote") - GvLote.Columns(2).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad") + GvLote.Columns(2).HeaderText = UsuarioActual.Empresa.Funcionalidad(147) GvLote.DataSource = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC") GvLote.DataBind() diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index ceca7f823..35736ad6d 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -934,7 +934,7 @@ Partial Class Inventarios_TraspasoAlmacen If Not ErrorMovInv Then 'VIRTUAL ENTRADA - If RealizarMovimientoVirtual Then + If RealizarMovimientoVirtual AndAlso CveAlmacenVirtualEntrada > 0 Then Dim dtvirtual As DataTable = Nothing @@ -963,6 +963,7 @@ Partial Class Inventarios_TraspasoAlmacen ErrorMovInv = True End If End If + Dim Concepto As String = TxtObservaciones.Text If Concepto = "" Then Concepto = "Traspaso" 'AGREGAMOS PREPOLIZAS TRASPASO DIRECTO: @@ -1743,7 +1744,7 @@ Partial Class Inventarios_TraspasoAlmacen If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=ImporteDecimal) Then ErrorMovInv = True - TextoError = "Ocurrió un erro al cancelar el traspaso" + TextoError = "Ocurrió un error al cancelar el traspaso" End If 'If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, @@ -1925,10 +1926,10 @@ Partial Class Inventarios_TraspasoAlmacen End If If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then - ErrorMovInv = True - End If + ErrorMovInv = True End If End If + End If End If @@ -2857,7 +2858,7 @@ Partial Class Inventarios_TraspasoAlmacen 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 excelFile As ExcelFile = excelFile.Load(flatFilePath) Dim unnamed As Integer = 0 Dim cols As Integer @@ -2967,7 +2968,7 @@ Partial Class Inventarios_TraspasoAlmacen Else Str = String.Format(" AND CveSubProyecto = {0} ", DrAlmO("CveSubProyecto")) End If - DdlAlmacenDestino.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros(String.Format(" CveTipoAlmacen NOT IN (3,4,9,10,11,24,28) AND Estatus = 'Activo' {0} ", Str)) + DdlAlmacenDestino.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros(String.Format(" CveTipoAlmacen NOT IN (3,4,9,10,11,24,25,28) AND Estatus = 'Activo' {0} ", Str)) DdlAlmacenDestino.DataBind() DdlAlmacenDestino.Items.Insert(0, New ListItem("Seleccione", "-1")) diff --git a/LogIn.aspx.vb b/LogIn.aspx.vb index e82ce6868..0adbb361c 100644 --- a/LogIn.aspx.vb +++ b/LogIn.aspx.vb @@ -199,71 +199,74 @@ Partial Class LogIn 'Dim UsuarioAsignaciones As Usuario = Nothing Dim isgps = Request.Url.Host.ToUpper().Contains("SIGNALSGPS".ToUpper()) - Usuario = ObjUsuario.ValidaUsuario(txtUsuario.Text, Encripta(TxtContraseña.Text.Trim), IMEI, CvePlataforma:=If(isgps, 3, 1)) + Usuario = ObjUsuario.ValidaUsuario(txtUsuario.Text, Encripta(TxtContraseña.Text.Trim), IMEI, CvePlataforma:=If(isgps, 3, -1)) 'UsuarioAsignaciones = ObjUsuario.ValidaUsuarioAsignacion(Usuario.CveUsuario, Usuario.CveEmpresa) + If Not isgps AndAlso Usuario IsNot Nothing AndAlso Usuario.CvePlataforma = 3 Then ' SI ES de la plataforma 3(GPS), no debe de entar por liga normal + Usuario = Nothing + End If ADSSessionConfig.sessionUser = Usuario - ADSSessionConfig.sessionDpage = False - ObjUsuario.Dispose() - If Usuario IsNot Nothing Then - If Not Usuario.AutorizadoxIP OrElse (HddAdsCodex.Text.Length > 0 AndAlso Usuario.CodigoAutorizado = HddAdsCodex.Text) Then + ADSSessionConfig.sessionDpage = False + ObjUsuario.Dispose() + If Usuario IsNot Nothing Then + If Not Usuario.AutorizadoxIP OrElse (HddAdsCodex.Text.Length > 0 AndAlso Usuario.CodigoAutorizado = HddAdsCodex.Text) Then - CreaObjetoEmpresa(Usuario) - ADSSessionConfig.sessionUser.MultipleEmpresa = True + CreaObjetoEmpresa(Usuario) + ADSSessionConfig.sessionUser.MultipleEmpresa = True - Dim x As New ADSSessionObj(Usuario.CveUsuario, Usuario.CveEmpresa) - Dim _sessionid = Encripta(String.Format("{0}|{1}", Usuario.CveUsuario, x.SessionID)) - x = ADSSessionConfig.SessionManager(OpcionSession.agregarSession, x) + Dim x As New ADSSessionObj(Usuario.CveUsuario, Usuario.CveEmpresa) + Dim _sessionid = Encripta(String.Format("{0}|{1}", Usuario.CveUsuario, x.SessionID)) + x = ADSSessionConfig.SessionManager(OpcionSession.agregarSession, x) - If Usuario.CvePlataforma = 6 And Usuario.CveRol = 10 Then - 'PLATAFORMA PORTAL CLIENTE - 'FormsAuthentication.RedirectFromLoginPage(_sessionid, False) - 'Response.Redirect("/PortalCliente/PortalCliente.aspx", True) + If Usuario.CvePlataforma = 6 And Usuario.CveRol = 10 Then + 'PLATAFORMA PORTAL CLIENTE + 'FormsAuthentication.RedirectFromLoginPage(_sessionid, False) + 'Response.Redirect("/PortalCliente/PortalCliente.aspx", True) - ReturnUrl = "/PortalCliente/PortalCliente.aspx" - ElseIf Usuario.CvePlataforma = 7 And Usuario.CveRol = 11 Then - 'PLATAFORMA PORTAL PROVEEDOR - 'FormsAuthentication.RedirectFromLoginPage(Encripta(Usuario.CveUsuario), False) - 'Response.Redirect("/PortalProveedor/PortalProveedor.aspx", True) + ReturnUrl = "/PortalCliente/PortalCliente.aspx" + ElseIf Usuario.CvePlataforma = 7 And Usuario.CveRol = 11 Then + 'PLATAFORMA PORTAL PROVEEDOR + 'FormsAuthentication.RedirectFromLoginPage(Encripta(Usuario.CveUsuario), False) + 'Response.Redirect("/PortalProveedor/PortalProveedor.aspx", True) - ReturnUrl = "/PortalProveedor/PortalProveedor.aspx" - ElseIf Usuario.CveRol = 1200 And Usuario.Acceso > 0 Then - 'PLATAFORMA GPS - Usuario.CvePlataforma = 3 - 'FormsAuthentication.RedirectFromLoginPage(Encripta(Usuario.CveUsuario), False) - 'Response.Redirect("/PortalGPS/InicioGPS.aspx", True) - ReturnUrl = "/PortalGPS/InicioGPS.aspx" - Else - 'PLATAFORMA SIG - CType(Session("UsuarioSIG"), Usuario).CvePlataforma = 1 - Dim dt As Data.DataTable = GlobalDTUsuarios(Usuario.CveUsuario) - If dt IsNot Nothing Then - If dt.Rows.Count >= 1 Then - If dt.Rows.Count > 1 Then - Usuario.MultipleEmpresa = True + ReturnUrl = "/PortalProveedor/PortalProveedor.aspx" + ElseIf Usuario.CveRol = 1200 And Usuario.Acceso > 0 Then + 'PLATAFORMA GPS + Usuario.CvePlataforma = 3 + 'FormsAuthentication.RedirectFromLoginPage(Encripta(Usuario.CveUsuario), False) + 'Response.Redirect("/PortalGPS/InicioGPS.aspx", True) + ReturnUrl = "/PortalGPS/InicioGPS.aspx" + Else + 'PLATAFORMA SIG + CType(Session("UsuarioSIG"), Usuario).CvePlataforma = 1 + Dim dt As Data.DataTable = GlobalDTUsuarios(Usuario.CveUsuario) + If dt IsNot Nothing Then + If dt.Rows.Count >= 1 Then + If dt.Rows.Count > 1 Then + Usuario.MultipleEmpresa = True + End If + 'FormsAuthentication.RedirectFromLoginPage(Encripta(Usuario.CveUsuario), False) End If - 'FormsAuthentication.RedirectFromLoginPage(Encripta(Usuario.CveUsuario), False) End If + dt.Dispose() End If - dt.Dispose() + + Dim cookie = FormsAuthentication.GetAuthCookie(Usuario.CveUsuario, False) + Response.Cookies.Add(cookie) + RegistraScript(String.Format("opennewlocation('{0}','{1}')", ReturnUrl, "")) + 'Response.Redirect(ReturnUrl, True) + Else + Alert("El usuario no esta autorizado en este equipo, favor de contactar al administrador de usuarios.", TipoMensaje.MsgAdvertencia) End If + 'If Usuario.Acceso > 0 Then - Dim cookie = FormsAuthentication.GetAuthCookie(Usuario.CveUsuario, False) - Response.Cookies.Add(cookie) - RegistraScript(String.Format("opennewlocation('{0}','{1}')", ReturnUrl, "")) - 'Response.Redirect(ReturnUrl, True) + 'Else + ' Alert("Usuario con acceso limitado.", TipoMensaje.MsgAdvertencia) + 'End If Else - Alert("El usuario no esta autorizado en este equipo, favor de contactar al administrador de usuarios.", TipoMensaje.MsgAdvertencia) + Alert("Usuario y/o Contraseña incorrectos.", TipoMensaje.MsgAdvertencia) End If - 'If Usuario.Acceso > 0 Then - - 'Else - ' Alert("Usuario con acceso limitado.", TipoMensaje.MsgAdvertencia) - 'End If - Else - Alert("Usuario y/o Contraseña incorrectos.", TipoMensaje.MsgAdvertencia) End If - End If End Sub Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario) diff --git a/Planeacion/CatSubProyectos.aspx b/Planeacion/CatSubProyectos.aspx index 77216b445..b9598a07e 100644 --- a/Planeacion/CatSubProyectos.aspx +++ b/Planeacion/CatSubProyectos.aspx @@ -83,7 +83,7 @@
    @@ -173,10 +173,21 @@
  • -
    - - +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    + 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/Sistemas/PopUpSeleccionarEmpresa.aspx.vb b/Sistemas/PopUpSeleccionarEmpresa.aspx.vb index 32de18d83..c097bc7a7 100644 --- a/Sistemas/PopUpSeleccionarEmpresa.aspx.vb +++ b/Sistemas/PopUpSeleccionarEmpresa.aspx.vb @@ -22,7 +22,8 @@ Partial Class PopUpSeleccionarEmpresa If Dt IsNot Nothing Then If Dt.Rows.Count > 0 Then Dim NumRegistros As Integer = 0 - GvEmpresas.DataSource = Dt.FiltraParametros("(CvePlataforma = 1 OR (CvePlataforma = 3 AND CveCliente IS NULL)) AND CvePlataformaUsuario NOT IN (6,7)", "Empresa") + GvEmpresas.DataSource = Dt.FiltraParametros("(CvePlataforma = 1 OR (CvePlataforma = 3 AND CveCliente IS NULL)) AND CvePlataformaUsuario NOT IN (6,7)", "Empresa", {"CveEmpresa", "Empresa", "CveUsuario", "Contraseña", "Usuario"}) + 'GvEmpresas.DataSource = Dt.FiltraParametros("(CvePlataforma = 1 OR (CvePlataforma = 3 AND CveCliente IS NULL)) AND CvePlataformaUsuario NOT IN (6,7)", "Empresa") NumRegistros += DirectCast(GvEmpresas.DataSource, System.Data.DataTable).Rows.Count GvPortalRastreo.DataSource = Dt.FiltraParametros("CvePlataforma = 3 AND CveCliente IS NOT NULL", "Empresa") 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 3d23ceae5..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 0f1e9f8f5..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() @@ -42,13 +71,14 @@ Partial Class CatMetasVendedores DdlMarcas.DataBind() DdlMarcas.Items.Insert(0, New ListItem("Todos", "-1")) - DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacionSup.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacionSup.DataBind() + DdlClasificacionSup.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlClasificacion.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) DdlClasificacion.DataBind() DdlClasificacion.Items.Insert(0, New ListItem("Todos", "-1")) - DdlClasificacionSup.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) - DdlClasificacionSup.DataBind() - DdlClasificacionSup.Items.Insert(0, New ListItem("Todos", "-1")) End Sub Protected Sub LnkAgregar_Click() Handles LnkAgregar.Click @@ -100,8 +130,10 @@ Partial Class CatMetasVendedores CveMetaVendedor = GvRow.DataKey("CveMeta").ToEntero DdlVendedores.SelectedValue = GvRow.DataKey("CveVendedor") TxtFechaI.Text = GvRow.DataKey("MesAño") - DdlClasificacionSup.SelectedValue = GvRow.DataKey("CveClasificacionSup") - DdlClasificacion.SelectedValue = GvRow.DataKey("CveClasificacion") + + DdlClasificacionSup.SelectedValueExist(GvRow.DataKey("CveClasificacionSup")) + DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion")) + DdlMarcas.SelectedValue = GvRow.DataKey("CveMarca") TxtMetaCantidad.Text = GvRow.DataKey("MetaCantidad") TxtMetaImporte.Text = GvRow.DataKey("MetaImporte") @@ -119,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 b/Ventas/MetasVendedores.aspx index efb1b7674..54b52aa47 100644 --- a/Ventas/MetasVendedores.aspx +++ b/Ventas/MetasVendedores.aspx @@ -154,6 +154,11 @@ + + + + + @@ -164,14 +169,24 @@ + + + + + + + + + + - + - + @@ -184,11 +199,11 @@ - +<%-- - + --%> diff --git a/Ventas/MetasVendedores.aspx.vb b/Ventas/MetasVendedores.aspx.vb index 8c29c7032..984b62242 100644 --- a/Ventas/MetasVendedores.aspx.vb +++ b/Ventas/MetasVendedores.aspx.vb @@ -47,7 +47,7 @@ Partial Class MetasVendedores DdlClasificaciones.DataBind() DdlClasificaciones.Items.Insert(0, New ListItem("Todos", "-1")) - DdlClasificacion2.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacion2.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) DdlClasificacion2.DataBind() DdlClasificacion2.Items.Insert(0, New ListItem("Todos", "-1")) @@ -75,26 +75,28 @@ Partial Class MetasVendedores Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.FCLabel("lblRealMesPorcentaje").Text = String.Format("{0}{1}", e.Row.FCLabel("lblRealMesPorcentaje").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" + e.Row.FCLabel("lblRealMesPorcentaje").Text = String.Format("{0}{1}", e.Row.FCLabel("lblRealMesPorcentaje").Text, "%") + 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.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/Ventas.aspx b/Ventas/Ventas.aspx index 42467113e..0bc461505 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -3493,9 +3493,8 @@ Kilometraje  - - - + + diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index bd3c169d5..fb94fa794 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -1290,6 +1290,15 @@ Partial Class Ventas End Set End Property + Private Property CveVentaUsadoDevolucionEfectivo As Integer + Get + Return If(IsNothing(ViewState("CveVentaUsadoDevolucionEfectivo")), 0, CType(ViewState("CveVentaUsadoDevolucionEfectivo"), Integer)) + End Get + Set(value As Integer) + ViewState("CveVentaUsadoDevolucionEfectivo") = value + End Set + End Property + #End Region #Region "Propiedades PuntoVenta" @@ -5450,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 @@ -6232,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) @@ -7236,6 +7249,13 @@ Partial Class Ventas End If End If + If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 AndAlso TrKilometraje.Visible Then + If TxtKilometraje.Text.Length < 6 Then + Alert("El kilometraje debe tener 6 digitos.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + 'CUANDO ES COTIZACION Y SE VA A FACTURAR SE HACE INGRESO If DdlTipoComprobante.SelectedValue = "Cot" AndAlso BtnEmitirImprimir.Text = "Facturar" Then DdlTipoComprobante.SelectedValue = "Ing" @@ -10774,6 +10794,13 @@ Partial Class Ventas Me.AplicaRelacionManual = False End If + 'SI SE SELECCIONO UNA FACTURA PARA DEVOLUCION DE EFECTIVO DEBE ASOCIARLA A LA NOTA DE CREDITO + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso factura.TipoDocto = "Egs" AndAlso Me.CveVentaUsadoDevolucionEfectivo > 0 Then + If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveVentaUsadoDevolucionEfectivo) Then + ErrorList.Add("Ocurrió un error al relacionar la venta de devolución de efectivo entre si.") + End If + End If + If UsuarioActual.Empresa.Funcionalidad(280) = "1" And RblPaqueteria.SelectedValue = "1" And Not factura.TipoDocto.Contiene("Rem", "Ped") Then NotificarPaqueteria() End If @@ -12728,7 +12755,7 @@ Partial Class Ventas 'EN CASO DE SER REFACTURACION DE ANTICIPO SE ACTUALIZAN LAS VENTAS APLICADAS HACIA EL NUEVO If NuevaFactura = 1 AndAlso CveDevolucion > 0 AndAlso ObjFactura.TipoDocto.Contiene("Ant") Then - If Not ObjVentas.TraspasaVentasAplicadasAnt(ObjFactura.CveVenta, CveDevolucion, UsuarioActual.CveEmpresa) Then + If Not ObjVentas.TraspasaVentasAplicadasAnt(ObjFactura.CveVenta, CveDevolucion, UsuarioActual.CveEmpresa, ObjFactura.CvePrePoliza) Then ErrorPrepoliza = True End If End If @@ -19123,7 +19150,7 @@ Partial Class Ventas If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then Dim sb As New StringBuilder() - If Not String.IsNullOrEmpty(FolioFiscal) Then + If Not String.IsNullOrEmpty(FolioFiscal) AndAlso Not (UsuarioActual.Empresa.Funcionalidad(529) = "1") Then sb.Append("La factura se encuentra en el siguiente estatus del SAT:
    ") Dim TotalT As Decimal = TxtTotal.Text.ToDecimal @@ -21382,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 @@ -24675,9 +24702,14 @@ Partial Class Ventas End If 'SOLO APLICA SI NO HAY DOCUMENTOS QUE SELECCIONAR - If UsuarioActual.CveEmpresa = 140 Then + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then If GvCxC.Rows.Count = 0 OrElse GvCxC.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("ChkCxC").Checked) = 0 Then - Alert("No se ha seleccionado ninguna factura, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") + If ClienteEsDistribuidor AndAlso TxtImportesRemisionesNC.Text.ToDecimal() > 0 Then + Alert("No se puede generar una nota de crédito para devolución de efectivo si el cliente es distribuidor.", TipoMensaje.MsgAdvertencia) + Else + Alert("No se ha seleccionado ninguna factura, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") + End If + Else AplicarNotaCreditoDesdeVenta() End If @@ -24694,6 +24726,8 @@ Partial Class Ventas Private Sub AplicarNotaCreditoDesdeVenta(Optional AplicaNuevoDocumento As Boolean = False) RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC") + CveVentaUsadoDevolucionEfectivo = -1 + DdlTipoComprobante.SelectedValue = "Egs" Dim AplicaImpuestosLocales As Boolean = False @@ -24722,6 +24756,11 @@ Partial Class Ventas End If ObjVentas.Dispose() + 'SI SE SELECCIONO UNA FACTURA PARA DEVOLUCION DE EFECTIVO DEBE ASOCIARLA A LA NOTA DE CREDITO + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso AplicaNuevoDocumento AndAlso DdlVentaUsado.SelectedValue.ToEntero() > 0 AndAlso TxtImportesRemisionesNC.Text.ToDecimal() > 0 Then + CveVentaUsadoDevolucionEfectivo = DdlVentaUsado.SelectedValue.ToEntero() + End If + AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento, AplicoNCFacturaActual:=True) End Sub @@ -26462,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) @@ -26532,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() @@ -26555,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() @@ -26625,6 +26675,7 @@ Partial Class Ventas If Not DtCotizaciones.Columns.Contains("Aplicado") Then DtCotizaciones.Columns.Add("Aplicado", Type.GetType("System.Boolean")) End If + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then GvCotPS.DataSource = DtCotizaciones.FiltraParametros("Cantidad > 0 AND EsAcumulador = False") Else @@ -26687,6 +26738,9 @@ Partial Class Ventas Dim Cves As New StringBuilder Dim CveMetodoPago As Integer = -1 Dim MetodoPagoDif As Boolean = False + + Dim ListaVentaDetalleCotizacion As List(Of MVentaDetalleCotizacion) = Nothing + If ChkCotProductos.Checked Then For Each row As DataRow In DTSeleccionadas.Rows If CveMetodoPago <> -1 And row("CveMetodoPago33").ToString().ToEntero() <> CveMetodoPago Then @@ -26699,8 +26753,9 @@ Partial Class Ventas CotizacionesLista.Add(row("CveVenta").ToString().ToEntero()) Next + 'CARGA LOS USADOS RELACIONADOS A LOS PRODUCTOS SELECCIONADOS DE LA COTIZACION If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - CalculaUsadosCotizacion(Cves, DTSeleccionadas, DtCotizaciones) + ListaVentaDetalleCotizacion = CalculaUsadosCotizacion(Cves, DTSeleccionadas, DtCotizaciones) End If Else @@ -26726,6 +26781,18 @@ Partial Class Ventas ObjClientes.Dispose() Cves.Clear() + 'SI SE CALCULARON USADOS LA CANTIDAD DEBE ASIGNARSE A PARTIR DEL CALCULO + If ListaVentaDetalleCotizacion IsNot Nothing AndAlso ListaVentaDetalleCotizacion.Count > 0 Then + + For Each Dr As DataRow In DtCotizacionesPS.Rows + Dim VentaDetalle = ListaVentaDetalleCotizacion.FirstOrDefault(Function(cot) cot.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero()) + If VentaDetalle IsNot Nothing Then + Dr("Cantidad") = VentaDetalle.Cantidad + End If + Next + + End If + If Not AgregaPSCotizacion() Then Alert("Ocurrió un error validar las partidas de las cotizaciones seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -26747,74 +26814,88 @@ Partial Class Ventas UpPS.Update() UpParametros.Update() End Sub + Private Class MVentaDetalleCotizacion + Public Property CveVentaDetalle As Integer + Public Property Cantidad As Decimal + End Class - Private Sub CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable) - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then + 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) - 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"}) - Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray() + 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 - Dim DTPSTemp As New DataTable '= TmpDT.Clone + Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero(), .Cantidad = tCantidad}) - DTPSTemp.Columns.Add("CveVenta", GetType(Integer)) - DTPSTemp.Columns.Add("Cantidad", GetType(Integer)) - DTPSTemp.Columns.Add("CvePS", GetType(Integer)) - DTPSTemp.Columns.Add("PU", GetType(Decimal)) + Next - 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 TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray() - If CveTamanioTemp > 0 Then + Dim DTPSTemp As New DataTable '= TmpDT.Clone - Dim DTTamanioTemp As New DataTable - Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").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)) - Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal + For Each DrowPartidas As DataRow In TmpDTCalculo + Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero() + Dim CveVenta As Integer = DrowPartidas("CveVenta").ToString().ToEntero() - If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then + If CveTamanioTemp > 0 Then - For Each dRowUpdate As DataRow In DTPSTemp.Rows + Dim DTTamanioTemp As New DataTable + Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString().ToEntero() - 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 + Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal - DTPSTemp.AcceptChanges() + If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then - Else - Dim dRowNuevo As DataRow = DTPSTemp.NewRow + For Each dRowUpdate As DataRow In DTPSTemp.Rows - dRowNuevo("CvePS") = CvePsTemp - dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal - dRowNuevo("PU") = Cargo - dRowNuevo("CveVenta") = CveVenta + 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 - DTPSTemp.Rows.Add(dRowNuevo) - DTPSTemp.AcceptChanges() - End If + 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 - 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 - End If - Next + Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero() + SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado) - End If - End Sub + Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = CveVentaDetalleUsado, .Cantidad = drowPsTamaños("Cantidad").ToString().ToDecimal()}) + + End If + Next + + Return Retorno + End Function Private Sub VerificaCotizaciones(ByRef dt As DataTable) If ChkCotProductos.Checked Then For Each Gvr As GridViewRow In GvCotPS.Rows @@ -26860,7 +26941,12 @@ Partial Class Ventas If DtCotizacionesPS IsNot Nothing Then Dim tCantidad As Decimal = 0 For Each Dr As DataRow In DtCotizacionesPS.Select() - tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + tCantidad = Dr("Cantidad").ToString().ToDecimal() + Else + tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal + End If + AgregarProductoServicio(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(), Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal, Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(),