From bc94bb9a12839518a224eed8eb82af5d55bb2573 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 15 Jan 2025 09:46:30 -0700 Subject: [PATCH 1/4] --FIX asignacion de valores forma,metodo y uso cfdi --- Ventas/Ventas.aspx.vb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index d4819b53d..73e45b42b 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -12550,6 +12550,15 @@ Partial Class Ventas ObjFactura.CvePrePoliza = -1 ObjFactura.FechaVencimiento = TxtFechaPago.Text.ToDate + 'CLIENTE + ObjFactura.CveCliente = CveCliente + ObjFactura.SetCliente() + ObjFactura.CveEmpresaCRM = CveEmpresaCRM + If CveCliente = -1 And CveEmpresaCRM > 0 Then + ObjFactura.Cliente.Nombre = LblEmpresaCRM.Text + ObjFactura.Cliente.RFC = LblRFCCRM.Text + End If + ObjFactura.CveMetodoPago = DdlMetodoPago33.SelectedValue.ToEntero() ObjFactura.MetodoPago = If(DdlMetodoPago33.SelectedValue.ToEntero() > 0, DdlMetodoPago33.SelectedItem.Text, "") 'ObjFactura.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") @@ -12996,15 +13005,6 @@ Partial Class Ventas ObjFactura.DtDetalle = TmpDT.Copy ObjFactura.DtFirmas = DTmpF.Copy - 'CLIENTE - ObjFactura.CveCliente = CveCliente - ObjFactura.SetCliente() - ObjFactura.CveEmpresaCRM = CveEmpresaCRM - If CveCliente = -1 And CveEmpresaCRM > 0 Then - ObjFactura.Cliente.Nombre = LblEmpresaCRM.Text - ObjFactura.Cliente.RFC = LblRFCCRM.Text - End If - 'SUCURSAL 'ObjFactura.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero() ObjFactura.SetSubProyectoMatriz(Me) @@ -13289,6 +13289,10 @@ Partial Class Ventas ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal + 'CLIENTE + ObjFacturaDevolucion.CveCliente = CveCliente + ObjFacturaDevolucion.SetCliente() + ObjFacturaDevolucion.CveMetodoPago = DdlMetodoPago33.SelectedValue.ToEntero() ObjFacturaDevolucion.MetodoPago = If(DdlMetodoPago33.SelectedValue.ToEntero() > 0, DdlMetodoPago33.SelectedItem.Text, "") @@ -13479,10 +13483,6 @@ Partial Class Ventas ObjFacturaDevolucion.DtDetalle = TmpDT ObjFacturaDevolucion.DtFirmas = DTmpF - 'CLIENTE - ObjFacturaDevolucion.CveCliente = CveCliente - ObjFacturaDevolucion.SetCliente() - 'SUCURSAL ObjFacturaDevolucion.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero() ObjFacturaDevolucion.SetSubProyectoMatriz(Me) @@ -40684,7 +40684,7 @@ Partial Class Ventas For index As Integer = 0 To DtExistencias.Columns.Count - 1 For Each gvr As GridViewRow In GvExist.Rows If index = 0 Then - gvr.Cells(index).CssClass = "titulops" + gvr.Cells(index).Attributes.Add("colspan", "3") Else gvr.Cells(index).HorizontalAlign = HorizontalAlign.Right End If From 5b282abf7ffa6bc7c452a326b76209b9a490778d Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 15 Jan 2025 21:12:30 -0700 Subject: [PATCH 2/4] =?UTF-8?q?0=20-=20Conta:=20Aplicaci=C3=B3n=20de=20pag?= =?UTF-8?q?o=20a=20proveedores=20en=20pesos=20y=20d=C3=B3lares=20con=20una?= =?UTF-8?q?=20misma=20cuenta,=20ej.=20=20SCHNEIDER=20ELECTRIC=20MEXICO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsMovimientos.vb | 5 +- Bancos/ProveedoresAbonar.aspx | 157 ++++++++++++++++++++++------- Bancos/ProveedoresAbonar.aspx.vb | 112 +++++++++++++++----- Bancos/RepProveedoresPagos.aspx | 84 ++++++++------- Bancos/RepProveedoresPagos.aspx.vb | 15 ++- 5 files changed, 270 insertions(+), 103 deletions(-) diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 68de58744..08575e3ae 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -594,7 +594,7 @@ Public Class ClsMovimientos Public Function GetCxPEmpresa(CveProveedor As Integer, FechaVencimientoInicio As String, FechaVencimientoFin As String, CveSubProyecto As Integer, DiasVencidos As Integer, CveUsuarioRegistro As Integer, CveUsuarioProgramo As Integer, CveUsuarioResponsable As Integer, CveClasificacion As Integer, CveMoneda As Integer, CveTipoPagoProgramo As Integer, CveEstatusFactura As Integer, CveAplicaNC As Integer, CveEmpresa As Integer, Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional CodigoProgramacion As String = "-1", Optional CveTipoProveedor As Integer = 0, - Optional AgrupadoPorSubProyecto As Boolean = False) As Boolean + Optional AgrupadoPorSubProyecto As Boolean = False, Optional VerEnPesos As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Banc_Proveedores") With SqlAdapter.SelectCommand.Parameters @@ -616,7 +616,8 @@ Public Class ClsMovimientos .Add("@FechaVF", SqlDbType.VarChar).Value = FechaVF .Add("@CodigoProgramacion", SqlDbType.VarChar).Value = CodigoProgramacion .Add("@CveTipoProveedor", SqlDbType.TinyInt).Value = CveTipoProveedor - .Add("@AgrupadoPorSubProyecto", SqlDbType.Bit).Value = AgrupadoPorSubProyecto + .Add("@AgrupadoPorSubProyecto", SqlDbType.Bit).Value = AgrupadoPorSubProyecto + .Add("@VerEnPesos", SqlDbType.Bit).Value = VerEnPesos End With Try diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx index 873bea6e1..c2daed3a9 100644 --- a/Bancos/ProveedoresAbonar.aspx +++ b/Bancos/ProveedoresAbonar.aspx @@ -341,9 +341,10 @@ - - - + + + + @@ -477,6 +478,15 @@ <%-- 14 --%> + + Moneda + +   + + + + + <%-- 15 --%> Auxiliar @@ -601,7 +611,6 @@ var Facturas = ''; function FnSuma(t, txt, importe) { - debugger; var chkPesosBancos = $get("ChkPagarPesos"); var chkDolaresBancos = $get("ChkPagarDolares"); @@ -612,9 +621,9 @@ } if (chkPesosBancos && chkPesosBancos.checked) { - CambiaPesosDolares() + CambiaPesosDolares(); } else if (chkDolaresBancos && chkDolaresBancos.checked) { - CambiaDolaresPesos() + CambiaDolaresPesos(); } else { var Suma = SumaValores(); @@ -622,7 +631,7 @@ } } - function SumaValores(aplicaTC) { + function SumaValores(aplicaTC, cveMonedaPago = 0) { var Importe = 0; var Comision = 0.00; @@ -637,11 +646,43 @@ idd = textBoxes[i].id.replace('C_GvCxP_TxtAbonar_', ''); Facturas = Facturas + (Importe == 0 ? '' : ', ') + $get("C_GvCxP_HplF_" + idd).innerText; let importeFactura = 0; - if (aplicaTC && $get('TxtTC') != null) { - importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) * parseFloat($get('TxtTC').value), 2).split(',').join('')); - } else { - importeFactura = parseFloat(textBoxes[i].value.split(',').join('')); + + if (cveMonedaPago == 0) { + if (aplicaTC && $get('TxtTC') != null) { + importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) * parseFloat($get('TxtTC').value), 2).split(',').join('')); + } else { + importeFactura = parseFloat(textBoxes[i].value.split(',').join('')); + } + } else { + let cveMonedaCompra = textBoxes[i].getAttribute("cvemoneda"); + + switch (cveMonedaPago) { + case 1: //PAGO CON PESOS + + //SI SON DOLARES MULTIPLICAR POR TC + if (cveMonedaCompra == '2') { + importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) * parseFloat($get('TxtTC').value), 2).split(',').join('')); + //MISMA MONEDA DEBE SOLO SUMAR + } else if (cveMonedaCompra == '1') { + importeFactura = parseFloat(textBoxes[i].value.split(',').join('')); + } + + break; + case 2: //PAGO CON DOLARES + + //MISMA MONEDA DEBE SOLO SUMAR + if (cveMonedaCompra == '2') { + importeFactura = parseFloat(textBoxes[i].value.split(',').join('')); + //SI SON PESOS DIVIDIR ENTRE EL TC + } else if (cveMonedaCompra == '1') { + importeFactura = parseFloat(FormatoNumero(parseFloat(textBoxes[i].value.split(',').join('')) / parseFloat($get('TxtTC').value), 2).split(',').join('')); + } + break; + } + + } + Importe = parseFloat(Importe) + importeFactura; } } @@ -699,53 +740,91 @@ } if (chkPesosBancos && chkPesosBancos.checked) { - CambiaPesosDolares() + CambiaPesosDolares(); } else if (chkDolaresBancos && chkDolaresBancos.checked) { - CambiaDolaresPesos() + CambiaDolaresPesos(); } - - } function CambiaPesosDolares() { - let ImporteDolares = SumaValores(true); + if ('<%= Me.FiltrarCuentas.ToString() %>' == '1') { + let ImporteDolares = SumaValores(true); - $get('TxtImporte').value = FormatoNumero(ImporteDolares, 2); - $('#LtlTotalMXN').text(FormatoNumero(ImporteDolares, 2)) + $get('TxtImporte').value = FormatoNumero(ImporteDolares, 2); + $('#LtlTotalMXN').text(FormatoNumero(ImporteDolares, 2)) - if ($("#LbImporteME").length) { - $get('LbImporteME').innerHTML = '$ ' + FormatoNumero(SumaValores(false), 2) + ' USD'; - $get('TxtImporte').value = FormatoNumero(ToDouble(ImporteDolares), 2); - $get('LtlTotalMXN').value = FormatoNumero(ToDouble(ImporteDolares), 2); + if ($("#LbImporteME").length) { + $get('LbImporteME').innerHTML = '$ ' + FormatoNumero(SumaValores(false), 2) + ' USD'; + $get('TxtImporte').value = FormatoNumero(ToDouble(ImporteDolares), 2); + $get('LtlTotalMXN').value = FormatoNumero(ToDouble(ImporteDolares), 2); + } + + if ($get('TxtTotal') != null) { + $get('TxtTotal').value = FormatoNumero(parseFloat($get('TxtImporte').value.replace(',', '')) + parseFloat($get('TxtOtrosImportes').value.replace(',', '') * -1), 2); + } + + if ($get('LblImporteTotal')) $get('LblImporteTotal').innerHTML = FormatoNumero(SumaValores(), 2); + if ($get('LblIVA')) $get('LblIVA').innerHTML = FormatoNumero(SumaValores() - ((SumaValores() / 1.16)), 2); + if ($get('ChkAbonoCuenta')) $get('ChkAbonoCuenta').checked = (parseFloat($get('TxtImporte').value.replace(/,/g, '')) > 2000); + } else { + SumaDolaresPesos(1); } - if ($get('TxtTotal') != null) { - $get('TxtTotal').value = FormatoNumero(parseFloat($get('TxtImporte').value.replace(',', '')) + parseFloat($get('TxtOtrosImportes').value.replace(',', '') * -1), 2); - } - - if ($get('LblImporteTotal')) $get('LblImporteTotal').innerHTML = FormatoNumero(SumaValores(), 2); - if ($get('LblIVA')) $get('LblIVA').innerHTML = FormatoNumero(SumaValores() - ((SumaValores() / 1.16)), 2); - if ($get('ChkAbonoCuenta')) $get('ChkAbonoCuenta').checked = (parseFloat($get('TxtImporte').value.replace(/,/g, '')) > 2000); } function CambiaDolaresPesos() { - debugger; - $get('TxtImporte').value = FormatoNumero(SumaValores(), 2); - $('#LtlTotalMXN').text(FormatoNumero(SumaValores(), 2)) + if ('<%= Me.FiltrarCuentas.ToString() %>' == '1') { + $get('TxtImporte').value = FormatoNumero(SumaValores(), 2); + $('#LtlTotalMXN').text(FormatoNumero(SumaValores(), 2)) + + + if ($("#LbImporteMN").length) { + $get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaValores(), 2) + ' MXN'; + $get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value.replace(',', '')) / ToDouble($get('TxtTC').value), 2); + $get('LtlTotalMXN').value = FormatoNumero(ToDouble($get('TxtImporte').value) / ToDouble($get('TxtTC').value), 2); + } + + if ($get('TxtTotal') != null) { + $get('TxtTotal').value = FormatoNumero(ToDouble($get('TxtImporte').value.replace(',', '')) + (ToDouble($get('TxtOtrosImportes').value.replace(',', '') * -1)), 2); + } + + if ($get('LblImporteTotal')) $get('LblImporteTotal').innerHTML = FormatoNumero(SumaValores(), 2); + if ($get('LblIVA')) $get('LblIVA').innerHTML = FormatoNumero(SumaValores() - ((SumaValores() / 1.16)), 2); + if ($get('ChkAbonoCuenta')) $get('ChkAbonoCuenta').checked = (parseFloat($get('TxtImporte').value.replace(/,/g, '')) > 2000); + } else { + SumaDolaresPesos(2); + } + } + + function SumaDolaresPesos(cveMonedaPago) { + + let ImporteSuma = parseFloat(SumaValores(false, cveMonedaPago)); + + $get('TxtImporte').value = FormatoNumero(ImporteSuma, 2); + $('#LtlTotalMXN').text(FormatoNumero(ImporteSuma, 2)) - debugger; if ($("#LbImporteMN").length) { - $get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaValores(), 2) + ' MXN'; - $get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value.replace(',', '')) / ToDouble($get('TxtTC').value), 2); - $get('LtlTotalMXN').value = FormatoNumero(ToDouble($get('TxtImporte').value) / ToDouble($get('TxtTC').value), 2); + + $get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value.replace(',', '')), 2); + $get('LtlTotalMXN').value = FormatoNumero(ToDouble($get('TxtImporte').value), 2); + + switch (cveMonedaPago) { + case 1: + $get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(ImporteSuma, 2) + ' MXN'; + break; + case 2: + $get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(ImporteSuma, 2) + ' USD'; + break; + } + } if ($get('TxtTotal') != null) { $get('TxtTotal').value = FormatoNumero(ToDouble($get('TxtImporte').value.replace(',', '')) + (ToDouble($get('TxtOtrosImportes').value.replace(',', '') * -1)), 2); } - if ($get('LblImporteTotal')) $get('LblImporteTotal').innerHTML = FormatoNumero(SumaValores(), 2); - if ($get('LblIVA')) $get('LblIVA').innerHTML = FormatoNumero(SumaValores() - ((SumaValores() / 1.16)), 2); + if ($get('LblImporteTotal')) $get('LblImporteTotal').innerHTML = FormatoNumero(ImporteSuma, 2); + if ($get('LblIVA')) $get('LblIVA').innerHTML = FormatoNumero(ImporteSuma - ((ImporteSuma / 1.16)), 2); if ($get('ChkAbonoCuenta')) $get('ChkAbonoCuenta').checked = (parseFloat($get('TxtImporte').value.replace(/,/g, '')) > 2000); } @@ -790,7 +869,7 @@ } - function DescuenoMasivo(txt) { + function DescuenoMasivo(txt) { $(".selDescuento").val(txt.value); $(".selDescuento").trigger("keyup"); } diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index af50a3933..b0a843edf 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -99,6 +99,14 @@ Partial Class Bancos_ProveedoresAbonar End Set End Property + Public Property FiltrarCuentas As Integer + Get + Return If(IsNothing(ViewState("FiltrarCuentas")), 1, ViewState("FiltrarCuentas").ToString.ToEntero) + End Get + Set(value As Integer) + ViewState("FiltrarCuentas") = value + End Set + End Property Private Property CveMonedaFiltro As Integer Get Return ViewState("CveMonedaFiltro").ToString.ToEntero @@ -247,6 +255,7 @@ Partial Class Bancos_ProveedoresAbonar CveClasificacionProveedor = IfNull(Request("CveClasificacion"), "-1").ToString.ToEntero CveMoneda = IfNull(Request("CveMoneda"), "-1").ToString.ToEntero CveMonedaFiltro = IfNull(Request("CveMoneda"), "-1").ToString.ToEntero + FiltrarCuentas = IfNull(Request("FiltrarCuentas"), "1").ToString.ToEntero CveEstatus = IfNull(Request("CveEstatus"), "-1").ToString.ToEntero Serie = IfNull(Request("Serie"), "").ToString CveAplicaNC = IfNull(Request("CveAplicaNC"), "-1").ToString.ToEntero @@ -254,7 +263,6 @@ Partial Class Bancos_ProveedoresAbonar CodigoProgramacion = IfNull(Request("CodigoProgramacion"), "-1").ToString CveSubProyectoFiltro = IfNull(Request("CveSubProyecto"), -1).ToString.ToEntero - TxtOtrosImportes.Attributes.Add("onKeyUp", String.Format("FnSuma(this,{0},{1});", "TxtTotal", 0)) 'proceso para que solo pague lo que este programada @@ -300,13 +308,25 @@ Partial Class Bancos_ProveedoresAbonar LbTipoMoneda.Text = String.Format("Pago en {0}", GlobalDTMonedas.FiltraParametros(String.Format("CveMoneda = {0}", CveMoneda)).Rows(0)("Moneda")) End If - If CveMoneda = 2 Then - ChkPagarPesos.Visible = True - TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4) - TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);") + 'SI NO ES GDIAZ, NO PERMITIR LA MEZCLA DE CUENTAS + If UsuarioActual.Empresa.Funcionalidad(382) <> "1" AndAlso FiltrarCuentas = 0 Then + FiltrarCuentas = 1 + End If + + If FiltrarCuentas = 0 Then + ChkPagarPesos.Visible = False + ChkPagarDolares.Visible = False + + CveMonedaFiltro = -1 Else - ChkPagarDolares.Visible = True - TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4) + If CveMoneda = 2 Then + ChkPagarPesos.Visible = True + TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4) + TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);") + Else + ChkPagarDolares.Visible = True + TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4) + End If End If RegistraScript($"TipoCambioActual = {GlobalTipoCambio(NowADS()).FormatoNumero(4)}") @@ -324,7 +344,7 @@ Partial Class Bancos_ProveedoresAbonar If UsuarioActual.TienePermisoProceso(361) Then 'GvCxP.Columns(11).Visible = True chkaplicaDescuento.Visible = True - 'chkaplicaDescuentoMasivo.Visible = True + chkaplicaDescuentoMasivo.Visible = True End If @@ -367,23 +387,27 @@ Partial Class Bancos_ProveedoresAbonar Private Sub CargaDatos(Optional tCveMoneda As Integer = -1) 'pCveProveedor As Integer, tCveMoneda As Integer, FechaVencimientoInicio As String, FechaVencimientoFin As String, CveUsuarioRegistro As Integer, CveUsuarioPrograma As Integer, Serie As String) If tCveMoneda = -1 Then tCveMoneda = CveMoneda - Dim Mov As New ClsMovimientos + If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso FiltrarCuentas = 0 Then + tCveMoneda = -1 + End If + TxtObservaciones.Text = "" TxtImporte.Text = "" TxtTotal.Text = "" - If Mov.GetCxPProveedor(CveProveedor, FechaI, FechaF, CveUsuarioProgramo, CveUsuarioRegistro, CveUsuarioResponsable, CveClasificacionProveedor, tCveMoneda, CveEstatus, CveProveedorSucursal, CveAplicaNC, "-1", "-1", CodigoProgramacion, CveSubProyecto:=CveSubProyectoFiltro) Then - DtDatos = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio") + Dim ObjMov As New ClsMovimientos + If ObjMov.GetCxPProveedor(CveProveedor, FechaI, FechaF, CveUsuarioProgramo, CveUsuarioRegistro, CveUsuarioResponsable, CveClasificacionProveedor, tCveMoneda, CveEstatus, CveProveedorSucursal, CveAplicaNC, "-1", "-1", CodigoProgramacion, CveSubProyecto:=CveSubProyectoFiltro) Then + DtDatos = ObjMov.DtResultados.FiltraParametros("CveCompra > 0 AND Saldo > 0", "Fecha,SerieFolio") GvCxP.DataSource = DtDatos DtDatos.Columns.Add("Movimiento") If DtDatos.Rows.Count > 0 Then DVBusqueda.Visible = True DtDatos.Rows(0)("Movimiento") = "FACTURA DE ACREEDOR" End If - End If + ObjMov.Dispose() + - Mov.Dispose() GvCxP.DataBind() UPCompras.Update() UpBusqueda.Update() @@ -473,6 +497,8 @@ Partial Class Bancos_ProveedoresAbonar e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("Folio") End If + e.Row.FCTextBox("TxtAbonar").Attributes.Add("CveMoneda", e.Row.DBCampo("CveMoneda")) + If e.Row.DBCampo("CveCompra").ToEntero > 0 Then Dim FiltroInv As String = "" @@ -643,6 +669,10 @@ Partial Class Bancos_ProveedoresAbonar Dim ValidaSAT As Boolean = True If UsuarioActual.Empresa.Funcionalidad(529) = "1" OrElse ChkNoValidaSAT.Checked Then ValidaSAT = False + If Not EsProduccion Then + ValidaSAT = False + End If + If ValidaSAT Then Dim Validada As Boolean = False Dim MsgValidadas As New StringBuilder @@ -1117,18 +1147,22 @@ Partial Class Bancos_ProveedoresAbonar DdlCuenta.Items.Clear() Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) - If ChkPagarPesos.Checked Then - dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1)) - RegistraScript("CambiaPesosDolares();") - ElseIf ChkPagarDolares.Checked Then - dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 2)) - RegistraScript("CambiaDolaresPesos();") - Else - If CveMonedaFiltro > 0 Then - dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", CveMonedaFiltro)) + If FiltrarCuentas = 1 Then + If ChkPagarPesos.Checked Then + dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1)) + RegistraScript("CambiaPesosDolares();") + ElseIf ChkPagarDolares.Checked Then + dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 2)) + RegistraScript("CambiaDolaresPesos();") + Else + If CveMonedaFiltro > 0 Then + dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", CveMonedaFiltro)) + End If End If End If + + If TipoPago = 3 Then dt = dt.FiltraParametros("CveTipoCuenta = 7") End If @@ -1148,8 +1182,32 @@ Partial Class Bancos_ProveedoresAbonar End Sub Protected Sub DdlCuenta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuenta.SelectedIndexChanged - 'recargo la moneda con la que se va a pagar Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta = {0}", DdlCuenta.SelectedValue)) + + If FiltrarCuentas = 0 Then + + If dr("CveMoneda").ToString() = "2" Then + ChkPagarDolares.Visible = True + ChkPagarDolares.Checked = True + ChkPagarDolares.Enabled = False + + ChkPagarPesos.Visible = False + ChkPagarPesos.Checked = False + Else + ChkPagarPesos.Visible = True + ChkPagarPesos.Checked = True + ChkPagarPesos.Enabled = False + + ChkPagarDolares.Visible = False + ChkPagarDolares.Checked = False + End If + + TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4) + TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);") + End If + + 'recargo la moneda con la que se va a pagar + If dr IsNot Nothing Then TxtFechaDocumento.Attributes.Remove("onchange") UpDatos.Update() @@ -1673,11 +1731,17 @@ Partial Class Bancos_ProveedoresAbonar Protected Sub chkaplicaDescuento_CheckedChanged(sender As Object, e As EventArgs) GvCxP.Columns(11).Visible = chkaplicaDescuento.Checked - TxtDescuenoMasivo.Visible = chkaplicaDescuento.Checked UPCompras.Update() End Sub + Protected Sub chkaplicaDescuentoMasivo_CheckedChanged(sender As Object, e As EventArgs) + + GvCxP.Columns(11).Visible = chkaplicaDescuentoMasivo.Checked + TxtDescuenoMasivo.Visible = chkaplicaDescuentoMasivo.Checked + UPCompras.Update() + End Sub + Private Sub tmpValida() Dim ValidaSAT As Boolean = True diff --git a/Bancos/RepProveedoresPagos.aspx b/Bancos/RepProveedoresPagos.aspx index 7b1be4aa2..3708e6830 100644 --- a/Bancos/RepProveedoresPagos.aspx +++ b/Bancos/RepProveedoresPagos.aspx @@ -4,9 +4,9 @@ @@ -42,7 +42,7 @@
Proveedor:
- + <%-- --%> @@ -194,21 +194,28 @@
+
+
+ Ver en pesos: +   +
+
- +
-
+

- + + $

TOTAL ORIGINAL @@ -218,21 +225,24 @@
-
- MXN: +
+ MXN: +
-
- Dólares: +
+ Dólares: +
-
+
-

- +

+ + $

ABONADO @@ -258,11 +268,12 @@
-
+
-

- +

+ + $

SALDO PENDIENTE @@ -272,11 +283,13 @@
-
- MXN: +
+ MXN: +
-
- DÓLARES +
+ DÓLARES +
@@ -303,7 +316,7 @@ - + @@ -312,17 +325,17 @@ - + Venci. - - + + - - + + Original @@ -330,9 +343,9 @@ - + - + Abonado @@ -349,7 +362,7 @@ - + @@ -358,7 +371,7 @@ - + @@ -367,7 +380,7 @@ - + @@ -376,20 +389,19 @@ - + Abonar <%----%> - + - + <%----%> - diff --git a/Bancos/RepProveedoresPagos.aspx.vb b/Bancos/RepProveedoresPagos.aspx.vb index 335c19e47..f6b4d7def 100644 --- a/Bancos/RepProveedoresPagos.aspx.vb +++ b/Bancos/RepProveedoresPagos.aspx.vb @@ -31,6 +31,11 @@ Partial Class Bancos_RepProveedoresPagos GvCxP.Columns(10).Visible = True End If + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + chkexpand.Checked = True + DivVerPesos.Visible = True + End If + End If End Sub @@ -103,7 +108,7 @@ Partial Class Bancos_RepProveedoresPagos GvCxP.Columns(7).Visible = ChkProgramadas.Checked 'AndAlso DdlUsuarioProgramo.SelectedValue.ToEntero > 0 - If Mov.GetCxPEmpresa(DdlProveedores.SelectedValue.ToEntero, FechaI, FechaF, DdlSubProyecto.SelectedValue.ToEntero, -1, DdlUsuarioRegistro.SelectedValue.ToEntero, CveUsuarioProgramo, DdlUsuarioResponsable.SelectedValue.ToEntero, DdlProveedoresClasificaciones.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero, -1, DdlEstatusCompra.SelectedValue.ToEntero, AplicaNC.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, FechaVI, FechaVF, CodigoProgramacion, DdlTipoProveedor.SelectedValue.ToEntero) Then + If Mov.GetCxPEmpresa(DdlProveedores.SelectedValue.ToEntero, FechaI, FechaF, DdlSubProyecto.SelectedValue.ToEntero, -1, DdlUsuarioRegistro.SelectedValue.ToEntero, CveUsuarioProgramo, DdlUsuarioResponsable.SelectedValue.ToEntero, DdlProveedoresClasificaciones.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero, -1, DdlEstatusCompra.SelectedValue.ToEntero, AplicaNC.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, FechaVI, FechaVF, CodigoProgramacion, DdlTipoProveedor.SelectedValue.ToEntero, VerEnPesos:=ChkVerEnPesos.Checked) Then GvCxP.DataSource = Mov.DtResultados If Mov.DtResultados IsNot Nothing AndAlso Mov.DtResultados.Rows.Count > 0 Then @@ -162,7 +167,13 @@ Partial Class Bancos_RepProveedoresPagos CveUsuarioProgramo = DdlUsuarioProgramo.SelectedValue.ToEntero End If - e.Row.FCHyperLink("ImgAbonar").NavigateUrl = String.Format("/Bancos/ProveedoresAbonar.aspx?CveProveedor={0}&FechaI={1}&FechaF={2}&CveUsuarioProgramo={3}&TipoPago={4}&CveUsuarioRegistro={5}&CveUsuarioResponsable={6}&CveClasificacion={7}&CveMoneda={8}&CveEstatus={9}&CveProveedorSucursal={10}&CveAplicaNC={11}&CodigoProgramacion={12}&CveSubProyecto={13}", e.Row.DBCampo("CveProveedor"), If(txtFechaI.Text <> "", txtFechaI.Text, "-1"), If(txtFechaF.Text <> "", txtFechaF.Text, "-1"), CveUsuarioProgramo, -1, DdlUsuarioRegistro.SelectedValue, DdlUsuarioResponsable.SelectedValue, DdlProveedoresClasificaciones.SelectedValue, e.Row.DBCampo("CveMoneda"), DdlEstatusCompra.SelectedValue, e.Row.DBCampo("CveProveedorSucursal"), AplicaNC.SelectedValue, DdlCodigoProgramacion.SelectedValue, DdlSubProyecto.SelectedValue) + Dim FiltrarCuentas As Integer = 1 + + If ChkVerEnPesos.Checked Then + FiltrarCuentas = 0 + End If + + e.Row.FCHyperLink("ImgAbonar").NavigateUrl = String.Format("/Bancos/ProveedoresAbonar.aspx?CveProveedor={0}&FechaI={1}&FechaF={2}&CveUsuarioProgramo={3}&TipoPago={4}&CveUsuarioRegistro={5}&CveUsuarioResponsable={6}&CveClasificacion={7}&CveMoneda={8}&CveEstatus={9}&CveProveedorSucursal={10}&CveAplicaNC={11}&CodigoProgramacion={12}&CveSubProyecto={13}&FiltrarCuentas={14}", e.Row.DBCampo("CveProveedor"), If(txtFechaI.Text <> "", txtFechaI.Text, "-1"), If(txtFechaF.Text <> "", txtFechaF.Text, "-1"), CveUsuarioProgramo, -1, DdlUsuarioRegistro.SelectedValue, DdlUsuarioResponsable.SelectedValue, DdlProveedoresClasificaciones.SelectedValue, e.Row.DBCampo("CveMoneda"), DdlEstatusCompra.SelectedValue, e.Row.DBCampo("CveProveedorSucursal"), AplicaNC.SelectedValue, DdlCodigoProgramacion.SelectedValue, DdlSubProyecto.SelectedValue, FiltrarCuentas) End If End Sub From 5c2b6105797b5fb13cbe7331c1526ca034c97a16 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 15 Jan 2025 21:13:20 -0700 Subject: [PATCH 3/4] --FIX datos de cliente --- Ventas/PV.aspx.vb | 2 +- Ventas/Ventas.aspx.vb | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index a1fd84ddd..c2834f001 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -6624,7 +6624,7 @@ Partial Class PV If ObjCliente.AgregarClienteNoFrecuente(TxtNombreCliente.Text.Trim, TxtDireccionCliente.Text.Trim, TxtNumExtCliente.Text.Trim, TxtNumIntCliente.Text.Trim, TxtColoniaCliente.Text.Trim, TxtLocalidadCliente.Text.Trim, TxtCiudadCliente.Text.Trim, DdlEstadoSAT.SelectedValue.ToEntero, TxtRFCCliente.Text.Trim, TxtCPCliente.Text.Trim, TxtTelefonoCliente.Text.Trim, TxtCorreoCliente.Text.Trim, - DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, CvePrecioLista:=CvePrecioLista, + DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", DdlMetodoCliente.SelectedValue.ToEntero(), DdlFormaCliente.SelectedValue.ToEntero(), CvePrecioLista:=CvePrecioLista, RegimenSociedad:=TxtRegimenSociedad.Text, TipoPersona:=TipoPersona, CveRegimenFiscal:=CveRegimenFiscal, CveUsoCFDI:=CveUsoCFDI, Genero:=GeneroCliente) Then If ObjCliente.DtResultados.Rows.Count > 0 Then diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 73e45b42b..a12931001 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -12072,6 +12072,10 @@ Partial Class Ventas ObjFacturaBonificacion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal ObjFacturaBonificacion.Cliente.RegimenFiscal = ClienteRegimenFiscal + 'CLIENTE + ObjFacturaBonificacion.CveCliente = CveCliente + ObjFacturaBonificacion.SetCliente() + ObjFacturaBonificacion.CveMetodoPago = 1 ObjFacturaBonificacion.MetodoPago = "Pago en una sola exhibición" ObjFacturaBonificacion.ClaveMetodoPagoSAT = "PUE" @@ -12217,10 +12221,6 @@ Partial Class Ventas ObjFacturaBonificacion.DtFirmas = DTmpF - 'CLIENTE - ObjFacturaBonificacion.CveCliente = CveCliente - ObjFacturaBonificacion.SetCliente() - ''SUCURSAL 'ObjFacturaBonificacion.CveSucursal = DdlSucursal.SelectedValue.ToEntero() 'ObjFacturaBonificacion.SetSucursalMatriz(Me) @@ -40681,14 +40681,9 @@ Partial Class Ventas 'GvExist.Columns(0).ItemStyle.Width = New Unit(200, UnitType.Pixel) 'ORDENA HACIA LA DERECHA LAS CANTIDAD - OJO!! NO SE USO GV.COLUMNS.COUNT PORQUE LAS COLUMNAS GENERADAS EN BEHIND NO LAS RECONOCE - For index As Integer = 0 To DtExistencias.Columns.Count - 1 + For index As Integer = 1 To DtExistencias.Columns.Count - 1 For Each gvr As GridViewRow In GvExist.Rows - If index = 0 Then - gvr.Cells(index).Attributes.Add("colspan", "3") - Else - gvr.Cells(index).HorizontalAlign = HorizontalAlign.Right - End If - + gvr.Cells(index).HorizontalAlign = HorizontalAlign.Right Next Next End If @@ -40696,5 +40691,12 @@ Partial Class Ventas RegistraScript("$('#DivModalExistenciaTotal').modal('show');") UPExist.Update() End Sub + + Protected Sub GvExist_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvExist.RowDataBound + If e.Row.RowType = DataControlRowType.Header OrElse e.Row.RowType = DataControlRowType.DataRow Then + e.Row.Cells(0).Attributes.Add("colspan", "3") + End If + End Sub + End Class From 9e858f68339444e5eeab7cda1c132825235990b9 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 15 Jan 2025 21:15:49 -0700 Subject: [PATCH 4/4] -- Cambio de autorizaciones de anticipo por tabla. --PA_Vta_ClienteAnticiposNCIxC --PA_Vta_VentaAnticipoAutorizadoUpdate --PA_Vta_IxCAnticipoAutorizadoUpdate --- Ventas/CatAutorizacionLimites.aspx | 50 +--------- Ventas/CatAutorizacionLimites.aspx.vb | 138 +------------------------- Ventas/Clientes.aspx | 4 +- Ventas/Clientes.aspx.vb | 134 ++++++++++++------------- Ventas/PVCobranza.aspx.vb | 71 ++++++++----- 5 files changed, 122 insertions(+), 275 deletions(-) diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx index 43d8496b1..141f85fc6 100644 --- a/Ventas/CatAutorizacionLimites.aspx +++ b/Ventas/CatAutorizacionLimites.aspx @@ -123,7 +123,7 @@
- @@ -169,54 +169,6 @@
-
-
-
-
- Anticipos, notas de crédito e ingresos por comprobar -
-
-
-
-
- " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 3341f52e7..a216b96a8 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1946,9 +1946,9 @@ Partial Class Clientes End If ObjMovtos.Dispose() - If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) Then - GVAnticipos.Columns(7).Visible = True - End If + 'If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) Then + ' GVAnticipos.Columns(7).Visible = True + 'End If GVAnticipos.DataBind() GVAnticiposHistorial.DataBind() @@ -10753,82 +10753,82 @@ Partial Class Clientes End Function - Protected Sub LnkAutorizarAnticipo_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero() - Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero() + 'Protected Sub LnkAutorizarAnticipo_Click(sender As Object, e As EventArgs) + ' Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + ' Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero() + ' Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero() - If CveVenta > 0 OrElse CveIE > 0 Then - Dim Actualizo As Boolean = False + ' If CveVenta > 0 OrElse CveIE > 0 Then + ' Dim Actualizo As Boolean = False - Using ObjVentas As New ClsVentas - If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then - If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, True) Then - Alert("El anticipo se autorizó correctamente") - Actualizo = True - End If - ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then - If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, True) Then - Alert("El anticipo se autorizó correctamente") - Actualizo = True - End If - End If - End Using + ' Using ObjVentas As New ClsVentas + ' If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then + ' If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, True) Then + ' Alert("El anticipo se autorizó correctamente") + ' Actualizo = True + ' End If + ' ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then + ' If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, True) Then + ' Alert("El anticipo se autorizó correctamente") + ' Actualizo = True + ' End If + ' End If + ' End Using - If Actualizo Then - Dim ObjEventoBitacora As New ClsOIEventos - If ObjEventoBitacora.AddEventoBitacora($"El anticipo se autorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then - GvEB.DataSource = ObjEventoBitacora.DtResultados - End If - ObjEventoBitacora.Dispose() - GvEB.DataBind() + ' If Actualizo Then + ' Dim ObjEventoBitacora As New ClsOIEventos + ' If ObjEventoBitacora.AddEventoBitacora($"El anticipo se autorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then + ' GvEB.DataSource = ObjEventoBitacora.DtResultados + ' End If + ' ObjEventoBitacora.Dispose() + ' GvEB.DataBind() - UPEventoBitacora.Update() - CargaEventoBitacora() - End If + ' UPEventoBitacora.Update() + ' CargaEventoBitacora() + ' End If - End If + ' End If - CargaAnticipos() - End Sub + ' CargaAnticipos() + 'End Sub - Protected Sub LnkCancelarAnticipo_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero() - Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero() + 'Protected Sub LnkCancelarAnticipo_Click(sender As Object, e As EventArgs) + ' Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + ' Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero() + ' Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero() - If CveVenta > 0 OrElse CveIE > 0 Then - Dim Actualizo As Boolean = False - Using ObjVentas As New ClsVentas - If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then - If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then - Alert("El anticipo se desautorizó correctamente") - Actualizo = True - End If - ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then - If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then - Alert("El anticipo se desautorizó correctamente") - Actualizo = True - End If - End If - End Using - CargaAnticipos() + ' If CveVenta > 0 OrElse CveIE > 0 Then + ' Dim Actualizo As Boolean = False + ' Using ObjVentas As New ClsVentas + ' If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then + ' If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then + ' Alert("El anticipo se desautorizó correctamente") + ' Actualizo = True + ' End If + ' ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then + ' If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then + ' Alert("El anticipo se desautorizó correctamente") + ' Actualizo = True + ' End If + ' End If + ' End Using + ' CargaAnticipos() - If Actualizo Then - Dim ObjEventoBitacora As New ClsOIEventos - If ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then - GvEB.DataSource = ObjEventoBitacora.DtResultados - End If - ObjEventoBitacora.Dispose() - GvEB.DataBind() + ' If Actualizo Then + ' Dim ObjEventoBitacora As New ClsOIEventos + ' If ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then + ' GvEB.DataSource = ObjEventoBitacora.DtResultados + ' End If + ' ObjEventoBitacora.Dispose() + ' GvEB.DataBind() - UPEventoBitacora.Update() - CargaEventoBitacora() - End If + ' UPEventoBitacora.Update() + ' CargaEventoBitacora() + ' End If - End If - End Sub + ' End If + 'End Sub End Class diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 3d6b8452f..04ad5ce26 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -25,6 +25,18 @@ Partial Class Ventas_PVCobranza End Set End Property + Private Property CveVendedor As Integer + Get + If ViewState("CveVendedor") Is Nothing Then + ViewState("CveVendedor") = -1 + End If + Return ViewState("CveVendedor").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveVendedor") = value + End Set + End Property + Private Property CveVentaCancelacion As Integer Get If ViewState("CveVentaCancelacion") Is Nothing Then @@ -970,6 +982,8 @@ Partial Class Ventas_PVCobranza LtlTipoAnticipo.Text = "" HdnTipoAmortizacion.Value = "" CveCliente = -1 + CveVendedor = -1 + If TmpDTAnticiposNCIxCCliente IsNot Nothing Then TmpDTAnticiposNCIxCCliente.Clear() @@ -1959,17 +1973,16 @@ Partial Class Ventas_PVCobranza DdlTipoAmortizacionAnticipo_SelectedIndexChanged(DdlTipoAmortizacionAnticipo, EventArgs.Empty) End If - If CveCliente <= 0 Then - Dim DbRowVenta As DataRow = Nothing - Dim ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then - DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") - End If - ObjVentas.Dispose() + Dim DbRowVenta As DataRow = Nothing + Dim ObjVentas As New ClsVentas + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then + DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") + End If + ObjVentas.Dispose() - If DbRowVenta IsNot Nothing Then - CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() - End If + If DbRowVenta IsNot Nothing Then + CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() + CveVendedor = DbRowVenta("CveVendedor").ToString().ToEntero() End If If CveCliente > 0 Then @@ -2125,6 +2138,19 @@ Partial Class Ventas_PVCobranza End If End If + Dim CveVenta As Integer = gvr.DataKey("CveVenta").ToEntero() + Dim CveIE As Integer = gvr.DataKey("CveIE").ToEntero() + + Dim ObjVta As New ClsVentas + If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, gvr.DataKey("CveCliente").ToEntero(), CveVendedor, Importe, 0, UsuarioActual.CveUsuario, 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" + End If + Alert(msgAlert, TipoMensaje.MsgInformacion) + End If + ObjVta.Dispose() + UpAnticipos.Update() End Sub @@ -2291,20 +2317,19 @@ Partial Class Ventas_PVCobranza DivConceptoNC.Visible = False End If - If CveCliente <= 0 Then - Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero - Dim DbRowVenta As DataRow = Nothing - Dim ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then - DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") - End If - ObjVentas.Dispose() - - If DbRowVenta IsNot Nothing Then - CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() - End If - + Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero + Dim DbRowVenta As DataRow = Nothing + Dim ObjVentas As New ClsVentas + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") End If + ObjVentas.Dispose() + + If DbRowVenta IsNot Nothing Then + CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() + CveVendedor = DbRowVenta("CveVendedor").ToString().ToEntero() + End If + If CveCliente > 0 Then CargaAnticipos(CveCliente)