From 419d6d2572ca013ab390f6ace5ae9290b081984f Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 31 Mar 2025 19:49:35 -0700 Subject: [PATCH 1/4] --Cambios en autorizacion de anticipos --- App_Code/ClsVentas.vb | 20 +++----------------- Ventas/PVCobranza.aspx.vb | 21 ++++++++------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index a4af209d8..4a76036b7 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -826,27 +826,13 @@ Public Class ClsVentas Return Retorno End Function - Public Function UpdateVentaAnticipoAutorizado(CveVenta As Integer, Autorizado As Boolean) As Boolean + Public Function UpdateAnticipoAutorizado(CveVenta As Integer, CveIE As Integer, Tipo As String, Autorizado As Boolean) As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_Vta_VentaAnticipoAutorizadoUpdate") + DataAdapter("PA_Vta_AnticipoAutorizadoUpdate") With SqlAdapter.SelectCommand.Parameters .Add("@CveVenta", SqlDbType.Int).Value = CveVenta - .Add("@Autorizado", SqlDbType.Bit).Value = Autorizado - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el estatus del anticipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - Return Retorno - End Function - - Public Function UpdateIxCAnticipoAutorizado(CveIE As Integer, Autorizado As Boolean) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Vta_IxCAnticipoAutorizadoUpdate") - With SqlAdapter.SelectCommand.Parameters .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo .Add("@Autorizado", SqlDbType.Bit).Value = Autorizado End With Try diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index e8c8fa9f8..bf5fbf010 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -1156,18 +1156,13 @@ Partial Class Ventas_PVCobranza If CveVenta > 0 OrElse CveIE > 0 Then Dim Actualizo As Boolean = False - If Tipo.Contiene("NC", "Ant") Then - If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then - Actualizo = True - End If - ElseIf Tipo.Contiene("IxC") Then - If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then - Actualizo = True - End If + + If ObjVentas.UpdateAnticipoAutorizado(CveVenta, CveIE, Tipo.Trim(), False) Then + Actualizo = True End If If Actualizo Then - Retorno = ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: {Folio}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta) + Retorno = ObjEventoBitacora.AddEventoBitacora($"El anticipo se aplicó correctamente. Folio: {Folio}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta) End If End If @@ -2279,7 +2274,7 @@ Partial Class Ventas_PVCobranza Dim CveIE As Integer = gvr.DataKey("CveIE").ToEntero() Dim ObjVta As New ClsVentas - If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, Saldo, 0, UsuarioActual.CveUsuario, 1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then + If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, Saldo, CveEstatus:=0, CveUsuario:=UsuarioActual.CveUsuario, TipoAutorizacion:=1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then Dim msgAlert = "La autorización se agregó correctamente." If EnvioMsg Then msgAlert = $"{msgAlert} Se envió una notificación de autorización a los usuarios" @@ -2381,9 +2376,9 @@ Partial Class Ventas_PVCobranza Dim AnticipoAutorizado = CBool(e.Row.DBCampo("AnticipoAutorizado")) - If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then - AnticipoAutorizado = True - End If + 'If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then + ' AnticipoAutorizado = True + 'End If If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then If e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant", "IxC") AndAlso Not AnticipoAutorizado Then From 756c92cd69318679e999cbb4e2cc2c15f3a8586b Mon Sep 17 00:00:00 2001 From: rakcsle Date: Sat, 29 Mar 2025 08:42:54 -0700 Subject: [PATCH 2/4] Compras correcion total al actualizar compra ya registrada --- App_WebReferences/GrowerService/service.disco | 6 + .../GrowerService/service.discomap | 7 + App_WebReferences/GrowerService/service.wsdl | 350 ++++++++++++++++++ Ashx/E158.ashx | 169 +++++++++ Compras/Compras.aspx.vb | 4 +- 5 files changed, 535 insertions(+), 1 deletion(-) create mode 100644 App_WebReferences/GrowerService/service.disco create mode 100644 App_WebReferences/GrowerService/service.discomap create mode 100644 App_WebReferences/GrowerService/service.wsdl create mode 100644 Ashx/E158.ashx diff --git a/App_WebReferences/GrowerService/service.disco b/App_WebReferences/GrowerService/service.disco new file mode 100644 index 000000000..ee543b932 --- /dev/null +++ b/App_WebReferences/GrowerService/service.disco @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/App_WebReferences/GrowerService/service.discomap b/App_WebReferences/GrowerService/service.discomap new file mode 100644 index 000000000..a7281ccc9 --- /dev/null +++ b/App_WebReferences/GrowerService/service.discomap @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/GrowerService/service.wsdl b/App_WebReferences/GrowerService/service.wsdl new file mode 100644 index 000000000..487453d24 --- /dev/null +++ b/App_WebReferences/GrowerService/service.wsdl @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ashx/E158.ashx b/Ashx/E158.ashx new file mode 100644 index 000000000..9ca13d1cc --- /dev/null +++ b/Ashx/E158.ashx @@ -0,0 +1,169 @@ +<%@ WebHandler Language="VB" Class="E158" %> + +Imports System +Imports System.Web +Imports System.Data +Imports Newtonsoft.Json +Imports Newtonsoft.Json.Linq +Imports Extensiones +Imports System.IO +Imports CrystalDecisions.CrystalReports.Engine +Imports CrystalDecisions.Shared +Imports Microsoft.Reporting.WebForms +Imports System.Threading +Imports System.Threading.Tasks +Imports System.Net.Http +Imports System.Net.Http.Headers +Imports SharpCompress.Archive.Rar +Imports SharpCompress.Common +Imports SharpCompress.Reader +Imports System.Xml +'Imports ADSistemaLibrary.SatXml +'Imports ADSistemaLibrary.SatXml.XmlSatCFDI +Imports System.Diagnostics +Imports System.Drawing +Imports System.Drawing.Imaging + + + +Public Class E158 : Implements IHttpHandler, IReadOnlySessionState + + + Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable + Get + Return False + End Get + End Property + + Private currentcontext As HttpContext + Private URLParametros As New Hashtable + Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest + context.Response.ContentType = "text/plain" + currentcontext = context + Dim retorno As String = "no se encontro la variable" + Try + Dim metodo As String = "" + Dim FechaActual As DateTime = ClsPaginas.NowADS() + Dim FechaEnvio As DateTime = FechaActual + + If context.Request("var") IsNot Nothing Then + URLParametros = Parametros(context.Request("var")) + metodo = URLParametros("metodo").ToString + 'SI TRAE UN JSON COMO PARAMETRO + ElseIf context.Request("metodo") IsNot Nothing Then + metodo = context.Request("metodo").ToString() + If context.Request("FechaEnvio") IsNot Nothing Then + FechaEnvio = context.Request("FechaEnvio").ToString().ToDateTime() + End If + End If + + Select Case metodo + Case "PreciosVentaCultivo" + Dim tCveEmpresa As Integer = context.Request("CveEmpresa").ToString.ToEntero + If PreciosVentaCultivo(tCveEmpresa, context) Then + retorno = "OK" + Else + retorno = "Error" + End If + + context.Response.Write(retorno) + End Select + Catch ex As Exception + ex.GuardaLog(ex.ToString()) + context.Response.Write(retorno) + End Try + + End Sub + + Private Function PreciosVentaCultivo(ByVal CveEmpresa As Integer, ByVal context As HttpContext) As Boolean + Dim Respuesta As Boolean = False + Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa) + + ' Crear una instancia del servicio web + Dim wsservice As New GrowerService.Service() + wsservice.Url = "http://webservices.optimaproduce.net/GrowerService/service.asmx" + + ' Llamar al método GetSales con los parámetros necesarios + + Dim Parametro1 As Integer = 9 + Dim Parametro2 As Integer = 1 + Dim Parametro3 As Integer = 43 + Dim Parametro4 As Integer = 0 '–batchid de una liquidación – 0 Todos + Dim Parametro5 As Integer = 3 '– Para agropecuaria Jam + Dim Parametro6 As Integer = 0 + Dim Parametro6Date As Date = Now.AddDays(-3) + + 'Dim DTresp As DataTable = wsservice.GetSales(Parametro1, Parametro2, Parametro3, Parametro4, Parametro5, Parametro6) + 'DTresp.WriteXml("C:\temp\GrowerService\Sales.xml", XmlWriteMode.WriteSchema) + + 'Dim DTAdjustements As DataTable = wsservice.GetAdjustements(Parametro1, Parametro2, Parametro4, Parametro5, Parametro6) + 'DTAdjustements.WriteXml("C:\temp\GrowerService\Adjustements.xml", XmlWriteMode.WriteSchema) + + + + 'Dim DTGeneralExpenses As DataTable = wsservice.GetGeneralExpenses(Parametro1, Parametro2, Parametro3, Parametro4, Parametro5, Parametro6, expenseID:=) + 'DTGeneralExpenses.WriteXml("C:\temp\GrowerService\GeneralExpenses.xml", XmlWriteMode.WriteSchema) + + 'Dim DTLotexpenses As DataTable = wsservice.GetLotExpenses(Parametro1, Parametro2, Parametro3, Parametro4, Parametro5, Parametro6, expenseID:=) + 'DTLotexpenses.WriteXml("C:\temp\GrowerService\Lotexpenses.xml", XmlWriteMode.WriteSchema) + + Dim DTTodayInvoices As DataTable = wsservice.GetTodayInvoices(Parametro1, Parametro2, Parametro3, Parametro4, Parametro5, Parametro6Date, ContractFilter:=1) + DTTodayInvoices.WriteXml("C:\temp\GrowerService\TodayInvoices.xml", XmlWriteMode.WriteSchema) + + Dim InvParametro1 As Integer = 9 + Dim InvParametro2 As Integer = 1 + Dim InvParametro3 As Date = Now.AddDays(-3) ' “01/01/2025” '- ldDate + Dim InvParametro4 As Integer = 3 '- PackerID + Dim InvParametro5 As Integer = 0 ' - GrowerID + Dim InvParametro6 As Integer = 0 '- LabelID(0 = Todos) + Dim InvParametro7 As String = ”E” '- Language + + 'Dim DTIntentoryActivity As DataTable = wsservice.GetInventoryActivity(InvParametro1, InvParametro2, InvParametro3, InvParametro4, InvParametro5, InvParametro6, InvParametro7) + 'DTIntentoryActivity.WriteXml("C:\temp\GrowerService\IntentoryActivity.xml", XmlWriteMode.WriteSchema) + + + + + + Return Respuesta + End Function + + + Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario + Dim UsuarioActual As Usuario = Nothing + Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa) + Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena) + UsuarioActual = ObjUsuarios.GetUsuarioDetalle(CveUsuario, CveEmpresa) + If UsuarioActual IsNot Nothing Then + HttpContext.Current.Session("UsuarioSIG") = UsuarioActual + 'CreaObjetoEmpresa(UsuarioActual) + End If + ObjUsuarios.Dispose() + + Return UsuarioActual + End Function + + Private Function Parametros(Cadena As String) As Hashtable + Cadena = Decripta(Cadena) + Dim P1() As String = Cadena.Split("&"c) + Dim Tmp As String + Dim P2() As String + + Dim URLParametros As New Hashtable + + For Each Tmp In P1 + P2 = Tmp.Replace("%26%", "&").Split("="c) + URLParametros.Add(P2(0).ToString(), P2(1)) + Next + Return URLParametros + End Function + + +End Class + + + + + + + diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 1c656dea0..784aaecf0 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -17381,7 +17381,9 @@ Partial Class Compras_Compras If TxtIEPS.Text.ToDouble > 0 Then TrIEPS.Visible = True End If If TxtDescuento.Text.ToDouble > 0 Then TrDescuento.Visible = True - If ActualizaTotales And UsuarioActual.CveEmpresa = 72 Then TxtTotal.Text = Total.ToString.FormatoNumero() + 'If ActualizaTotales And UsuarioActual.CveEmpresa = 72 Then + TxtTotal.Text = Total.ToString.FormatoNumero() + 'End If Else TxtSubTotal.Text = SubTotal.ToString.FormatoNumero() TxtSubTotal2.Text = SubTotal2.ToString.FormatoNumero() From 929f160a3d76e740236f761214cd249bd1468100 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 31 Mar 2025 22:58:55 -0700 Subject: [PATCH 3/4] Ventas Actualizar Linea Adicional --- Agropecuaria/RepPreciosVentaManifiesto.aspx | 157 +++++++++++ .../RepPreciosVentaManifiesto.aspx.vb | 261 ++++++++++++++++++ App_Code/ClsPaginas.vb | 2 + App_Code/ClsVentas.vb | 3 +- Compras/Compras.aspx.vb | 26 +- Ventas/Ventas.aspx.vb | 19 +- 6 files changed, 462 insertions(+), 6 deletions(-) create mode 100644 Agropecuaria/RepPreciosVentaManifiesto.aspx create mode 100644 Agropecuaria/RepPreciosVentaManifiesto.aspx.vb diff --git a/Agropecuaria/RepPreciosVentaManifiesto.aspx b/Agropecuaria/RepPreciosVentaManifiesto.aspx new file mode 100644 index 000000000..d61fd61be --- /dev/null +++ b/Agropecuaria/RepPreciosVentaManifiesto.aspx @@ -0,0 +1,157 @@ +<%@ Page Title="Reporte de Ordenes de Servicio Médicas" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepPreciosVentaManifiesto.aspx.vb" Inherits="Agrupecuaria_RepPreciosVentaManifiesto" %> + + + + + + + + + + + + + + Reporte de Ordenes de Servicio Médicas + + + + +
  • + Excel +
  • +
    + + + +
    +
    + + + + +
    +
    +
    + + +
    +
    +
    + + + +
    + Fecha Inicio: + +
    +
    +
    + + + + +
    + + + + + + +
    +
    + Fecha Fin: + +
    +
    +
    + + + + +
    + + + + + + +
    + + SubProyecto: +
    + +
    + + + +
    +
    +
    + +
    +
    +
    + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    + + + + + + <%--0--%> + + <%----%> + <%--1--%> + + <%--2--%> + + <%--3--%> + + <%--4--%> + + <%--5--%> + + <%--6--%> + + <%--7--%> + + <%--8--%> + + <%--9--%> + + <%--10--%> + + <%--11--%> + + <%--12--%> + + <%--13--%> + + <%--14--%> + + + + + + + + + +
    + + diff --git a/Agropecuaria/RepPreciosVentaManifiesto.aspx.vb b/Agropecuaria/RepPreciosVentaManifiesto.aspx.vb new file mode 100644 index 000000000..53e5f678f --- /dev/null +++ b/Agropecuaria/RepPreciosVentaManifiesto.aspx.vb @@ -0,0 +1,261 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports Extensiones + +Partial Class Agrupecuaria_RepPreciosVentaManifiesto + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx") + + CargaCombos() + CargaDatos() + End If + + End Sub + + +#Region " CARGA COMBOS " + + + Private Sub CargaCombos() + + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) + + CargaCultivo() + + 'CargaEstatus + DdlEstatusOS.DataSource = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa) + DdlEstatusOS.DataBind() + DdlEstatusOS.Items.Insert(0, New ListItem("Todos", "-1")) + Dim DTTecnicos As DataTable = Nothing + + Dim ObjOS As New ClsOS + If ObjOS.GetSubProyectosEstatusInicial(-1, 3, UsuarioActual.CveEmpresa) Then + DTTecnicos = ObjOS.DtResultados + End If + ObjOS.Dispose() + + DdlTecnico.DataSource = DTTecnicos + DdlTecnico.DataBind() + DdlTecnico.Items.Insert(0, New ListItem("Todos", "-1")) + DdlTecnico.Items.Insert(1, New ListItem("Sin Asignar", "-2")) + + '376 + If UsuarioActual.TienePermisoProceso(376) Then + DdlTecnico.Enabled = False + DdlTecnico.SelectedValueExist(UsuarioActual.CveUsuario) + End If + + + If IfNull(Request("CveUsuarioTecnico"), 0).ToString.ToEntero > 0 Then + DdlTecnico.SelectedValueExist(Request("CveUsuarioTecnico").ToString) + Else + ViewState("CveUsuarioTecnico") = -1 + End If + + 'CargaClientes + Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + 'If EsWS Then + ' DdlClientes.setEsWebService(True) + 'Else + ' DdlClientes.setEsWebService(False) + ' DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + ' DdlClientes.DataBind() + ' DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + 'End If + + 'Vendedor + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros("VendedorTipo in (1,4)") 'vendedores y vendedores de piso + DdlVendedor.DataBind() + DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1")) + DdlVendedor.Items.Insert(1, New ListItem("Sin Vendedor", "-2")) + + If UsuarioActual.CveVendedor > 0 Then + DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor) + DdlVendedor.Enabled = False + End If + + txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString + txtFechaF.Text = NowADS().AddDays(2).ToShortDateString + + + DdlMedico.DataSource = If(UsuarioActual.CveVendedor > 0, GlobalDTMedicos(UsuarioActual.CveEmpresa).FiltraParametros($" Estatus = 'True' AND CveVendedor = {UsuarioActual.CveVendedor} "), GlobalDTMedicos(UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True' ")) + DdlMedico.DataBind() + + DdlProcedimiento.DataSource = GlobalDTProcedimientos(UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True' ") + DdlProcedimiento.DataBind() + + DdlTipoVenta.DataSource = GlobalDTTipoVenta(UsuarioActual.CveEmpresa) + DdlTipoVenta.DataBind + + Dim ObjVentas As New ClsVentas + + If ObjVentas.GetMedicosEspecialidades(-1, UsuarioActual.CveEmpresa, -1) Then + DdlEspecialidad.DataSource = ObjVentas.DtResultados + Else + DdlEspecialidad.DataSource = Nothing + End If + + ObjVentas.Dispose() + + DdlEspecialidad.DataBind() + DdlEspecialidad.Items.Insert(0, New ListItem("Todas", "-1")) + + DdlClienteSucursal.DataSource = GlobalDTClientesTodosSucursales(UsuarioActual.CveEmpresa) + DdlClienteSucursal.DataBind() + DdlClienteSucursal.Items.Insert(0, New ListItem("Todos", "-1")) + + 'Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + 'If EsWS Then + ' DdlCliente.setEsWebService(True) + + 'Else + ' DdlCliente.setEsWebService(False) + ' DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + ' DdlCliente.DataBind() + ' DdlCliente.ddl.Items.Insert(0, New ListItem("Seleccione Uno", "-1")) + 'End If + + End Sub + + Private Sub CargaCultivo() + DdlCultivo.Items.Clear() + If DdlSubProyecto.GetSelectedValuesM(True) <> "" Then + DdlCultivo.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveSubProyecto IN ({0})", DdlSubProyecto.GetSelectedValuesM(True))) + DdlCultivo.DataBind() + Else + DdlCultivo.DataSource = Nothing + DdlCultivo.DataBind() + End If + End Sub + +#End Region + +#Region " CARGA DATOS " + Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click + + CargaDatos() + + End Sub + + Private Sub CargaDatos() + + Dim ObjOS As New ClsOS + Dim FechaI As Date = If(txtFechaI.Text.Trim = "", MinFecha, txtFechaI.Text.ToDate) + Dim FechaF As Date = If(txtFechaF.Text.Trim = "", MaxFecha, txtFechaF.Text.ToDate) + Dim Cvecliente As Integer = DdlClienteSucursalCliente() + Dim CveClienteSucursal As Integer = DdlClienteSucursalSucursal() + LnkPersonalizar.Visible = False + + If ObjOS.GetRepOrdenesServicioMedicasRep(FechaI, FechaF, Cvecliente, DdlVendedor.SelectedValue.ToEntero, DdlEstatusOS.SelectedValue.ToEntero, DdlTecnico.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, + CveMedico:=DdlMedico.SelectedValue.ToEntero, CveProcedimiento:=DdlProcedimiento.SelectedValue.ToEntero, CveEspecialidad:=DdlEspecialidad.SelectedValue.ToEntero, + CveClienteSucursal:=CveClienteSucursal, CveUsuario:=UsuarioActual.CveUsuario, CveTipoVenta:=DdlTipoVenta.SelectedValue.ToEntero) Then + GvDatos.DataSource = ObjOS.DtResultados + If ObjOS.DtResultados IsNot Nothing AndAlso ObjOS.DtResultados.Rows.Count > 0 Then + LnkPersonalizar.Visible = True + End If + Else + GvDatos.DataSource = Nothing + End If + + ObjOS.Dispose() + + GvDatos.DataBind() + + + LnkExportar.Visible = If(GvDatos.Rows.Count > 0, True, False) + UpAcciones.Update() + + + UPDatos.Update() + + End Sub + + +#End Region + + + 'Private Sub CargaClientes() + ' DdlClientes.ddl.Items.Clear() + ' DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) '.FiltraParametros($"CveClienteClasificacion = {DdlClienteClasificacion.SelectedValue.ToEntero} OR {DdlClienteClasificacion.SelectedValue.ToEntero} = -1") + ' DdlClientes.DataBind() + ' DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + 'End Sub + + Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged + CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue) + End Sub + + +#Region " GV DATOS - ROW DATABOUND " + Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.Cells(1).Attributes.Add("data-order", e.Row.DBCampo("FechaCita").ToDateTime.ToString("yyyyMMddHHmm")) + If e.Row.DBCampo("CveOS") = "" Then + e.Row.CssClass = "Totales" + End If + End If + End Sub +#End Region + + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + + Dim SubProyecto As String = "" + + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then + SubProyecto = DdlSubProyecto.SelectedItem.Text + End If + + Dim SbFiltros As New StringBuilder() + SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|") + SbFiltros.AppendFormat("SubProyecto: {0}|", SubProyecto) + + + GvDatos.ExportToExcelGembox("OrdenesServicio", UsuarioActual, "Ordenes de Servicio Medicas", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) + + End Sub + + Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + End Sub + + Protected Sub LnkPersonalizar_Click(sender As Object, e As EventArgs) + + ' ChkGuardarPersonalizacion.Checked = False + RegistraScript("$('#DivPersonalizar').modal('show')") + + End Sub + + Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click + Personaliza() + End Sub + + Private Sub Personaliza() + GvDatos.Columns(13).Visible = ChkObservaciones.Checked + GvDatos.Columns(14).Visible = ChkFolioAdicional.Checked + CargaDatos() + End Sub + + Private Function DdlClienteSucursalCliente() As Integer + If DdlClienteSucursal.SelectedValue = "-1" Then + Return -1 + Else + Dim array As String() = DdlClienteSucursal.SelectedValue.Split("|"c) + Return If(array(0).ToEntero > 0, array(0).ToEntero, -1) + End If + End Function + + Private Function DdlClienteSucursalSucursal() As Integer + If DdlClienteSucursal.SelectedValue = "-1" Then + Return -1 + Else + Dim array As String() = DdlClienteSucursal.SelectedValue.Split("|"c) + Return If(array(1).ToEntero > 0, array(1).ToEntero, -1) + End If + End Function + + +End Class diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index ac4aa3906..8e1b2afe6 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -11138,6 +11138,8 @@ Public Class ClsPaginas PaginaDict.Add("/Contabilidad/OCDetalleAlmacen.aspx".ToUpper(), -1) PaginaDict.Add("/Contabilidad/RepBalanceGeneralHorizontal.aspx".ToUpper(), -1) PaginaDict.Add("/Agropecuaria/CierreCultivo.aspx".ToUpper(), 1326) + PaginaDict.Add("/Agropecuaria/RepPreciosVentaManifiesto.aspx".ToUpper(), -1) + PaginaDict.Add("/Inventarios/RepRSCO.aspx".ToUpper(), 1328) PaginaDict.Add("/testApi.aspx".ToUpper(), -1) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 7e514cd05..81ca7b875 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -6335,7 +6335,7 @@ Public Class ClsVentas End Function - Public Function UpdateVentaLineaAdicional(CveLineaAdicional As Integer, CveVenta As Integer, LineaAdicionalComprobante As String, CveLineaAdicionalEstatus As Integer, CveEmpresa As Integer) As Boolean + Public Function UpdateVentaLineaAdicional(CveLineaAdicional As Integer, CveVenta As Integer, LineaAdicionalComprobante As String, CveLineaAdicionalEstatus As Integer, CveEmpresa As Integer, Optional OrdenCompra As String = "-1") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_LineasAdicionalesVentaUpdate") @@ -6345,6 +6345,7 @@ Public Class ClsVentas .Add("@LineaAdicionalComprobante", SqlDbType.VarChar).Value = LineaAdicionalComprobante .Add("@CveLineaAdicionalEstatus", SqlDbType.Int).Value = CveLineaAdicionalEstatus .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@OrdenCompra", SqlDbType.VarChar).Value = OrdenCompra End With Try SqlAdapter.Fill(Data) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 784aaecf0..986c618b0 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -252,6 +252,20 @@ Partial Class Compras_Compras Return ViewState("CveCompra").ToString.ToEntero End Get End Property + + Private Property CveCompraFactura As Integer + Get + If ViewState("CveCompraFactura") Is Nothing Then + ViewState("CveCompraFactura") = -1 + End If + Return ViewState("CveCompraFactura").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCompraFactura") = value + End Set + End Property + + Private ReadOnly Property CveFactura As Integer Get Return ViewState("CveFactura").ToString.ToEntero @@ -1545,7 +1559,7 @@ Partial Class Compras_Compras If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero) End If - + CargaGvPersonal() ElseIf Request("CveCompra") IsNot Nothing AndAlso IsNumeric(Request("CveCompra")) AndAlso Request("CveCompra").ToEntero > 0 Then 'If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 Then @@ -1594,6 +1608,7 @@ Partial Class Compras_Compras 'End If LnkAgregarGuia.Visible = False UpLnkPaqueteriaGuias.Update() + CargaGvPersonal() End If If UsuarioActual.TienePermisoProceso(360) AndAlso UsuarioActual.CveEmpresa = 119 Then BtnProrateoDeducible.Visible = True @@ -2973,6 +2988,7 @@ Partial Class Compras_Compras LblRetISR.Text = If(dr("RetISR").ToString.ToDecimal > 0, TmpDT.MAX("RetISRPorcentaje").ToDecimal * 100, 0).ToString.FormatoNumero(4) '(If(SubTotal2 > 0, (RetencionISR / SubTotal2), 0) * 100).FormatoNumero(3) If dr("TipoFactura").ToString <> "CFDi" Then LblTipoFact.Text = dr("TipoFactura").ToString : divTipoFactura.Visible = True ViewState("CveFactura") = dr("CveFactura").ToString.ToEntero + CveCompraFactura = dr("CveFactura").ToString.ToEntero ViewState("IdPoliza") = dr("IdPoliza").ToString.ToEntero DdlMoneda.SelectedValue = dr("CveMoneda").ToString @@ -17381,9 +17397,11 @@ Partial Class Compras_Compras If TxtIEPS.Text.ToDouble > 0 Then TrIEPS.Visible = True End If If TxtDescuento.Text.ToDouble > 0 Then TrDescuento.Visible = True - 'If ActualizaTotales And UsuarioActual.CveEmpresa = 72 Then - TxtTotal.Text = Total.ToString.FormatoNumero() - 'End If + + If ActualizaTotales And UsuarioActual.CveEmpresa = 72 Or Not CveCompraFactura > 0 Then + TxtTotal.Text = Total.ToString.FormatoNumero() + End If + Else TxtSubTotal.Text = SubTotal.ToString.FormatoNumero() TxtSubTotal2.Text = SubTotal2.ToString.FormatoNumero() diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index e4f747f8b..b9612d751 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -39669,8 +39669,25 @@ Partial Class Ventas End If End If + + Dim OrdenCompra As String = "-1" + + If UsuarioActual.CveEmpresa = 119 Then + Dim arrayStr As String() = DdlLineaAdicional.SelectedItem.Text.Split(":"c) + If arrayStr.Length > 0 Then + Dim OrdenCompraTmp As String = arrayStr(0).Replace("IMP", "").Trim + If TxtOrdenCompra.Text.Trim.Length > 0 Then + If OrdenCompraTmp.ToUpper <> TxtOrdenCompra.Text.Trim.ToUpper Then + OrdenCompra = $"{TxtOrdenCompra.Text}, {OrdenCompraTmp}" + End If + Else + OrdenCompra = $"{OrdenCompraTmp}" + End If + End If + End If + Using ObjVentas As New ClsVentas - If ObjVentas.UpdateVentaLineaAdicional(DdlLineaAdicional.SelectedValue.ToEntero(), CveVenta, "", 1, UsuarioActual.CveEmpresa) Then + If ObjVentas.UpdateVentaLineaAdicional(DdlLineaAdicional.SelectedValue.ToEntero(), CveVenta, "", 1, UsuarioActual.CveEmpresa, OrdenCompra:=OrdenCompra) Then Alert("Se actualizó la linea adicional de crédito de la venta") End If End Using From 1d902f26b40fb1373694a6fb4f8e398ab431acd9 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 1 Apr 2025 11:21:25 -0700 Subject: [PATCH 4/4] --FIX autorizaciones de NC --- Ventas/Ventas.aspx.vb | 45 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index b9612d751..dbece0253 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10505,7 +10505,7 @@ Partial Class Ventas End Sub - Private Sub VerificaAutorizacionEgs(Optional VerificarImportes As Boolean = True) + Private Sub VerificaAutorizacionEgs(Optional VerificarImportes As Boolean = True, Optional MostrarAlertas As Boolean = True) Dim ImporteAutorizacion As Decimal = 0 Dim TipoAutorizacion As Integer = 0 @@ -10535,7 +10535,10 @@ Partial Class Ventas CveAutorizacion = -1 If BloquearCredito Then - Alert($"El importe autorizado es insuficiente. Importe autorizado:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia) + If MostrarAlertas Then + Alert($"El importe autorizado es insuficiente. Importe autorizado:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia) + End If + Exit Sub End If End If @@ -10543,7 +10546,10 @@ Partial Class Ventas Else CveAutorizacion = -1 - Alert($"No se encontro una autorización de crédito.", TipoMensaje.MsgAdvertencia) + If MostrarAlertas Then + Alert($"No se encontro una autorización de crédito.", TipoMensaje.MsgAdvertencia) + End If + Exit Sub End If End Sub @@ -31508,6 +31514,23 @@ Partial Class Ventas Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False, Optional TipoDoctoNC As String = "Egs") Try + 'VALIDACION DE AUTORIZACION PARA NC, POR AHORA SOLO BDH + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso AplicoNCFacturaActual AndAlso TipoDoctoNC = "Egs" Then + Dim PermiteAutorizacion = False + 'SI NO ES GENERADA CON REMISIONES DE NC, UTILIZAR LA AUTORIZACION + If (ListaRemisionesNC Is Nothing OrElse ListaRemisionesNC.Count = 0) Then + PermiteAutorizacion = True + End If + + If PermiteAutorizacion Then + VerificaAutorizacionEgs(VerificarImportes:=True, MostrarAlertas:=True) + If Me.CveAutorizacion <= 0 Then + Exit Sub + End If + End If + End If + + Me.AplicaDocumentoNuevoNC = AplicaNuevoDocumento Dim DrPS As DataRow = Nothing @@ -40582,10 +40605,13 @@ Partial Class Ventas RblRNCTipo_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty) If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - VerificaAutorizacionEgs(VerificarImportes:=True) - If Me.CveAutorizacion <= 0 Then - Exit Sub - Else + + TxtImportesRemisionesNC.Text = "0.00" + TxtNCImporte.Text = "0.00" + + VerificaAutorizacionEgs(VerificarImportes:=True, MostrarAlertas:=False) + + If Me.CveAutorizacion > 0 Then Using ObjVentas As New ClsVentas If ObjVentas.GetAutorizacion(Me.CveAutorizacion, UsuarioActual.CveEmpresa) Then If ObjVentas.DtResultados.FiltroPrimeroValor("CveTipoVenta").ToEntero() > 0 Then @@ -40595,7 +40621,12 @@ Partial Class Ventas End If End If End Using + Else + DivTipoVentaAsingado.Visible = True + LblTipoVentaAsignado.Text = "Sin definir" + DdlNCPS.Enabled = True End If + End If RegistraScript("$('#ModalAplicarNC').modal('show');", "ModalNC")