From 27a173ac1b2a46558a740c59b527b03bde791ff7 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 8 May 2025 18:01:27 -0700 Subject: [PATCH 1/6] --FIX ventas --- Ventas/RepVentas.aspx.vb | 3 -- Ventas/RepVentasDetalle.aspx.vb | 4 --- Ventas/Ventas.aspx.vb | 51 +++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/Ventas/RepVentas.aspx.vb b/Ventas/RepVentas.aspx.vb index f2495b84c..be58e771b 100644 --- a/Ventas/RepVentas.aspx.vb +++ b/Ventas/RepVentas.aspx.vb @@ -301,9 +301,6 @@ Partial Class Ventas_RepVentas Dim Vendedores As String = If(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM) Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero) - If TipoComprobante.Contiene("Rem") And Not Estatus.Contiene("11") Then - Estatus = Estatus & ",11" - End If If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then TCEspecifico = TxtEspecifico.Text.ToDecimal diff --git a/Ventas/RepVentasDetalle.aspx.vb b/Ventas/RepVentasDetalle.aspx.vb index 5229dd38f..ea1b0561f 100644 --- a/Ventas/RepVentasDetalle.aspx.vb +++ b/Ventas/RepVentasDetalle.aspx.vb @@ -459,10 +459,6 @@ Partial Class RepVentasDetalle FechaIEjec = If(IsDate(TxtFechaIEjec.Text.Trim()), TxtFechaIEjec.Text.Trim.ToDate, MinFecha) FechaFEjec = If(IsDate(TxtFechaFEjec.Text.Trim()), TxtFechaFEjec.Text.Trim.ToDate, MaxFecha) - If TipoComprobante.Contiene("Rem") And Not Estatus.Contiene("11") Then - Estatus = Estatus & ",11" - End If - Dim ModalidadContable As Boolean = CBool(If(Request("ModalidadContable") IsNot Nothing, Request("ModalidadContable").ToEntero(), 0)) ChkLecturaAdmin.Checked = Not ModalidadContable diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 4e80b42c6..87393a619 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10670,6 +10670,10 @@ Partial Class Ventas End If End If + If Not ValidaPSSoloCotizacion() Then + Exit Sub + End If + 'CREA UNA COPIA DE SEGURIDAD PARA LOS DATOS DEL TMPDT If TmpDTError Is Nothing OrElse TmpDTError.Rows.Count = 0 Then TmpDTError = TmpDT.Copy() @@ -19914,6 +19918,36 @@ Partial Class Ventas Protected Sub LbAgregar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LbAgregar.Click AgregarPS() End Sub + + Private Function ValidaPSSoloCotizacion() As Boolean + Dim Returno As Boolean = True + If UsuarioActual.Empresa.Funcionalidad(720) <> "" AndAlso DdlTipoComprobante.SelectedValue <> "Cot" Then + Dim ProductosSoloCotizacion As List(Of String) = UsuarioActual.Empresa.Funcionalidad(720).Split(","c).ToList() + + If ProductosSoloCotizacion IsNot Nothing AndAlso ProductosSoloCotizacion.Count > 0 Then + + For Each GvRow As GridViewRow In GvPS.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + Dim CvePS As String = GvRow.DataKey("CvePS") + If ProductosSoloCotizacion.Any(Function(CvePSCot) CvePSCot.Trim() = CvePS) Then + Dim PSCot As String = "" + Dim DrPSCot As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS.ToEntero()).Rows(0) + If DrPSCot IsNot Nothing Then + PSCot = DrPSCot("PSCodigo").ToString + End If + + Alert($"El producto y/o servicio '{PSCot}' está disponible únicamente para cotizaciones.", TipoMensaje.MsgAdvertencia) + Returno = False + Exit For + End If + End If + Next + End If + End If + + Return Returno + End Function + Private Function ValidaAgregarPS(Cantidad As Decimal, CvePS As Integer, CveUM As Integer, PU As Double, CveTipoPS As Integer, CveClasificacion As Integer, CveSubProyecto As Integer, ObjDescuento As Modelos.VentaDescuentos, Optional CantidadModal As Decimal = 0D, Optional PSValidarModal As String = "", Optional CantidadOriginal As Decimal = 0D, Optional EsEdicion As Boolean = False) As Boolean 'NO TOCAR - IPP 'VALIDA PARAMETROS @@ -19922,6 +19956,23 @@ Partial Class Ventas Return False End If + 'VALIDA PS DE COTIZACION + If UsuarioActual.Empresa.Funcionalidad(720) <> "" Then + Dim ProductosSoloCotizacion As List(Of String) = UsuarioActual.Empresa.Funcionalidad(720).Split(","c).ToList() + If ProductosSoloCotizacion IsNot Nothing AndAlso ProductosSoloCotizacion.Count > 0 Then + If DdlTipoComprobante.SelectedValue <> "Cot" AndAlso ProductosSoloCotizacion.Any(Function(CvePSCot) CvePSCot.Trim() = CvePS.ToString()) Then + Dim PSCot As String = "" + Dim DrPSCot As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0) + If DrPSCot IsNot Nothing Then + PSCot = DrPSCot("PSCodigo").ToString + End If + + Alert($"El producto y/o servicio '{PSCot}' está disponible únicamente para cotizaciones.", TipoMensaje.MsgAdvertencia) + Return False + End If + End If + End If + If PSValidarModal.Trim.Length > 0 Then HdnPS.Value = PSValidarModal End If From b5398e90301d6bd4796d95992133e214892ac008 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 9 May 2025 19:46:10 -0700 Subject: [PATCH 2/6] --FIX pago en dolares a facturas en dolares en cobranza --- Ventas/PVCobranza.aspx | 65 +++++++++++++++++++++++++-------------- Ventas/PVCobranza.aspx.vb | 30 +++++++++++++++--- 2 files changed, 68 insertions(+), 27 deletions(-) diff --git a/Ventas/PVCobranza.aspx b/Ventas/PVCobranza.aspx index 6e138db07..d45efe15e 100644 --- a/Ventas/PVCobranza.aspx +++ b/Ventas/PVCobranza.aspx @@ -368,7 +368,7 @@ + DataKeyNames="CveVenta,CveCliente,TipoDocto,Saldo,AtencionA,CveFormaPago33,SerieFolio,CondicionesPago,PlazoCobranza,CveMoneda,Moneda"> <%----%> @@ -481,36 +481,29 @@
-
-
-
- Nombre: -
+
+
Nombre:
         
