diff --git a/AF/RepDepreciacion.aspx b/AF/RepDepreciacion.aspx index 9d4588dd0..a6faf68bf 100644 --- a/AF/RepDepreciacion.aspx +++ b/AF/RepDepreciacion.aspx @@ -42,6 +42,9 @@
  • Personalizar
  • +
  • + +
  • @@ -94,7 +97,7 @@
    - + @@ -172,7 +175,40 @@ +
    - + + + 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/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/AjustesSeccionAlmacen.aspx.vb b/Inventarios/AjustesSeccionAlmacen.aspx.vb index 262c974ff..3ba282c5d 100644 --- a/Inventarios/AjustesSeccionAlmacen.aspx.vb +++ b/Inventarios/AjustesSeccionAlmacen.aspx.vb @@ -174,9 +174,9 @@ Partial Class Inventarios_AjustesSeccionAlmacen If Lista.ContainsKey(CvePS) Then ObjPS.UpdateAplicaSeccionAlmacen(Row("CvePS").ToString().ToEntero(), UsuarioActual.CveEmpresa, True) End If - 'If Not ObjInventario.AddProductosServiciosAlmacenSeccion(CvePS, CveAlmacen, CveSeccionAlmacen) Then - ' ErrorMovInv = True - 'End If + If Not ObjInventario.AddProductosServiciosAlmacenSeccion(CvePS, CveAlmacen, CveSeccionAlmacen) Then + ErrorMovInv = True + End If If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, CveUM, CvePS, PU, -1, CostoIndirecto:=CostoIndirecto, CveSeccionAlmacen:=CveSeccionAlmacen, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorMovInv = True @@ -447,9 +447,9 @@ Partial Class Inventarios_AjustesSeccionAlmacen 'ACTUALIZAMOS EL PS, PARA QUE TENGA EL APLICA SECCION ErrorMovInv = Not ObjPS.UpdateAplicaSeccionAlmacen(CvePS, UsuarioActual.CveEmpresa, True) - 'If Not ObjInventario.AddProductosServiciosAlmacenSeccion(CvePS, CveAlmacen, CveSeccionAlmacen) Then - ' ErrorMovInv = True - 'End If + If Not ObjInventario.AddProductosServiciosAlmacenSeccion(CvePS, CveAlmacen, CveSeccionAlmacen) Then + ErrorMovInv = True + End If If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, CantidadEntrada, CveUMEntrada, CvePSEntrada, PUEntrada, -1, CostoIndirecto:=CostoIndirecto, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorMovInv = True diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 021418dfa..35736ad6d 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -882,7 +882,7 @@ Partial Class Inventarios_TraspasoAlmacen dtvirtual = ObjInventario.DtResultados If dtvirtual.Rows.Count > 0 Then - CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtualSalida, 37, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/V", CveMovimientoRelacionado:=CveMovimientoSalida) + CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtualSalida, 37, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/V", CveMovimientoRelacionado:=CveMovimientoSalida, CveAlmacenDestino:=CveAlmacenVirtualEntrada) FolioVirtualSalida = ObjInventario.Folio For Each RowVirtual As DataRow In dtvirtual.Rows @@ -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,14 +1744,14 @@ 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, - CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=ImporteDecimal) Then - ErrorMovInv = True - TextoError = "Ocurrió un erro al cancelar el traspaso" - End If + 'If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, + ' CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=ImporteDecimal) Then + ' ErrorMovInv = True + ' TextoError = "Ocurrió un erro al cancelar el traspaso" + 'End If End If End If @@ -1841,7 +1842,7 @@ Partial Class Inventarios_TraspasoAlmacen Dim RealizarMovimientoVirtual As Boolean = False - If UsuarioActual.Empresa.Funcionalidad(573) = "1" AndAlso TipoAlmacenOrigen.Contiene(1, 27) Then + If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then RealizarMovimientoVirtual = True End If @@ -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,27,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/Ventas/CatMetasVendedores.aspx b/Ventas/CatMetasVendedores.aspx index 366e385c0..555c0f8b9 100644 --- a/Ventas/CatMetasVendedores.aspx +++ b/Ventas/CatMetasVendedores.aspx @@ -22,7 +22,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -86,7 +86,7 @@ - + diff --git a/Ventas/CatMetasVendedores.aspx.vb b/Ventas/CatMetasVendedores.aspx.vb index 0f1e9f8f5..5a956cdb6 100644 --- a/Ventas/CatMetasVendedores.aspx.vb +++ b/Ventas/CatMetasVendedores.aspx.vb @@ -42,13 +42,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 +101,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") diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index 4a8e19e4e..28094c1f9 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -1336,10 +1336,10 @@ Partial Class Ventas_ClientesAbonar If FuncionalidadFluctuacionImpuestos Then Dim TCImpuestos As Decimal = tipoCambioPago - Diferencia -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA - Diferencia += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA - Diferencia += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR - Diferencia -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS + Diferencia -= (((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IVA + Diferencia -= (((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetIVA + Diferencia -= (((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetISR + Diferencia -= (((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVenta) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IEPS Diferencia = Math.Round(Diferencia, 2) End If 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 41c71e9c0..93278664a 100644 --- a/Ventas/MetasVendedores.aspx.vb +++ b/Ventas/MetasVendedores.aspx.vb @@ -37,17 +37,17 @@ Partial Class MetasVendedores DdlVendedorFiltro.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) DdlVendedorFiltro.DataBind() - DdlVendedorFiltro.Items.Insert(0, New ListItem("Seleccionar", "-1")) + DdlVendedorFiltro.Items.Insert(0, New ListItem("Todos", "-1")) DdlCategoria.DataSource = GlobalDTGralCategorias(UsuarioActual.CveEmpresa) DdlCategoria.DataBind() - DdlCategoria.Items.Insert(0, New ListItem("Seleccionar", "-1")) + DdlCategoria.Items.Insert(0, New ListItem("Todos", "-1")) DdlClasificaciones.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) 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,8 +75,10 @@ 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, "%") + 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.DataKey("Etiqueta") Case "GrupoSuperior" e.Row.CssClass = "GrupoSuperior" diff --git a/Ventas/RepRecuperacion.aspx b/Ventas/RepRecuperacion.aspx index 6e0db6b77..502929933 100644 --- a/Ventas/RepRecuperacion.aspx +++ b/Ventas/RepRecuperacion.aspx @@ -178,6 +178,37 @@ + +
    Fecha Inicio:
    +
    +
    + + + + +
    + + + + + + +
    +
    Fecha Fin:
    +
    +
    + + + + +
    + + + + + + +
    diff --git a/Ventas/RepRecuperacion.aspx.vb b/Ventas/RepRecuperacion.aspx.vb index 70e2d6926..d6303d9a0 100644 --- a/Ventas/RepRecuperacion.aspx.vb +++ b/Ventas/RepRecuperacion.aspx.vb @@ -121,16 +121,21 @@ Partial Class Ventas_RepRecuperacion Private Sub CargaDatos() Dim ObjMovtos As New ClsMovimientos() + If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then TCEspecifico = TxtEspecifico.Text.ToDecimal Else TCEspecifico = -1 - End If - + End If + + Dim FechaAplicadoI As Date = If(IsDate(TxtFechaAplicadoI.Text), TxtFechaAplicadoI.Text.ToDate, MinFecha) + Dim FechaAplicadoF As Date = If(IsDate(TxtFechaAplicadoF.Text), TxtFechaAplicadoF.Text.ToDate, MaxFecha) + + If ObjMovtos.GetRepRecuperacion(txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlClientes.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, -1, "-1", UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue.ToString, CveBanco:=DdlBanco.SelectedValue.ToEntero, CveCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero, EstatusCliente:=DdlEstatusCliente.SelectedValue.ToEntero, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoCambio:=RblTipoCambio.SelectedValue.ToEntero, TCEspecifico:=TCEspecifico, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, - EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero()) Then + EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero(), FechaAplicadoI:=FechaAplicadoI, FechaAplicadoF:=FechaAplicadoF) Then GvDatos.DataSource = ObjMovtos.DtResultados DtDatos = ObjMovtos.DtResultados Else diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 3ea56173b..0bc461505 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -3493,7 +3493,9 @@ Kilometraje  - + + + Correo Notificación Usuario Final:   diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 1fc29203d..38f0a6c74 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" @@ -7236,6 +7245,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" @@ -7481,8 +7497,8 @@ Partial Class Ventas If TxtKilometraje.Text.ToEntero() = 0 Then 'cuando es la clasificacion de llantas - Dim FaltaObservacion As Integer = TmpDT.FiltroPrimeroValor("CveClasificacion", "CveClasificacion = 20342").ToEntero() - If FaltaObservacion = 20342 Then + Dim FaltaObservacion As Integer = TmpDT.MAX("CveClasificacion", "Clasificacion like '%Llanta%'").ToEntero '.FiltroPrimeroValor("CveClasificacion", "CveClasificacion = 20342").ToEntero() + If FaltaObservacion > 0 Then 'sino se ha especificado km cuando tiene al clasif llanta Alert("No se ha especificado el kilometraje.", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -10774,6 +10790,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 +12751,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 +19146,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 @@ -24675,9 +24698,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 +24722,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 +24752,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 @@ -26625,6 +26660,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 +26723,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 +26738,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 +26766,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,14 +26799,29 @@ 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 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) - Private Sub CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable) If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then Dim DTTamanios As DataTable = GlobalDTAcumTamaños() 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}) + + Next + Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray() Dim DTPSTemp As New DataTable '= TmpDT.Clone @@ -26810,11 +26877,15 @@ Partial Class Ventas Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero() SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado) + Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = CveVentaDetalleUsado, .Cantidad = drowPsTamaños("Cantidad").ToString().ToDecimal()}) + End If Next End If - End Sub + + 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 +26931,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(),