- -
Folio:
-
  
- -
+
Folio:   
+
- -
-
- - - + +   + + +   + +
-
-
@@ -682,7 +675,7 @@
- +
$ @@ -692,7 +685,7 @@
- +
$ @@ -701,7 +694,7 @@
- +  
@@ -713,6 +706,25 @@
+
+
+
+ +
+ $ + + +
+
+
+ +
+ $ + + +
+
+
@@ -727,6 +739,7 @@ +
@@ -1239,7 +1252,7 @@ " style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
-
+
Total: @@ -1609,6 +1622,12 @@ } $get("TxtImporteContado").value = FormatoNumero(total, 2); + + //DOLARES + if ($get("HdnMoneda").value == "2") { + $get("TxtTotalMXN").value = FormatoNumero(ToDouble($get('TxtImporteContado').value) * ToDouble($get('TxtTC').value), 2); + } + } function CalculaDiferencia() { diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 881be80e9..ffd4f05de 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -517,6 +517,17 @@ Partial Class Ventas_PVCobranza LtlNombre.Text = GvRow.DataKey("AtencionA") LtlFolio.Text = GvRow.DataKey("SerieFolio") LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero + LtlMoneda.Text = GvRow.DataKey("Moneda") + + Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero() + + HdnMoneda.Value = CveMoneda.ToString() + If CveMoneda = 2 Then + DivUSD.Visible = True + TxtTC.Text = GlobalTipoCambio(Now).ToString() + TxtTotalMXN.Text = (TxtImporteContado.Text.ToDecimal() * TxtTC.Text.ToDecimal()).FormatoNumero() + End If + HdnVentaCondicionesPago.Value = GvRow.DataKey("CondicionesPago") HdnPlazoCobranza.Value = GvRow.DataKey("PlazoCobranza") @@ -1262,6 +1273,11 @@ Partial Class Ventas_PVCobranza LtlTipoAnticipo.Text = "" TxtFaltante.Text = "" ChkSobFaltante.Checked = False + LtlMoneda.Text = "" + TxtTC.Text = "" + TxtTotalMXN.Text = "" + DivUSD.Visible = False + HdnMoneda.Value = "1" 'HdnTipoAmortizacion.Value = "" CveCliente = -1 CveVendedor = -1 @@ -1318,7 +1334,7 @@ Partial Class Ventas_PVCobranza ObjFactura.CveMoneda = VentaRemision.CveMoneda If ObjFactura.CveMoneda = 2 Then - ObjFactura.TipoCambio = GlobalTipoCambio(Now).ToString().ToDecimal() + ObjFactura.TipoCambio = TxtTC.Text.ToDecimal() Else ObjFactura.TipoCambio = 1 End If @@ -1699,6 +1715,9 @@ Partial Class Ventas_PVCobranza Dim CveIEPago As Integer = 0 Dim ErrorConta As Boolean + Dim CveMonedaVenta As Integer = VentaActual.CveMoneda + Dim CveMonedaPago As Integer = CveMonedaVenta + If String.IsNullOrEmpty(Obs) Then Obs = $"Folio: {VentaActual.SerieFolio}" Else @@ -1750,7 +1769,7 @@ Partial Class Ventas_PVCobranza End If If String.IsNullOrEmpty(Retorno) Then - CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImporteIE, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto) + CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImporteIE, CveMonedaPago, If(CveMonedaVenta = 1, 1, TxtTC.Text.ToDecimal()), Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto, Modulo:="PVCob") If CveIEPago > 0 Then Dim tImportePago As Decimal = If(ImporteBancos > ImporteAbonoVenta, ImporteAbonoVenta, ImporteBancos) 'toma el importe menor para la factura @@ -1759,10 +1778,10 @@ Partial Class Ventas_PVCobranza Pago.ImportePagoVenta = tImportePago Pago.ImportePago = ImporteIE Pago.CveIE = CveIEPago - Pago.CveMonedaPago = VentaActual.CveMoneda + Pago.CveMonedaPago = CveMonedaPago ' EL PAGO SIEMRE DEBE SER EN PESOS Pago.Fecha = NowADS() Pago.Referencia = VentaActual.SerieFolio - If Pago.CveMonedaPago > 1 Then Pago.TCPago = GlobalTipoCambio(Now).ToDecimal + Pago.TCPago = If(CveMonedaVenta = 1, 1, TxtTC.Text.ToDecimal()) ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta) End If @@ -3092,6 +3111,9 @@ Partial Class Ventas_PVCobranza Next TxtCxCAplicado.Text = (SaldoCxC).FormatoNumero TxtImporteContado.Text = (LtlSaldo.Text.ToDecimal + SaldoCxC).FormatoNumero + If DivUSD.Visible Then + TxtTotalMXN.Text = (TxtImporteContado.Text.ToDecimal() * TxtTC.Text.ToDecimal()).FormatoNumero() + End If RegistraScript("$('#divCxC').hide();", "AE21") UPPCobranza.Update() UPPTotalesContado.Update() From cd3f24be0382d906ed1037e5d896fef7c1917525 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Sat, 10 May 2025 10:05:53 -0700 Subject: [PATCH 3/6] =?UTF-8?q?Compras=20Plantilla=20Prorrateo,=20Cat=20Se?= =?UTF-8?q?cciones=20=20=20Tipo=20Operaci=C3=B3n,=20EMD=20Ajustes=20format?= =?UTF-8?q?os=20almac=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Compras/Compras.aspx | 68 ++++++ Compras/Compras.aspx.vb | 318 +++++++++++++++++++------ Empresas/Grales/Formatos/Salida.rdlc | 2 +- Empresas/Grales/Formatos/Traslado.rdlc | 10 +- Sistemas/CatSesiones.aspx | 6 +- Sistemas/CatSesiones.aspx.vb | 9 +- 6 files changed, 328 insertions(+), 85 deletions(-) diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 889e34b70..bf2ccb6ec 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -5741,6 +5741,8 @@
+
+ + Cargar Plantilla + +
@@ -5830,6 +5837,10 @@ + + + +
+ <%--CARGA PRORRATEO PLANTILLA--%> + + + +
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 6d7a6cc18..28c2004c9 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -13,6 +13,8 @@ Imports MoreLinq Imports System.Data.SqlClient Imports ClsPaginas Imports Microsoft.Reporting.WebForms +Imports Microsoft.Owin.Security.Provider + Partial Class Compras_Compras Inherits ClsPaginas @@ -8028,102 +8030,111 @@ Partial Class Compras_Compras End If If Not ErrorPrepoliza AndAlso Not ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=OpValidacion, AutoConta:=AutoConta) Then + TieneError = True + If ObjConta.ValorPolizaDescuadre > 0 Then + Alert($"{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia}", TipoMensaje.MsgError) + ErrorPrepolizaDescuadre = True + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(574) = "1" AndAlso (ImporteRNC > 0 OrElse ImporteRNCProntoPago > 0) Then + + If ImporteRNC > 0 AndAlso Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", ImporteRNC, DdlMoneda.SelectedValue.ToEntero, TxtTC.Text.ToDecimal, + TxtSerie.Text, TxtFolio.Text) Then TieneError = True - If ObjConta.ValorPolizaDescuadre > 0 Then - Alert($"{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia}", TipoMensaje.MsgError) - ErrorPrepolizaDescuadre = True - End If End If - If UsuarioActual.Empresa.Funcionalidad(574) = "1" AndAlso (ImporteRNC > 0 OrElse ImporteRNCProntoPago > 0) Then - - If ImporteRNC > 0 AndAlso Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", ImporteRNC, DdlMoneda.SelectedValue.ToEntero, TxtTC.Text.ToDecimal, - TxtSerie.Text, TxtFolio.Text) Then - TieneError = True - End If - - If ImporteRNCProntoPago > 0 AndAlso Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", ImporteRNCProntoPago, DdlMoneda.SelectedValue.ToEntero, TxtTC.Text.ToDecimal, - TxtSerie.Text, TxtFolio.Text, PrefijoSerie:="PP") Then - TieneError = True - End If - + If ImporteRNCProntoPago > 0 AndAlso Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", ImporteRNCProntoPago, DdlMoneda.SelectedValue.ToEntero, TxtTC.Text.ToDecimal, + TxtSerie.Text, TxtFolio.Text, PrefijoSerie:="PP") Then + TieneError = True End If - If Not TieneError Then - ObjCompras.Commit() - If ObjContaAC IsNot Nothing Then ObjContaAC.Commit() + End If - Dim CveEvaluacionProveedor As Integer = -1 + If Not TieneError Then + ObjCompras.Commit() + If ObjContaAC IsNot Nothing Then ObjContaAC.Commit() - If Me.RequiereEvaluacion Then - Dim ObjPro As New ClsCompProveedores() - CveEvaluacionProveedor = ObjPro.AddEvaluacionProveedor(CveProveedor, CveCompra, NowADS(), "", Me.CveUsuarioEvaluador, "", "", UsuarioActual.CveEmpresa) - ObjPro.Dispose() - End If + Dim CveEvaluacionProveedor As Integer = -1 - 'ENVIO DE CORREO NOTIFICACION A VENDEDORES DE OC - MandaCorreoOCVendedores(CveCompra) - If Not ErrorMovInv Then - For Each intMovimientoAlmacen As Integer In ListaMovimientosAlmacen - MandaCorreoOCVendedoresRecepcionAlmacen(CveCompra, intMovimientoAlmacen) - Next - End If + If Me.RequiereEvaluacion Then + Dim ObjPro As New ClsCompProveedores() + CveEvaluacionProveedor = ObjPro.AddEvaluacionProveedor(CveProveedor, CveCompra, NowADS(), "", Me.CveUsuarioEvaluador, "", "", UsuarioActual.CveEmpresa) + ObjPro.Dispose() + End If - If CveEvaluacionProveedor > 0 Then - Msg.Append("

El proveedor tiene evaluaciones pendientes
") - Msg.Append("¿Desea realizar una evaluación al proveedor?") - Msg.AppendFormat($"
Evaluar Proveedor.") - End If + 'ENVIO DE CORREO NOTIFICACION A VENDEDORES DE OC + MandaCorreoOCVendedores(CveCompra) + If Not ErrorMovInv Then + For Each intMovimientoAlmacen As Integer In ListaMovimientosAlmacen + MandaCorreoOCVendedoresRecepcionAlmacen(CveCompra, intMovimientoAlmacen) + Next + End If - BtnGuardar.Enabled = False - UpFacturar.Update() - - Alert(Msg.ToString, TipoMensaje.MsgInformacion, MsgAccionAceptar) - Else - ObjCompras.RollBack() - If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() +<<<<<<< HEAD + Alert(Msg.ToString, TipoMensaje.MsgInformacion, MsgAccionAceptar) + Else + ObjCompras.RollBack() + If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() ' Alert("Ocurrio un error al guardar la compra. Por favor intente nuevamente.", TipoMensaje.MsgError) End If - End If +======= + If CveEvaluacionProveedor > 0 Then + Msg.Append("

El proveedor tiene evaluaciones pendientes
") + Msg.Append("¿Desea realizar una evaluación al proveedor?") + Msg.AppendFormat($"
Evaluar Proveedor.") + End If +>>>>>>> Compras Plantilla Prorrateo, Cat Secciones Tipo Operación, EMD Ajustes formatos almacén + BtnGuardar.Enabled = False + UpFacturar.Update() + Alert(Msg.ToString, TipoMensaje.MsgInformacion, MsgAccionAceptar) Else - ObjCompras.RollBack() - If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() - Alert("Ocurrio un error al guardar la compra. Por favor intente nuevamente..", TipoMensaje.MsgError) + ObjCompras.RollBack() + If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() + Alert("Ocurrio un error al guardar la compra. Por favor intente nuevamente.", TipoMensaje.MsgError) + End If + End If - Else - Alert("Debe seleccionar un Funcionario/Empleado o Caja Chica para Reembolsos. Por favor vuelva a intentar.", TipoMensaje.MsgError) ObjCompras.RollBack() If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() + Alert("Ocurrio un error al guardar la compra. Por favor intente nuevamente..", TipoMensaje.MsgError) End If + Else - Alert("Ocurrió un error al agregar el movimiento bancario.
Revise sus datos de pago y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia) + Alert("Debe seleccionar un Funcionario/Empleado o Caja Chica para Reembolsos. Por favor vuelva a intentar.", TipoMensaje.MsgError) ObjCompras.RollBack() + If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() End If + Else + Alert("Ocurrió un error al agregar el movimiento bancario.
Revise sus datos de pago y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia) + ObjCompras.RollBack() + End If + End If - Catch ex As Exception - ObjCompras.RollBack() - If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() - Alert("Ocurrió un error al registrar la compra. Cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgError) - GuardaLog($"Ocurrió un error al registrar la compra. Cualquier detalle comuníquese a Soporte Técnico : {ex}") - ViewState("CveCompra") = -1 - End Try - ObjAcar.Dispose() - ObjCompras.Dispose() - ObjConta.Dispose() - ObjIE.Dispose() - ObjInventario.Dispose() - ObjAF.Dispose() - ObjOC.Dispose() - ObjProveedores.Dispose() - ObjCGame.Dispose() - ObjProductosServicios.Dispose() + Catch ex As Exception + ObjCompras.RollBack() + If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() + Alert("Ocurrió un error al registrar la compra. Cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgError) + GuardaLog($"Ocurrió un error al registrar la compra. Cualquier detalle comuníquese a Soporte Técnico : {ex}") + ViewState("CveCompra") = -1 + End Try + ObjAcar.Dispose() + ObjCompras.Dispose() + ObjConta.Dispose() + ObjIE.Dispose() + ObjInventario.Dispose() + ObjAF.Dispose() + ObjOC.Dispose() + ObjProveedores.Dispose() + ObjCGame.Dispose() + ObjProductosServicios.Dispose() End If End Sub @@ -22946,7 +22957,7 @@ Partial Class Compras_Compras End Sub - Private Sub AgregarProrrateoGasolina(CveSubProyecto As Integer, SubProyecto As String, CvePS As Integer, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String) + Private Sub AgregarProrrateoGasolina(CveSubProyecto As Integer, SubProyecto As String, CvePS As Integer, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, Optional PrecioProrrateo As Decimal = 0) Dim SubTotalOriginal As Decimal = TxtSubTotal.Text.ToDecimal Dim IVAOriginal As Decimal = TxtIVA.Text.ToDecimal @@ -22956,6 +22967,10 @@ Partial Class Compras_Compras Dim totalParcialDeseado As Decimal = TxtPrecioProrrateoGasolina.Text.ToDecimal + If PrecioProrrateo > 0 Then + totalParcialDeseado = PrecioProrrateo + End If + Dim PorcentajeCalculado As Decimal = totalParcialDeseado / TotalOriginal Dim subtotalParcial As Decimal = SubTotalOriginal * PorcentajeCalculado @@ -23070,15 +23085,180 @@ Partial Class Compras_Compras End If + End Sub + Protected Sub LnkProrrateoPlantilla_Click(sender As Object, e As EventArgs) + + If DdlPSProrrateoGasolina.SelectedValue.ToEntero > 0 And TxtTotal.Text.ToDecimal > 0 Then + TxtExcelProrrateo.Text = "[]" + UpDropZoneProrrateoPlantilla.Update() + RegistraScript("$('#DVModalProrrateoPlantilla').modal('show');") + Else + + If Not DdlPSProrrateoGasolina.SelectedValue.ToEntero > 0 Then + Alert("Debe seleccionar un producto.", TipoMensaje.MsgAdvertencia) + End If + + If Not TxtTotal.Text.ToDecimal > 0 Then + Alert("El total de la compra debe de ser mayor a 0.", TipoMensaje.MsgAdvertencia) + End If + + End If End Sub + Protected Sub LnkDescargaPlatillaProrrateo_Click(sender As Object, e As EventArgs) + + + Dim RutaPlantilla As String = "" + + RutaPlantilla = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\PlantillaProrrateo.xlsx" + + If Not (RutaPlantilla = "") Then + Dim Archivo As New IO.FileInfo(RutaPlantilla) + If Archivo.Exists Then + Response.Clear() + Response.ClearHeaders() + Response.ClearContent() + Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name) + Response.AddHeader("Content-Length", Archivo.Length.ToString()) + Response.ContentType = "text/plain" + Response.Flush() + Response.TransmitFile(Archivo.FullName) + Response.End() + End If + End If + + End Sub + + Protected Sub BtnAddProrrateoPlantilla_Click(sender As Object, e As EventArgs) + + Dim ErrorPrceos As Boolean = False + + If TxtExcelProrrateo.getfiles().Archivos.Count > 0 Then + Dim file As Archivo = TxtExcelProrrateo.getfiles().Archivos(0) + Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.path + Try + If Not CargarPlantillaProrrateo(Directorio, file.filename) Then + ErrorPrceos = True + End If + Catch ex As Exception + OnError("Ocurrio un error al leer el archivo
" & ex.Message, ex) + End Try + + Else + Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError) + ErrorPrceos = True + End If + + If Not ErrorPrceos Then + If Not ErrorPrceos Then + RegistraScript("$('#DVModalProrrateoPlantilla').modal('hide');") + End If + End If + + End Sub + + Private Function CargarPlantillaProrrateo(directorio As String, filename As String) As Boolean + + Dim DT As New DataTable + Dim ErrorProceso As Boolean = False + + + Try + DT = ReadExcelFile(directorio + filename, True) + Catch ex As Exception + ErrorProceso = True + OnError("Ocurrio un error al leer el archivo
" & ex.Message, ex) + End Try + + If Not ErrorProceso Then + + Dim ContadorRow As Integer = 1 + Dim SBErrores As New StringBuilder + + For Each row As DataRow In DT.Rows + + If row("SubProyecto").ToString.Length > 0 Then + + Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $" SubProyecto = '{row("SubProyecto").ToString}' ").ToEntero + Dim Importe As Decimal = row("Importe").ToString.ToDecimal + + If Not CveSubProyecto > 0 Then + SBErrores.Append($"Fila: {ContadorRow} SubProyecto: {row("SubProyecto").ToString} no encontrado.
") + ErrorProceso = True + End If + + If Not Importe > 0 Then + SBErrores.Append($"Fila: {ContadorRow} Importe Invalido: { Importe } debe ser mayor a 0.
") + ErrorProceso = True + End If + + End If + + ContadorRow = ContadorRow + 1 + + Next + + If Not ErrorProceso Then + + DTProrrateoGasolina.Rows.Clear() + + Dim CvePs As Integer = DdlPSProrrateoGasolina.SelectedValue.ToEntero + + If Not CvePs > 0 Then + Alert("Debe seleccionar un producto", TipoMensaje.MsgAdvertencia) + ErrorProceso = True + End If + + Dim PsRow As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePs).FiltroPrimero("") + + If PsRow Is Nothing Then + Alert("No se encontro el producto", TipoMensaje.MsgAdvertencia) + ErrorProceso = True + End If + + If Not ErrorProceso Then + Dim CveUM As Integer = PsRow("CveUM").ToString.ToEntero + Dim UM As String = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("UnidadMedida", $" CveUnidadMedida = {CveUM} ") + + Dim CveClasificacion As Integer = PsRow("CveClasificacion").ToString.ToEntero + Dim Clasificacion As String = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $" CveClasificacion = {CveClasificacion} ") + + For Each row As DataRow In DT.Rows + Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $" SubProyecto = '{row("SubProyecto").ToString}' ").ToEntero + Dim Importe As Decimal = row("Importe").ToString.ToDecimal + AgregarProrrateoGasolina(CveSubProyecto, row("SubProyecto").ToString, CvePs, CveUM, UM, CveClasificacion, Clasificacion, PrecioProrrateo:=Importe) + Next + End If + + Else + Alert(SBErrores.ToString, TipoMensaje.MsgError) + End If + + End If + + + If Not ErrorProceso Then + TxtPrecioProrrateoGasolina.Text = "" + DdlSubProyectoProrrateoGasolina.SelectedValueExist(-1) + UpModalProrrateoGasolina.Update() + End If + + + Return If(ErrorProceso, False, True) + + End Function + #End Region + + + + End Class diff --git a/Empresas/Grales/Formatos/Salida.rdlc b/Empresas/Grales/Formatos/Salida.rdlc index eb306ae32..ec108c2e6 100644 --- a/Empresas/Grales/Formatos/Salida.rdlc +++ b/Empresas/Grales/Formatos/Salida.rdlc @@ -345,7 +345,7 @@ =Fields!Cantidad.Value diff --git a/Empresas/Grales/Formatos/Traslado.rdlc b/Empresas/Grales/Formatos/Traslado.rdlc index 2c51a13d9..8a36779f7 100644 --- a/Empresas/Grales/Formatos/Traslado.rdlc +++ b/Empresas/Grales/Formatos/Traslado.rdlc @@ -826,13 +826,13 @@ - 0.68252in + 0.62002in @@ -1045,7 +1045,7 @@ =Parameters!SubProyecto.Value @@ -1057,7 +1057,7 @@ 3.24566cm 0.00711cm 0.6cm - 14.27979cm + 16.54562cm 6 + + @@ -370,6 +417,39 @@ + + + <%-- 20 --%> + + + + +
+
+
+
+ +
+
+
+ + <%----%> +
+
+
+
+
+
+
+
+
+
+
+
+
+ @@ -436,30 +516,18 @@ - - - - - + + + + + + - + - - - - - - - + - - - - - - - @@ -496,7 +564,10 @@ - +
+ × + Vista ampliada +
@@ -516,4 +587,57 @@ } --%> + + <%----%> + + + + + diff --git a/AF/CatAF.aspx.vb b/AF/CatAF.aspx.vb index 6feb748f4..d50f844b9 100644 --- a/AF/CatAF.aspx.vb +++ b/AF/CatAF.aspx.vb @@ -53,6 +53,14 @@ Partial Class AF_CatAF CargaCombos() CargaCaracteristicas() + If UsuarioActual.CveEmpresa = 13 Then + ChkUltimaImagen.Checked = True + ChkMarcaActivoFijo.Checked = True + ChkModeloActivoFijo.Checked = True + ChkNoSerie.Checked = True + ChkObservaciones.Checked = True + End If + If (Request("GPO") IsNot Nothing AndAlso Request("GPO").ToEntero() > 0) Then CargaParametrosInicial() Else @@ -62,6 +70,7 @@ Partial Class AF_CatAF CargaPersonalizacion() + End If End Sub @@ -598,6 +607,8 @@ Partial Class AF_CatAF If ChkObservaciones.Checked Then ListPersonalizada.Add("Observaciones") + If ChkUltimaImagen.Checked Then ListPersonalizada.Add("UltimaImagen") + If objUsuario.AddUsuariosPersonalizaciones(UsuarioActual, "CatAF.aspx", String.Join("|", ListPersonalizada)) Then 'Alert("Personalizacion guardada") @@ -638,6 +649,15 @@ Partial Class AF_CatAF 'ChkSubProyecto.Checked = False ChkNombreCliente.Checked = False ChkObservaciones.Checked = False + ChkUltimaImagen.Checked = False + + If UsuarioActual.CveEmpresa = 13 Then + ChkUltimaImagen.Checked = True + ChkMarcaActivoFijo.Checked = True + ChkModeloActivoFijo.Checked = True + ChkNoSerie.Checked = True + ChkObservaciones.Checked = True + End If Dim Personalizaciones As String() = strBasePersonalizacion.Split("|"c) @@ -703,6 +723,9 @@ Partial Class AF_CatAF Case "Observaciones" ChkObservaciones.Checked = True Exit Select + Case "UltimaImagen" + ChkUltimaImagen.Checked = True + Exit Select Case Else Exit Select End Select @@ -762,6 +785,7 @@ Partial Class AF_CatAF 'GvDatos.Columns(18).Visible = ChkSubProyecto.Checked GvDatos.Columns(18).Visible = ChkNombreCliente.Checked GvDatos.Columns(19).Visible = ChkObservaciones.Checked + GvDatos.Columns(20).Visible = ChkUltimaImagen.Checked diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 145843325..135d41b25 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -1593,7 +1593,14 @@ Public Class ClsBancos ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) ' End If Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Banco IE Conciliar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + If ex.Message.Contains("Número: 2601;") Then + Alert("Ya existe un movimiento bancario con el mismo Folio: " & Folio & ".", TipoMensaje.MsgAdvertencia) + Me.OnError("Ocurrió un error al Guardar el Movimiento. Ya existe un movimiento bancario con el mismo Folio: " & Folio & ".", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Else + OnError("Ocurrió un error al guardar los cambios en el Banco IE Conciliar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End If + End Try Return Retorno diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index c6e5e4842..59ece46c1 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -3538,7 +3538,12 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("Almacen", Almacen)) params.Add(New ReportParameter("Fecha", Fecha)) params.Add(New ReportParameter("FacturaProveedor", FolioVenta)) - params.Add(New ReportParameter("FacturadoA", If(DtMovimientos(0)("Nombre").ToString <> "", DtMovimientos(0)("Nombre").ToString, NombreCliente))) + If NombreCliente = "" Then + params.Add(New ReportParameter("FacturadoA", Recibio)) + Else + params.Add(New ReportParameter("FacturadoA", If(DtMovimientos(0)("Nombre").ToString <> "", DtMovimientos(0)("Nombre").ToString, NombreCliente))) + End If + params.Add(New ReportParameter("Observaciones", Observaciones)) params.Add(New ReportParameter("FechaImpresion", NowADS().ToString("dd/MM/yyyy"))) params.Add(New ReportParameter("Folio", Folio)) diff --git a/Empresas/Grales/Formatos/Salida.rdlc b/Empresas/Grales/Formatos/Salida.rdlc index ec108c2e6..3428967bb 100644 --- a/Empresas/Grales/Formatos/Salida.rdlc +++ b/Empresas/Grales/Formatos/Salida.rdlc @@ -1104,7 +1104,7 @@ 0.79361cm 11.65255cm 0.6cm - 9.5262cm + 9.15694cm 4