From d3062c2f93bfb920eacc2eef02cff4c16b0beef3 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 18 Sep 2023 09:08:24 -0700 Subject: [PATCH] =?UTF-8?q?--=20option=20explicit=20--=20sino=20est=C3=A1?= =?UTF-8?q?=20surtida=20la=20remisi=C3=B3n,=20no=20se=20puede=20facturar.?= =?UTF-8?q?=20E119?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ventas/Ventas.aspx | 2 +- Ventas/Ventas.aspx.vb | 748 ++++++++++++++++++++---------------------- 2 files changed, 354 insertions(+), 396 deletions(-) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 8f0a0df7d..6b88ea977 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -5335,7 +5335,7 @@ - + diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 946d634ed..e3a3ec63e 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -4,16 +4,13 @@ Option Strict On Imports System.Data Imports System.Data.SqlClient Imports System.Diagnostics -Imports System.Globalization Imports System.IO Imports System.Net.Http Imports System.Security.Cryptography.X509Certificates -Imports System.Xml Imports ADSNetLibrary.SIGAPI.Models.CRM.Request Imports ADSNetLibrary.SIGAPI.Services.CRM Imports ADSTimbrado Imports Extensiones -Imports Microsoft.Owin.Security.Provider Imports Microsoft.Reporting.WebForms Imports Newtonsoft.Json.Linq @@ -3252,7 +3249,7 @@ Partial Class Ventas CargaMetodosPSModal() 'CARGA VALORES DE ORDEN DE PRODUCCION - Dim CveOrdenProduccion = IfNull(Request("CveOrdenProduccion"), "-1").ToString().ToEntero() + Dim CveOrdenProduccion As Integer = IfNull(Request("CveOrdenProduccion"), "-1").ToString().ToEntero() If CveOrdenProduccion > 0 And Not CveVenta > 0 Then DdlOrdenProduccion.SelectedValueExist(CveOrdenProduccion) If DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then @@ -4448,7 +4445,7 @@ Partial Class Ventas End Sub Private Sub CargaEstatusFactura(Optional TipoDocto As String = "Ing") - Dim FiltroCompromiso = If(TipoDocto = "Com", "And CveEstatusFactura In (2, 9)", "And CveEstatusFactura Not In (9)") + Dim FiltroCompromiso As String = If(TipoDocto = "Com", "And CveEstatusFactura In (2, 9)", "And CveEstatusFactura Not In (9)") If TipoDocto.ToUpper.Contiene("EGS", "COM", "ANT") Then TipoDocto = "Ing" @@ -7474,7 +7471,7 @@ Partial Class Ventas If CveClienteSuc > 0 Then If ObjCliente.GetSucursales(CveCliente, CveClienteSuc) Then If ObjCliente.DtResultados.Rows.Count > 0 Then - Dim Correo = ObjCliente.DtResultados.Rows(0)("Correo").ToString() + Dim Correo As String = ObjCliente.DtResultados.Rows(0)("Correo").ToString() If Correo.Trim.Length > 0 Then ViewState("Mail") = Correo End If @@ -7809,7 +7806,7 @@ Partial Class Ventas End Sub Public Sub CargaDdlNCPS() - Dim CveSATNC = "84111506" + Dim CveSATNC As String = "84111506" Dim dtt As New DataTable dtt = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1) ', SATClavePS:=CveSATNC @@ -8063,9 +8060,7 @@ Partial Class Ventas e.Row.FCLinkButton("imgE").Visible = False e.Row.FCLinkButton("imgD").Visible = False End If - End If - End If If UsuarioActual.Empresa.Funcionalidad(360) = "1" AndAlso e.Row.DBCampo("CvePrecioLista").ToEntero() > 0 Then @@ -8282,10 +8277,10 @@ Partial Class Ventas If Not CveContrato > 0 Then 'BANDERAS PARA VALIDACIONES - Dim EsValido = False - Dim EsValidoMayor = False - Dim CostoMenor = 0.0D - Dim CostoMayor = 0.0D + Dim EsValido As Boolean = False + Dim EsValidoMayor As Boolean = False + Dim CostoMenor As Decimal = 0 + Dim CostoMayor As Decimal = 0 'PRECIO MINIMO If UsuarioActual.Empresa.Funcionalidad(129).ToEntero() > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then @@ -8364,7 +8359,7 @@ Partial Class Ventas End If If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso ListaDescuentos IsNot Nothing AndAlso ObjDescuento IsNot Nothing Then - Dim ConsecEliminar = TmpDT.Rows(e.RowIndex)("Consec").ToString().ToEntero() + Dim ConsecEliminar As Integer = TmpDT.Rows(e.RowIndex)("Consec").ToString().ToEntero() If ConsecEliminar > 0 Then Dim descEliminar = ListaDescuentos.FirstOrDefault(Function(x) x.Consec = ConsecEliminar) If descEliminar IsNot Nothing Then @@ -8411,22 +8406,18 @@ Partial Class Ventas Else Dim DrPS As DataRow = Nothing - DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") If Not ClienteDesglosaIEPS Then PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) - TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0 - End If Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento)) Dim TotalCalculableImpuestosIVA As Decimal = 0 TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + TmpDT.Rows(e.RowIndex)("PorcentajeIEPS").ToString().ToDecimal) - Dim ClienteRetIVA = Me.ClienteRetIVA - + Dim ClienteRetIVA As Decimal = Me.ClienteRetIVA If ClienteRetIVA <= 0 Then If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then ClienteRetIVA = 0.106667D @@ -9089,65 +9080,65 @@ Partial Class Ventas 'SI TIENE LINEA ADICIONAL NO VERIFICAR LIMITE DE CREDITO 'SI NO TIENE AUTORIZACION VERIFICAR LIMITE DE CREDITO Y CANDADOS DE VENTA 'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada. - If DdlLineaAdicional.SelectedValue.ToEntero() <= 0 AndAlso Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then - 'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then + 'If DdlLineaAdicional.SelectedValue.ToEntero() <= 0 AndAlso Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then + ' 'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then - If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then - Dim ObjVentas As New ClsVentas + ' If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then + ' Dim ObjVentas As New ClsVentas - If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then + ' If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then + ' If ObjVentas.DtResultados.Rows.Count > 0 Then - If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then - If ObjVentas.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then - ObjVentas.Dispose() - Alert("Se está excediendo el límite de credito permitido de la Sucursal del Cliente.", TipoMensaje.MsgInformacion) - Exit Sub - End If - Else - If ObjVentas.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then - ObjVentas.Dispose() - Alert("Se está excediendo el límite de credito permitido del Cliente.", TipoMensaje.MsgInformacion) - Exit Sub - End If - End If + ' If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then + ' If ObjVentas.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then + ' ObjVentas.Dispose() + ' Alert("Se está excediendo el límite de credito permitido de la Sucursal del Cliente.", TipoMensaje.MsgInformacion) + ' Exit Sub + ' End If + ' Else + ' If ObjVentas.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then + ' ObjVentas.Dispose() + ' Alert("Se está excediendo el límite de credito permitido del Cliente.", TipoMensaje.MsgInformacion) + ' Exit Sub + ' End If + ' End If - Else - ObjVentas.Dispose() - Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError) - Exit Sub - End If - Else - ObjVentas.Dispose() - Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError) - Exit Sub - End If - ObjVentas.Dispose() + ' Else + ' ObjVentas.Dispose() + ' Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError) + ' Exit Sub + ' End If + ' Else + ' ObjVentas.Dispose() + ' Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError) + ' Exit Sub + ' End If + ' ObjVentas.Dispose() - 'VERIFICA SI TIENE BLOQUEO POR DIAS VENCIDOS - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - Dim Vta As New ClsVentas - Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa, TipoVerificacion:=2) - Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) - Vta.Dispose() + ' 'VERIFICA SI TIENE BLOQUEO POR DIAS VENCIDOS + ' If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + ' Dim Vta As New ClsVentas + ' Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa, TipoVerificacion:=2) + ' Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) + ' Vta.Dispose() - If Opcion = 2 Then - Alert(OpcionMsg, TipoMensaje.MsgError) - Exit Sub - End If - End If + ' If Opcion = 2 Then + ' Alert(OpcionMsg, TipoMensaje.MsgError) + ' Exit Sub + ' End If + ' End If - End If + ' End If - 'End If - End If + ' 'End If + 'End If 'VALIDAR LINEAS ADICIONALES If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then 'VERIFICA QUE LA CATEGORIA DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL If TmpDT IsNot Nothing AndAlso Me.CveCategoriaLineaAdicional > 0 Then For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion"}).Rows - Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("") + Dim RowClasificacion As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("") If RowClasificacion IsNot Nothing Then Dim CveCategoria As Integer = RowClasificacion("CveCategoria").ToString().ToEntero() @@ -9439,6 +9430,23 @@ Partial Class Ventas If ValidaPagosContado(TipoDoctoViejo:=TipoDoctoViejo) Then Exit Sub End If + 'validaciones, si es Anticipo solo permitir "servicios de facturación" y si es ingreso todos menos serv. factu + If UsuarioActual.CveEmpresa = 119 Then + If DdlTipoComprobante.SelectedValue = "Ing" Then + Dim tCont As Integer = TmpDT.FiltraParametros("SATClaveProdServ='84111506'").Rows.Count + If tCont > 0 Then + Alert("Existen productos con código SAT '84111506' no permitido al facturar ingresos.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + If DdlTipoComprobante.SelectedValue = "Ant" Then + Dim tCont As Integer = TmpDT.FiltraParametros("SATClaveProdServ<>'84111506'").Rows.Count + If tCont > 0 Then + Alert("Al facturar 'Anticipos' solo son permitidos código SAT '84111506'.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + End If 'CREA UNA COPIA DE SEGURIDAD PARA LOS DATOS DEL TMPDT If TmpDTError Is Nothing OrElse TmpDTError.Rows.Count = 0 Then @@ -9448,7 +9456,7 @@ Partial Class Ventas If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso TbDescuentosAdicionales.Visible Then If LblDescuentoAdicional.Text.ToDecimal() > 0 Then Dim TotalDescuento As Decimal = LblDescuentoAdicional.Text.ToDecimal() / (1D + TmpDT.MAX("PorcentajeIVA").ToString().ToDecimal()) - Dim RowDescuentos = TmpDT.Select("Descuento > 0") + Dim RowDescuentos As DataRow() = TmpDT.Select("Descuento > 0") If RowDescuentos IsNot Nothing Then @@ -9867,12 +9875,12 @@ Partial Class Ventas 'SOLO GENERAR NC POR DESCUENTO PRONTO PAGO SI EL PAGO ES DE CONTADO If ErrorList.Count = 0 AndAlso RBLPago.SelectedValue = "2" AndAlso ObjFactura.DescuentoProntoPago > 0 Then - Dim ImportePagado = DtPagos.SUM("Importe").ToString().ToDecimal + Dim ImportePagado As Decimal = DtPagos.SUMD("Importe") Dim ImporteRNC As Decimal = LblDescuentosRNC.Text.ToDecimal() If (ImportePagado + ImporteRNC + ObjFactura.DescuentoProntoPago) >= ObjFactura.Total Then - Dim RespFacturaProntoPago = GenerarNCProntoPago(ObjVentas.IniciaTransacSQL(), ObjClientes, ObjFactura) + Dim RespFacturaProntoPago As Modelos.MensajeProntoPago = GenerarNCProntoPago(ObjVentas.IniciaTransacSQL(), ObjClientes, ObjFactura) If RespFacturaProntoPago.ObjFacturaProntoPago Is Nothing OrElse RespFacturaProntoPago Is Nothing Then ErrorList.Add("No se pudo generar la nota de crédito de pronto pago") @@ -10111,7 +10119,7 @@ Partial Class Ventas Dim SeTimbro As Boolean = False Dim SeTimbroNC As Boolean = False - Dim EstatusSMS = 0 + Dim EstatusSMS As Integer = 0 Dim MsgCancelacionRefacturacion As Modelos.Factura.MCancelacionVentaMensaje = Nothing @@ -10150,7 +10158,7 @@ Partial Class Ventas End If If ChkEmitirCartaPorte.Checked AndAlso CveTimbreCartaPorte > 0 Then - Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorte, UsuarioActual) + Dim RespCartaPorte As Timbres.MMensajeCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorte, UsuarioActual) If Not RespCartaPorte.TieneError Then ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte Else @@ -10167,13 +10175,13 @@ Partial Class Ventas End Try Dim FolioFiscalFactura As String = ObjTimbrado.UUID - Dim MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI + Dim MsgErrorTimbrado As String = ObjTimbrado.MensajeErrorCFDI ObjTimbrado = Nothing 'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION If DebeTimbrar AndAlso SeTimbro AndAlso ListaNotasCreditoGeneradas IsNot Nothing AndAlso ListaNotasCreditoGeneradas.Count > 0 Then Try - For Each NCGenerada In ListaNotasCreditoGeneradas + For Each NCGenerada As Modelos.Factura In ListaNotasCreditoGeneradas If NCGenerada.Timbre IsNot Nothing Then NCGenerada.Timbre.CFDIRelacionados.UUID.Clear() NCGenerada.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura) @@ -10258,15 +10266,15 @@ Partial Class Ventas ' DESCARGA XML - SI SE TIMBRA MANDA CORREO CON FACTURA If SeTimbro Then - Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) + Dim ArchivoXML As String = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) If File.Exists(ArchivoXML) Then MensajeAlert.AppendFormat("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto))) End If Try 'MANDA CORREO - Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) - Dim Factura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False) + Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) + Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False) Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST)) Hilo.Start() Catch ex As Exception @@ -10476,7 +10484,7 @@ Partial Class Ventas Else ObjVentas.RollBack() - For Each ErrorItem In ErrorList + For Each ErrorItem As String In ErrorList Alert(ErrorItem, TipoMensaje.MsgAdvertencia) Next @@ -10501,7 +10509,7 @@ Partial Class Ventas Else ObjVentas.RollBack() - For Each ErrorItem In ErrorList + For Each ErrorItem As String In ErrorList Alert(ErrorItem, TipoMensaje.MsgAdvertencia) Next @@ -10610,28 +10618,19 @@ Partial Class Ventas End If ObjFacturaDevolucion.Fecha = Now - ObjFacturaDevolucion.Version = "4.0" - - If ObjFacturaDevolucion.Cliente Is Nothing Then - ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel - End If - + If ObjFacturaDevolucion.Cliente Is Nothing Then ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal - ObjFacturaDevolucion.CveMetodoPago33 = 1 ObjFacturaDevolucion.MetodoPago33 = "Pago en una sola exhibición" ObjFacturaDevolucion.ClaveMetodoPagoSAT = "PUE" - ObjFacturaDevolucion.CveFormaPago33 = 21 ObjFacturaDevolucion.FormaPago33 = "Aplicación de anticipos" ObjFacturaDevolucion.FormaPagoSAT33 = "30" - ObjFacturaDevolucion.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero() ObjFacturaDevolucion.UsoCFDI = DdlUsoCFDI.SelectedItem.Text ObjFacturaDevolucion.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") - ObjFacturaDevolucion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero() ObjFacturaDevolucion.TipoRelacion = "07" @@ -10764,17 +10763,10 @@ Partial Class Ventas End If 'Totales, Y se llena TmpDTImpuestos - 'ObjFactura.BZDescripcion = TxtBZDescripcion.Text.Trim - 'ObjFactura.BZNombreCorto = TxtBZNombreCorto.Text.Trim - 'ObjFactura.BZTotalLetra = TxtBZTotalLetra.Text.Trim - - - 'otros ObjFacturaDevolucion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim ObjFacturaDevolucion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim - ObjFacturaDevolucion.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero() If ObjFacturaDevolucion.CveMoneda <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then @@ -10811,8 +10803,6 @@ Partial Class Ventas ObjFacturaDevolucion.ClienteSucursal.TelefonoSucursal = LblTelefono.Text ObjFacturaDevolucion.ClienteSucursal.Sucursal = If(DdlSucursalCliente.SelectedValue.ToEntero() > 0, DdlSucursalCliente.SelectedItem.Text, "") - - ObjFacturaDevolucion.SetSubProyectoMatriz(Me) ObjFacturaDevolucion.SetSubProyecto(Me) @@ -10834,7 +10824,7 @@ Partial Class Ventas 'SI NO ES REFACTURACION If NuevaFactura <> 1 Then If DtVentasNC Is Nothing Then InicializaDTVentasNC() - Dim Drt = DtVentasNC.NewRow + Dim Drt As DataRow = DtVentasNC.NewRow Drt("CveVenta") = ObjFactura.CveVenta Drt("Importe") = 0 Drt("FolioFiscal") = ObjFactura.FolioFiscal @@ -11099,7 +11089,7 @@ Partial Class Ventas 'SI NO ES REFACTURACION If NuevaFactura <> 1 AndAlso Not AplicaDocumentoNuevoNC Then If DtVentasNC Is Nothing Then InicializaDTVentasNC() - Dim Drt = DtVentasNC.NewRow + Dim Drt As DataRow = DtVentasNC.NewRow Drt("CveVenta") = ObjFactura.CveVenta Drt("Importe") = 0 Drt("FolioFiscal") = ObjFactura.FolioFiscal @@ -11485,7 +11475,7 @@ Partial Class Ventas End If If DdlTipoComprobante.SelectedValue = "Dev" AndAlso ListaRemisionesNC IsNot Nothing AndAlso ListaRemisionesNC.Count > 0 Then - Dim ObjRNC = ListaRemisionesNC.FirstOrDefault + Dim ObjRNC As Modelos.Factura = ListaRemisionesNC.FirstOrDefault If ObjRNC IsNot Nothing Then ObjFactura.CveVentaPadre = ObjRNC.CveVentaPadre ObjFactura.SerieFolioPadre = ObjRNC.SerieFolioPadre @@ -11541,13 +11531,13 @@ Partial Class Ventas End If Next - ObjFactura.SubTotal = TmpDT.SUM("Total").ToDecimal - ObjFactura.Descuento = TmpDT.SUM("Descuento").ToDecimal + ObjFactura.SubTotal = TmpDT.SUMD("Total") + ObjFactura.Descuento = TmpDT.SUMD("Descuento") ObjFactura.Amortizacion = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * ObjFactura.TipoCambio, NumeroDecimales) - ObjFactura.IVA = TmpDT.SUM("ImporteIVA").ToDecimal - ObjFactura.RetIVA = TmpDT.SUM("ImporteRetIVA").ToDecimal - ObjFactura.RetISR = TmpDT.SUM("ImporteRetISR").ToDecimal - ObjFactura.IEPS = TmpDT.SUM("ImporteIEPS").ToDecimal + ObjFactura.IVA = TmpDT.SUMD("ImporteIVA") + ObjFactura.RetIVA = TmpDT.SUMD("ImporteRetIVA") + ObjFactura.RetISR = TmpDT.SUMD("ImporteRetISR") + ObjFactura.IEPS = TmpDT.SUMD("ImporteIEPS") ObjFactura.Total = (ObjFactura.SubTotal - ObjFactura.Descuento - ObjFactura.Amortizacion + ObjFactura.IVA + ObjFactura.IEPS - ObjFactura.RetIVA - ObjFactura.RetISR - ImpuestosLocales).ToDecimal TipoCambioRemision = ObjFactura.TipoCambio @@ -11569,22 +11559,22 @@ Partial Class Ventas Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) Next - Dim ImpuestosLocales As Double = 0 + Dim ImpuestosLocales As Decimal = 0 For Each gvr As GridViewRow In GvImpuestosLocales2.Rows If gvr.RowType = DataControlRowType.DataRow Then gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / ObjFactura.TipoCambioDolares).FormatoNumero - ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal / ObjFactura.TipoCambioDolares, NumeroDecimales) End If Next - ObjFactura.SubTotal = TmpDT.SUM("Total").ToDecimal - ObjFactura.Descuento = TmpDT.SUM("Descuento").ToDecimal + ObjFactura.SubTotal = TmpDT.SUMD("Total") + ObjFactura.Descuento = TmpDT.SUMD("Descuento") ObjFactura.Amortizacion = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / ObjFactura.TipoCambioDolares, NumeroDecimales) - ObjFactura.IVA = TmpDT.SUM("ImporteIVA").ToDecimal - ObjFactura.RetIVA = TmpDT.SUM("ImporteRetIVA").ToDecimal - ObjFactura.RetISR = TmpDT.SUM("ImporteRetISR").ToDecimal - ObjFactura.IEPS = TmpDT.SUM("ImporteIEPS").ToDecimal - ObjFactura.Total = (ObjFactura.SubTotal - ObjFactura.Descuento - ObjFactura.Amortizacion + ObjFactura.IVA + ObjFactura.IEPS - ObjFactura.RetIVA - ObjFactura.RetISR - ImpuestosLocales).ToDecimal + ObjFactura.IVA = TmpDT.SUMD("ImporteIVA") + ObjFactura.RetIVA = TmpDT.SUMD("ImporteRetIVA") + ObjFactura.RetISR = TmpDT.SUMD("ImporteRetISR") + ObjFactura.IEPS = TmpDT.SUMD("ImporteIEPS") + ObjFactura.Total = (ObjFactura.SubTotal - ObjFactura.Descuento - ObjFactura.Amortizacion + ObjFactura.IVA + ObjFactura.IEPS - ObjFactura.RetIVA - ObjFactura.RetISR - ImpuestosLocales) TipoCambioRemision = ObjFactura.TipoCambioDolares ObjFactura.TipoCambioDolares = 1 @@ -11789,7 +11779,6 @@ Partial Class Ventas TmpDTImpuestosIVAIEPS.AcceptChanges() End If End If - Next ObjFactura.DtDesgloseImpuestos = TmpDTImpuestosIVAIEPS.FiltraParametros("", Orderby:="Orden ASC") @@ -11798,7 +11787,6 @@ Partial Class Ventas ObjFactura.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim ObjFactura.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim ObjFactura.Det_ContraRecibo = TxtDet_ContraRecibo.Text.Trim - ObjFactura.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero() If ObjFactura.CveMoneda <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then @@ -11860,7 +11848,6 @@ Partial Class Ventas ObjFactura.ClienteSucursal.ImprimeNombreSucursal = ImprimeNombreSucursal.ToString() End If - 'ENVIO DIRECCION ObjFactura.EnviarA = New Modelos.EnviarAModel If ChkDireccionEnvio.Checked Then @@ -11938,7 +11925,7 @@ Partial Class Ventas For Each gvr As GridViewRow In GVAnticipos.Rows If gvr.FCCheckBox(String.Format("Chk{0}", gvr.RowIndex)).Checked AndAlso gvr.DataKey("CveConceptoContable") = "12" Then ' solo notas de crédito If DtVentasNC Is Nothing Then InicializaDTVentasNC() - Dim Drt = DtVentasNC.NewRow + Dim Drt As DataRow = DtVentasNC.NewRow Drt("CveVenta") = gvr.DataKey("CveVenta") Drt("Importe") = gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text Drt("FolioFiscal") = gvr.DataKey("FolioFiscal") @@ -11947,7 +11934,6 @@ Partial Class Ventas End If Next End If - End If If CveCliente > 0 Then ObjFactura.Timbre = PreParaTimbre(ObjFactura) @@ -11957,7 +11943,7 @@ Partial Class Ventas For Each gvr As GridViewRow In GvImpuestosLocales2.Rows If gvr.RowType = DataControlRowType.DataRow Then - Dim DrsImpuestos = TmpDTImpuestos.Select($"CveImpuestoLocal={gvr.DataKey("CveImpuestoLocal")}") + Dim DrsImpuestos As DataRow() = TmpDTImpuestos.Select($"CveImpuestoLocal={gvr.DataKey("CveImpuestoLocal")}") If DrsImpuestos IsNot Nothing AndAlso DrsImpuestos.Length = 1 Then DrsImpuestos(0)("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble @@ -12096,9 +12082,9 @@ Partial Class Ventas 'VALORES DEFAULT DE NC-DEV - Dim CveUsoCFDIOld = DdlUsoCFDI.SelectedValue - Dim MetodoPago33Old = DdlMetodoPago33.SelectedValue - Dim FormaPago33Old = DdlFormaPago33.SelectedValue + Dim CveUsoCFDIOld As String = DdlUsoCFDI.SelectedValue + Dim MetodoPago33Old As String = DdlMetodoPago33.SelectedValue + Dim FormaPago33Old As String = DdlFormaPago33.SelectedValue DdlUsoCFDI.SelectedValueExist("2") DdlMetodoPago33.SelectedValueExist("1") @@ -12516,7 +12502,7 @@ Partial Class Ventas tPS = tPS.Replace("|", " ") If tPS.Length >= 1000 Then - Dim tPSRecortado = tPS.Remove(999, tPS.Length - 999) + Dim tPSRecortado As String = tPS.Remove(999, tPS.Length - 999) tPS = tPSRecortado End If @@ -13029,10 +13015,6 @@ Partial Class Ventas End Sub #End Region - - - - #Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO " Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjAcum As ClsAcumuladores, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, @@ -13041,7 +13023,7 @@ Partial Class Ventas Dim Msgok As New StringBuilder Dim CveAlmacenTraspasoOrigen As Integer = -1 Dim CveAlmacenTraspasoDestino As Integer = -1 - Dim EsDevolucionVenta = -1 + Dim EsDevolucionVenta As Integer = -1 Dim EsInterno As Integer = -1 If DdlAlmacenAsignado.Visible Or RequiereAlmacenDestino Then @@ -13091,9 +13073,6 @@ Partial Class Ventas Next End If - - - 'SI LA FACTURA ESTA PAGADA DEBE MARCAR LA DEVOLUCION POR SI SE QUIERE AMORTIZAR If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.PagadoBancos > 0) AndAlso factura.TipoDocto = "Dev" Then factura.Alfa3 = "DEV" @@ -13196,7 +13175,6 @@ Partial Class Ventas ' ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") 'End If End If - End If End If @@ -13389,9 +13367,9 @@ Partial Class Ventas If RowMovto IsNot Nothing Then 'OBTIENE LOS IMPORTES ORIGINALES EN BASE A LO QUE HABIA EN EL MOVIMIENTO - Dim ImporteCargoOriginal = (RowMovto("ImporteCargo").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2) + Dim ImporteCargoOriginal As Decimal = (RowMovto("ImporteCargo").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2) 'Dim ImporteBonificacionOriginal = (RowMovto("ImporteBonificacion").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2) - Dim PuntosOriginales = (RowMovto("Puntos").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2) + Dim PuntosOriginales As Decimal = (RowMovto("Puntos").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2) Dim CveTamanio As Integer = RowMovto("CveTamaño").ToString().ToEntero() Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() @@ -13412,7 +13390,7 @@ Partial Class Ventas If DrTamanio IsNot Nothing Then 'OBTIENE LOS IMPORTES ORIGINALES EN BASE A LO QUE HABIA EN EL MOVIMIENTO - Dim ImporteBonificacion = Row("Total").ToString().ToDecimal().RoundSQL(2) + Dim ImporteBonificacion As Decimal = Row("Total").ToString().ToDecimal().RoundSQL(2) Dim CveTamanio As Integer = DrTamanio("CveTamaño").ToString().ToEntero() Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() @@ -14109,10 +14087,10 @@ Partial Class Ventas 'APLICA DEVOLUCION SALDOS DIRECTOS If AplicaDevolucion Then - Dim importeMovimientoDev = TxtTotal.Text.ToDecimal + Dim importeMovimientoDev As Decimal = TxtTotal.Text.ToDecimal importeMovimientoDev = If(SaldoVentaDevolucion < importeMovimientoDev, SaldoVentaDevolucion, importeMovimientoDev) If importeMovimientoDev > 0 Then - Dim importeMXDev = importeMovimientoDev * tipoCambio * Multiplicador + Dim importeMXDev As Decimal = importeMovimientoDev * tipoCambio * Multiplicador If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimientoDev.FormatoNumero(2)}" If UsaComplementariaClientes AndAlso tipoCambio > 1 Then @@ -15161,7 +15139,7 @@ Partial Class Ventas MovDetalle.Columns.Add(New DataColumn("CveVentaDetalle", GetType(Integer))) For Each RowPS As DataRow In DtProductos.Rows - Dim RowInv = MovDetalle.NewRow + Dim RowInv As DataRow = MovDetalle.NewRow RowInv("Cantidad") = RowPS("Cantidad").ToString().ToDecimal() RowInv("CveUM") = RowPS("CveUM").ToString().ToEntero() @@ -15176,7 +15154,7 @@ Partial Class Ventas Next 'Le damos salida de apartado por traspaso - Dim CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=False, ObjConta:=ObjConta, CveAlmacenDestino:=CveAlmacenExA, MovimientoPrePoliza:=False) + Dim CveMovimientoSalidaPorTraspaso As Integer = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=False, ObjConta:=ObjConta, CveAlmacenDestino:=CveAlmacenExA, MovimientoPrePoliza:=False) If Not CveMovimientoSalidaPorTraspaso > 0 Then OcurrioError = True @@ -15277,7 +15255,7 @@ Partial Class Ventas Dim Importe As Decimal Dim Concepto As String Dim tipoCambio As Decimal - Dim CveSubProyectoContabilizar = DdlSubProyectoDatos.SelectedValue.ToEntero() + Dim CveSubProyectoContabilizar As Integer = DdlSubProyectoDatos.SelectedValue.ToEntero() For Each RowIL As DataRow In TmpDTImpuestos.Rows If RowIL("TipoImpuesto").ToString().ToEntero() > 0 Then @@ -15565,8 +15543,8 @@ Partial Class Ventas LocalTipoDocto = Factura.TipoDocto Dim ArchivoAdjunto As String = "" - Dim ArchivoXML = String.Format("{0}XML\{1}\{2}.xml", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) - Dim ArchivoPDF = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) + Dim ArchivoXML As String = String.Format("{0}XML\{1}\{2}.xml", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) + Dim ArchivoPDF As String = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) If Adjunto <> "" Then ArchivoAdjunto = String.Format("{0}Ventas\{1}", UsuarioActual.Empresa.Ruta, Adjunto) End If @@ -15640,8 +15618,8 @@ Partial Class Ventas 'MANDA CORREO If EnviaCorreo Then Dim ArchivoAdjunto As String = "" - Dim ArchivoXML = "" - Dim ArchivoPDF = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) + Dim ArchivoXML As String = "" + Dim ArchivoPDF As String = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) If Adjunto <> "" Then ArchivoAdjunto = String.Format("{0}Ventas\{1}", UsuarioActual.Empresa.Ruta, Adjunto) @@ -15688,8 +15666,8 @@ Partial Class Ventas LocalTipoDocto = ObjFactura.TipoDocto Dim ArchivoAdjunto As String = "" - Dim ArchivoXML = String.Format("{0}XML\{1}\{2}.xml", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) - Dim ArchivoPDF = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) + Dim ArchivoXML As String = String.Format("{0}XML\{1}\{2}.xml", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) + Dim ArchivoPDF As String = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio) If Adjunto <> "" Then ArchivoAdjunto = String.Format("{0}Ventas\{1}", UsuarioActual.Empresa.Ruta, Adjunto) End If @@ -15733,7 +15711,7 @@ Partial Class Ventas Dim ObjMovtos As New ClsMovimientos() If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then - Dim DtMovtos = ObjMovtos.DtResultados.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'Ant' ", "")} {If(DdlTipoComprobante.SelectedValue = "Ant", "AND Tipo = 'NC'", "")}") + Dim DtMovtos As DataTable = ObjMovtos.DtResultados.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'Ant' ", "")} {If(DdlTipoComprobante.SelectedValue = "Ant", "AND Tipo = 'NC'", "")}") If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) Then DtMovtos = DtMovtos.FiltraParametros($"{If(CveVenta < 0, $"Tipo = 'Ant'{If(DdlTipoComprobante.SelectedValue = "Ing", $" AND CveMoneda ={DdlMoneda.SelectedValue.ToEntero()}", "")} ", "")}") End If @@ -15869,9 +15847,6 @@ Partial Class Ventas End If End If - - - e.Row.FCLiteral("MonedaVenta").Text = saldo.FormatoNumero(2) e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2});", e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, saldo, AmortizacionSujeridaContrato)) e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, saldo)) @@ -15906,10 +15881,6 @@ Partial Class Ventas If e.Row.DBCampo("CveMoneda").ToString().ToEntero() = DdlMoneda.SelectedValue.ToEntero() Then e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Visible = False End If - - - - End If End Sub Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click @@ -15966,7 +15937,7 @@ Partial Class Ventas Dim tipoCambioVentaValuacion As Decimal = 1 Dim PorcentajePago As Decimal = 100 Dim dtConceptos As DataTable = Nothing - Dim CveMonedaVenta = DdlMoneda.SelectedValue.ToEntero() + Dim CveMonedaVenta As Integer = DdlMoneda.SelectedValue.ToEntero() If ObjConta.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then dtConceptos = ObjConta.DtResultados End If @@ -15976,11 +15947,9 @@ Partial Class Ventas For Each gvr As GridViewRow In GVAnticipos.Rows If gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked Then - Dim FechaUltimaFluctuacion As Date = MinFecha Dim TipoCambioFluctuacion As Decimal = 1 Dim tFecha As Date = Now - Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha) @@ -15990,8 +15959,6 @@ Partial Class Ventas TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion End If End If - - If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN PESOS tipoCambioPago = 1 tipoCambioVenta = 1 @@ -16343,7 +16310,7 @@ Partial Class Ventas Dim ImporteMX As Decimal Dim FechaMovimiento As Date = Now Dim Concepto As String = ViewState("VentaFolio").ToString() - Dim PrePolizaCorrecta = True + Dim PrePolizaCorrecta As Boolean = True '13 Iva x Trasladar ImporteMovimiento = Importe13 * PorcentajeAmortizacion ImporteMX = Math.Round(ImporteMovimiento, 2) * TipoCambio @@ -16384,7 +16351,7 @@ Partial Class Ventas Dim ImporteMX As Decimal Dim FechaMovimiento As Date = Now Dim Concepto As String = ViewState("VentaFolio").ToString() - Dim PrePolizaCorrecta = True + Dim PrePolizaCorrecta As Boolean = True Dim PorcentajeImpuesto As Decimal '61 Iva Trasladado @@ -16449,7 +16416,7 @@ Partial Class Ventas PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) If ChkEmitirCartaPorte.Checked Then - Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorteVenta, UsuarioActual) + Dim RespCartaPorte As Timbres.MMensajeCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorteVenta, UsuarioActual) If Not RespCartaPorte.TieneError Then ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte Else @@ -16482,7 +16449,7 @@ Partial Class Ventas MensajeAlert.AppendFormat(String.Format("
La {0}: {1} se generó correctamente.

", ObjFactura.TipoDocumento, ObjFactura.SerieFolio)) 'XML - Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) + Dim ArchivoXML As String = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) If File.Exists(ArchivoXML) Then MensajeAlert.AppendFormat("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto))) End If @@ -16505,8 +16472,8 @@ Partial Class Ventas 'IMPRESION Try 'MANDA CORREO - Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) - Dim Factura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False) + Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) + Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False) Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST)) Hilo.Start() Catch ex As Exception @@ -16675,7 +16642,7 @@ Partial Class Ventas Dim CvePACCancelacion As Integer = GvRow.DataKey("CvePAC").ToEntero() - Dim RespCancelacion = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, 0, RFCReceptor, RFCEmisor, CvePACCancelacion) + Dim RespCancelacion As RespuestaCancelacionSAT = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, 0, RFCReceptor, RFCEmisor, CvePACCancelacion) If RespCancelacion.Verificado Then @@ -16980,7 +16947,7 @@ Partial Class Ventas Dim PrecioSugerido As Decimal = 0 Dim tPrecioSugerido As Decimal = 0 tPrecioSugerido = drPS("Precio").ToString().ToDecimal - Dim ObjPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, drPS("CveClasificacion").ToString().ToEntero()) + Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, drPS("CveClasificacion").ToString().ToEntero()) PrecioSugerido = ObjPrecioSugerido.PrecioSugerido @@ -17033,7 +17000,7 @@ Partial Class Ventas If UsuarioActual.CveEmpresa.Contiene(1) Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPorcentajeProductos(CveCliente) Then - Dim PrecioAplicado = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDecimal + Dim PrecioAplicado As Decimal = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDecimal If PrecioAplicado > 0 Then PrecioSugerido = PrecioAplicado End If @@ -17085,7 +17052,7 @@ Partial Class Ventas If PrecioSugerido = 0 Then Dim ObjInventarios As New ClsInventarios - Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) + Dim CostoPS As Decimal = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1) ObjInventarios.Dispose() @@ -17577,7 +17544,7 @@ Partial Class Ventas End Sub Private Sub CargaFormatoSucursal(Optional RecalcularIVA As Boolean = True) - Dim dr = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", If(DdlSubProyectoDatos.SelectedValue = "", "-1", DdlSubProyectoDatos.SelectedValue))) + Dim dr As DataRow = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", If(DdlSubProyectoDatos.SelectedValue = "", "-1", DdlSubProyectoDatos.SelectedValue))) If dr IsNot Nothing Then ViewState("SucCalle") = dr("Calle") ViewState("SucNoExt") = dr("NoExt") @@ -17857,8 +17824,8 @@ Partial Class Ventas If Not CveContrato > 0 Then 'BANDERAS PARA VALIDACIONES - Dim EsValido = False - Dim EsValidoMayor = False + Dim EsValido As Boolean = False + Dim EsValidoMayor As Boolean = False Dim CostoMenor As Decimal = 0.0D Dim CostoMayor As Decimal = 0.0D @@ -18068,26 +18035,26 @@ Partial Class Ventas If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then 'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then - Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}") + Dim RowPorcentaje As DataRow = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}") 'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA If RowPorcentaje IsNot Nothing Then '(AHORA LOS DESCUENTOS SON ACUMULABLES) 'Descuento = 0 - Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D - Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D - Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D + Dim PorcentajeProducto As Decimal = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D + Dim PorcentajeProducto2 As Decimal = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D + Dim PorcentajeProducto3 As Decimal = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D Dim TotalInicial As Decimal = (Cantidad * (PU)) '- Descuento - Dim TotalFinal = TotalInicial + Dim TotalFinal As Decimal = TotalInicial 'SI APLICA EL PRIMER DESCUENTO If PorcentajeProducto > 0 Then Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2) - Dim Total2 = (TotalInicial - Descuento1) + Dim Total2 As Decimal = (TotalInicial - Descuento1) 'SI APLICA EL SEGUNDO DESCUENTO If PorcentajeProducto2 > 0 Then Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2) - Dim Total3 = (Total2 - Descuento2) + Dim Total3 As Decimal = (Total2 - Descuento2) 'SI APLICA EL TERCER DESCUENTO If PorcentajeProducto3 > 0 Then @@ -18112,7 +18079,7 @@ Partial Class Ventas Dim SubTotalProntoPago As Decimal = (Cantidad * (PU)) - Descuento Dim TotalProntoPago As Decimal = SubTotalProntoPago * (1 + PorcentajeIVA) - Dim PorcentajeProntoPago = RowPorcentaje("ProntoPago").ToString().ToDecimal() / 100D + Dim PorcentajeProntoPago As Decimal = RowPorcentaje("ProntoPago").ToString().ToDecimal() / 100D ObjDescuento.ImporteProntoPago = (TotalProntoPago * PorcentajeProntoPago).RoundSQL(2) End If @@ -18160,7 +18127,7 @@ Partial Class Ventas ObjDescuento.NombrePromo = "YOKOHAMA VERANO" 'dr("NombrePromocion").ToString() ObjDescuento.CveMarca = CveMarcaPromocion Dim Rin As String = DtRines.FiltroPrimeroValor("RinTamaño", $"CveRinTamaño = {CveRinTamañoPS}") - Dim PromoDescuento = (Descuento * (1 + If(IncluyeImpuestos, PorcentajeIVA, 0))).RoundSQL(2) + Dim PromoDescuento As Decimal = (Descuento * (1 + If(IncluyeImpuestos, PorcentajeIVA, 0))).RoundSQL(2) ObjDescuento.ObsDescuento = String.Format("RIN {0} BONO ${1:N2}", Rin, PromoDescuento) End If @@ -18176,8 +18143,14 @@ Partial Class Ventas Return ObjDescuento End Function - - + 'Private ReadOnly Property ClasificacionesDescuentos As Dictionary(Of Integer, Decimal) + ' Get + ' Return New Dictionary(Of Integer, Decimal) From { + ' {20516, 0.21D}, 'Descuento para lubricantes LTH + ' {20515, 0.25D} 'Descuento para filtros LTH + ' } + ' End Get + 'End Property Private Sub AgregarPS() 'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL) Try @@ -18552,7 +18525,7 @@ Partial Class Ventas If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") - Dim ClienteRetIVA = Me.ClienteRetIVA + Dim ClienteRetIVA As Decimal = Me.ClienteRetIVA If ClienteRetIVA <= 0 AndAlso DrPS("RetIVA").ToString.ToDecimal > 0 Then ClienteRetIVA = DrPS("RetIVA").ToString.ToDecimal DdlTipoRetencion.Enabled = True @@ -18669,7 +18642,7 @@ Partial Class Ventas Dim CvePSAdicional As Integer = Dr("CvePSAdicional").ToString().ToEntero() Dim DrPoliza As DataRow = TmpDT.NewRow() DrPoliza.ItemArray = Row.ItemArray - Dim DrPSAdicional = GlobalDTPS(UsuarioActual.CveEmpresa, CvePSAdicional).Rows(0) + Dim DrPSAdicional As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePSAdicional).Rows(0) If DrPSAdicional IsNot Nothing Then DrPoliza("CvePS") = CvePSAdicional DrPoliza("PS") = DrPSAdicional("PS").ToString() @@ -18705,13 +18678,13 @@ Partial Class Ventas PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal If PrecioSugerido = 0 Then Dim ObjInventarios As New ClsInventarios - Dim CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) + Dim CostoPS As Decimal = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1) ObjInventarios.Dispose() - Dim PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal + Dim PorcentajePrecio As Decimal = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal If CostoPS > 0 And PorcentajePrecio > 0 Then PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS End If @@ -20040,13 +20013,9 @@ Partial Class Ventas If OcurrioError Then Exit For End If - End If - End If - End If - If OcurrioError Then Exit For End If @@ -20194,7 +20163,7 @@ Partial Class Ventas Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False, Optional CveAlmacenDestino As Integer = -1) As Integer Dim OcurrioError As Boolean = False - Dim ContadorMovtosDetalles = 0 + Dim ContadorMovtosDetalles As Integer = 0 'If Not AplicaMovimientoDetalleEntrada Then ' Dim rowa As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen={0}", CveAlmacen)) @@ -20295,7 +20264,7 @@ Partial Class Ventas End If If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then - Dim DtCostos = ObjInventario.DtResultados.Copy + Dim DtCostos As DataTable = ObjInventario.DtResultados.Copy Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}) Dim ValorInventario As Decimal Dim TotalCostoAcumulado As Decimal = 0D @@ -20476,7 +20445,7 @@ Partial Class Ventas If CveMovimientoVirtual > 0 Then For Each RowUsado As DataRow In DtPSVirtual.Rows - Dim CvePS = RowUsado("CvePS").ToString().ToEntero() + Dim CvePS As Integer = RowUsado("CvePS").ToString().ToEntero() Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble() Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal() Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero() @@ -20501,7 +20470,7 @@ Partial Class Ventas If CveMovimientoVirtual > 0 Then 'OcurrioError = Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoInventario, CveAlmacen) If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtual, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then - Dim DtCostos = ObjInventario.DtResultados.Copy + Dim DtCostos As DataTable = ObjInventario.DtResultados.Copy Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}) Dim ValorInventario As Decimal Dim TotalCostoAcumulado As Decimal = 0D @@ -20596,7 +20565,7 @@ Partial Class Ventas If CveMovimientoVirtual > 0 Then For Each RowUsado As DataRow In DtPSVirtual.Rows - Dim CvePS = RowUsado("CvePS").ToString().ToEntero() + Dim CvePS As Integer = RowUsado("CvePS").ToString().ToEntero() Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble() Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal() Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero() @@ -20810,7 +20779,7 @@ Partial Class Ventas Dim Asunto As String = String.Empty Dim Cuerpo As String = String.Empty - Dim TipoComprobante = "" + Dim TipoComprobante As String = "" If TipoDocto = "Ing" Then TipoComprobante = "Factura" If TipoDocto = "Egs" Then TipoComprobante = "Nota de Crédito" @@ -20877,8 +20846,6 @@ Partial Class Ventas End If End If - - If Not EnviarFactura Then ResultadoMail = 0 End If @@ -20931,7 +20898,7 @@ Partial Class Ventas #Region " ESTIMACIONES " Protected Sub DdlContrato_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlContrato.SelectedIndexChanged - Dim valueselect = DdlContrato.SelectedValue + Dim valueselect As String = DdlContrato.SelectedValue Dim CveContrato As Integer = valueselect.ToEntero() Using ObjContratos As New ClsContratos @@ -21245,7 +21212,7 @@ Partial Class Ventas Dim SWatch As New Stopwatch SWatch.Start() - Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True) + Dim Vigencia As Timbrado.AcuseCancelacionSAT = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True) SWatch.Stop() Dim SegundosRespuesta As Double = SWatch.ElapsedMilliseconds / 1000 @@ -21264,7 +21231,7 @@ Partial Class Ventas BtnMotivoRefacturacion.Visible = False DivMotivoRefacturacionTexto.Visible = False - Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) + Dim Relacionados As Timbrado.MRespUUIDRelacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) If Relacionados IsNot Nothing Then Dim sbExtra As New StringBuilder() If Relacionados.Codigo = 500 Then @@ -21272,8 +21239,8 @@ Partial Class Ventas Else sbExtra.Append(Relacionados.Mensaje) - Dim SbHijos = New StringBuilder() - Dim SbPadres = New StringBuilder() + Dim SbHijos As New StringBuilder() + Dim SbPadres As New StringBuilder() 'If Relacionados.RelacionadosHijo IsNot Nothing Then ' For Each hijo In Relacionados.RelacionadosHijo @@ -21285,7 +21252,7 @@ Partial Class Ventas 'End If If Relacionados.RelacionadosPadre IsNot Nothing Then - For Each padre In Relacionados.RelacionadosPadre + For Each padre As Timbrado.RelacionadosPadre In Relacionados.RelacionadosPadre SbPadres.AppendFormat("{0};", padre.Uuid) Next If SbPadres.Length > 0 Then @@ -21393,7 +21360,7 @@ Partial Class Ventas 'Exit Sub Dim ObjConta As New ClsContabilidad - Dim Movimientos = ObjConta.GetMovimientosPoliza(IdPoliza, UsuarioActual.CveEmpresa) + Dim Movimientos As Integer = ObjConta.GetMovimientosPoliza(IdPoliza, UsuarioActual.CveEmpresa) 'Verifica que solo exista 1 compra asociada If Movimientos = 1 Then @@ -21461,21 +21428,21 @@ Partial Class Ventas ViewState("CveClienteAnterior") = CveCliente - Dim CantidadFacturadaRemision = 0.0 + Dim CantidadFacturadaRemision As Decimal = 0 'EN BDH NO DEBE PERMITIR EDITAR EL PU If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then For Each Gvr As GridViewRow In GvPS.Rows Gvr.FCLinkButton("imgE").Visible = True Gvr.FCLinkButton("imgD").Visible = False - CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString().ToDouble + CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString().ToDecimal Next Else 'SI EL DETALLE NO TIENE MOVIMIENTOS DE INVENTARIO ES VISIBLE For Each Gvr As GridViewRow In GvPS.Rows Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString().ToDouble > 0 Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString().ToDouble > 0 - CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString().ToDouble + CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString().ToDecimal 'If GvInv.Rows.Count > 0 Then ' Gvr.FCLinkButton("imgE").Enabled = False ' Gvr.FCLinkButton("imgE").ToolTip = "No se puede editar debido a que ya hay un movimiento de almacen." @@ -21719,7 +21686,7 @@ Partial Class Ventas Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa Dim CveUsuarioPDF As Integer = UsuarioActual.CveUsuario - Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) + Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST) ' 'Dim Hilo As New System.Threading.Thread(Sub() ) @@ -21740,7 +21707,7 @@ Partial Class Ventas Private Sub BtnActualizarCuentaTerminal_Click(sender As Object, e As EventArgs) Handles BtnActualizarCuentaTerminal.Click Dim ObjVentas As New ClsVentas ObjVentas.IniciaTransacSQL() - Dim TieneError = False + Dim TieneError As Boolean = False If Not ObjVentas.UpdateVentaCuentaTerminal(DdlCuentaTerminalModal.SelectedValue.ToEntero(), CveVenta) Then TieneError = True @@ -22241,8 +22208,8 @@ Partial Class Ventas DtPagos.Rows.RemoveAt(e.RowIndex) 'JJMQ 20160506: Validacion para no pagar de mas a peticion de I.P. - Dim abonado = DtPagos.SUM("Importe") - Dim saldo = TxtTotal.Text.Replace(",", "").ToDouble - abonado + Dim abonado As Decimal = DtPagos.SUMD("Importe") + Dim saldo As Decimal = TxtTotal.Text.Replace(",", "").ToDecimal - abonado 'CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString() LblDescuentoAdicional.Text = "0.00" @@ -22301,7 +22268,7 @@ Partial Class Ventas 'Pago en Efectivo If TxtImporteEfectivo.Text.ToDecimal > 0 Then If DdlCuentaEfectivo.Items.Count > 0 Then - Dim DrEfectivo = DtPagos.NewRow + Dim DrEfectivo As DataRow = DtPagos.NewRow DrEfectivo("CveTipoMovimiento") = 13 DrEfectivo("TipoMovimiento") = "Pago en Efectivo" DrEfectivo("CveCuenta") = DdlCuentaEfectivo.SelectedValue @@ -22323,7 +22290,7 @@ Partial Class Ventas If TxtImporteCredito.Text.ToDecimal > 0 Then If DdlCuentaTarjetaCredito.Items.Count > 0 Then - Dim DrCredito = DtPagos.NewRow + Dim DrCredito As DataRow = DtPagos.NewRow DrCredito("CveTipoMovimiento") = 12 DrCredito("TipoMovimiento") = "Tarjeta de Crédito" DrCredito("CveCuenta") = DdlCuentaTarjetaCredito.SelectedValue @@ -22373,7 +22340,7 @@ Partial Class Ventas 'Pago Tarjeta Debito If TxtImporteCheque.Text.ToDecimal > 0 Then If DdlCuentaCheque.Items.Count > 0 Then - Dim DrCheque = DtPagos.NewRow + Dim DrCheque As DataRow = DtPagos.NewRow DrCheque("CveTipoMovimiento") = 3 DrCheque("TipoMovimiento") = "Cheque" DrCheque("CveCuenta") = DdlCuentaCheque.SelectedValue @@ -22394,7 +22361,7 @@ Partial Class Ventas 'Pago Transferencia If TxtImporteTransferencia.Text.ToDecimal > 0 Then If DdlCuentaTransferencia.Items.Count > 0 Then - Dim DrCheque = DtPagos.NewRow + Dim DrCheque As DataRow = DtPagos.NewRow DrCheque("CveTipoMovimiento") = 8 DrCheque("TipoMovimiento") = "Transferencia" DrCheque("CveCuenta") = DdlCuentaTransferencia.SelectedValue @@ -22420,7 +22387,7 @@ Partial Class Ventas Case 1 If TxtImporteOtrosContado.Text.ToDecimal > 0 Then If DdlCuentaOtrosContado.Items.Count > 0 Then - Dim DrCredito = DtPagos.NewRow + Dim DrCredito As DataRow = DtPagos.NewRow DrCredito("CveTipoMovimiento") = 12 DrCredito("TipoMovimiento") = "Tarjeta de Crédito" DrCredito("CveCuenta") = DdlCuentaOtrosContado.SelectedValue @@ -22447,7 +22414,7 @@ Partial Class Ventas Case 2 If TxtImporteOtrosContado.Text.ToDecimal > 0 Then If DdlCuentaOtrosContado.Items.Count > 0 Then - Dim DrDebito = DtPagos.NewRow + Dim DrDebito As DataRow = DtPagos.NewRow DrDebito("CveTipoMovimiento") = 11 DrDebito("TipoMovimiento") = "Tarjeta de Debito" DrDebito("CveCuenta") = DdlCuentaOtrosContado.SelectedValue @@ -22468,7 +22435,7 @@ Partial Class Ventas Case 3 If TxtImporteOtrosContado.Text.ToDecimal > 0 Then If DdlCuentaOtrosContado.Items.Count > 0 Then - Dim DrCheque = DtPagos.NewRow + Dim DrCheque As DataRow = DtPagos.NewRow DrCheque("CveTipoMovimiento") = 3 DrCheque("TipoMovimiento") = "Cheque" DrCheque("CveCuenta") = DdlCuentaOtrosContado.SelectedValue @@ -22515,7 +22482,7 @@ Partial Class Ventas If UsuarioActual.CveRol = 1 AndAlso DdlTipoComprobante.SelectedValue = "Ing" AndAlso (Not VieneDeCotizacion) AndAlso UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso DtPagos IsNot Nothing AndAlso TbDescuentosAdicionales.Visible Then If TmpDT.SUMD("Descuento") > 0 AndAlso DtPagos.SUMD("Importe", "MesesSinIntereses <=0") = TxtTotal.Text.ToDecimal() Then Dim TotalDescuento As Decimal = TmpDT.SUMD("Total", "Descuento > 0") * 0.05D - Dim RowDescuentos = TmpDT.Select("Descuento > 0") + Dim RowDescuentos As DataRow() = TmpDT.Select("Descuento > 0") If RowDescuentos IsNot Nothing Then LblDescuentoAdicional.Text = TotalDescuento.FormatoNumero(2) @@ -22530,7 +22497,7 @@ Partial Class Ventas CalculaTotalesVenta() - Dim RowPago = DtPagos.Rows(0) + Dim RowPago As DataRow = DtPagos.Rows(0) RowPago("Importe") = LblTotalAPagarAdicional.Text.ToDecimal() @@ -22549,7 +22516,7 @@ Partial Class Ventas LimpiaEscondeContado() End Sub Private Function ValidaPagosContado(Optional MostrarAlertas As Boolean = True, Optional TipoDoctoViejo As String = "") As Boolean - Dim Retorno = False + Dim Retorno As Boolean = False Dim AmortizacionNC As Decimal = 0 @@ -22611,7 +22578,7 @@ Partial Class Ventas Dim TotalRNC As Decimal = If((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0), LblDescuentosRNC.Text.Trim().ToDecimal(), 0) Dim ImporteTotal As Decimal = (TxtTotal.Text.ToDecimal).RoundSQL(2) - Dim TotalPagado = (TotalPagoContado + TotalRNC + TotalProntoPago).RoundSQL(2) + Dim TotalPagado As Decimal = (TotalPagoContado + TotalRNC + TotalProntoPago).RoundSQL(2) If TotalPagado <> ImporteTotal Then If MostrarAlertas Then @@ -22623,7 +22590,7 @@ Partial Class Ventas End If Else - Dim TotalPagado = (TotalPagoContado + TotalProntoPago).RoundSQL(2) + Dim TotalPagado As Decimal = (TotalPagoContado + TotalProntoPago).RoundSQL(2) If TotalPagado <> TxtTotal.Text.ToDecimal.RoundSQL(2) Then If MostrarAlertas Then Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) @@ -22703,14 +22670,14 @@ Partial Class Ventas #Region " SERIE ALMACEN " Protected Sub BtnSerie_Click(sender As Object, e As EventArgs) - Dim Row = CType(CType(sender, Button).NamingContainer, GridViewRow) + Dim Row As GridViewRow = CType(CType(sender, Button).NamingContainer, GridViewRow) If Row.FCTextBox("TxtSerie").Text.Trim = "" Then Exit Sub - Dim Index = Row.RowIndex + Dim Index As Integer = Row.RowIndex Dim ObjInventarios As New ClsInventarios - Dim Existencia = ObjInventarios.GetExistenciasPSSerie(Row.FCTextBox("TxtSerie").Text.ToString(), ddlAlmacen.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) - Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Row.FCTextBox("TxtSerie").Text.ToString())) + Dim Existencia As Decimal = ObjInventarios.GetExistenciasPSSerie(Row.FCTextBox("TxtSerie").Text.ToString(), ddlAlmacen.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) + Dim ExistenciaActual As Decimal = DtInv.SUMD("Cantidad", String.Format("Serie = '{0}'", Row.FCTextBox("TxtSerie").Text.ToString())) 'Valida Existencia If Existencia - ExistenciaActual <= 0 Then @@ -22730,9 +22697,9 @@ Partial Class Ventas UpINV.Update() End Sub Private Function ValidaSerieINV() As Boolean - Dim Retorno = False - Dim Existencia = 0.0 - Dim ExistenciaActual = 0.0 + Dim Retorno As Boolean = False + Dim Existencia As Decimal = 0 + Dim ExistenciaActual As Decimal = 0 Dim ObjInventarios As New ClsInventarios For Each Gvr As GridViewRow In GvInv.Rows @@ -22747,7 +22714,7 @@ Partial Class Ventas If Gvr.FCTextBox("TxtSerie").Visible = True And Gvr.FCTextBox("TxtSerie").Text.Trim <> "" Then Existencia = ObjInventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, ddlAlmacen.SelectedValue.ToEntero(), Serie:=Gvr.FCTextBox("TxtSerie").Text.ToString(), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) - ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim)) + ExistenciaActual = DtInv.SUMD("Cantidad", String.Format("Serie = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim)) 'Valida Existencia If Existencia - ExistenciaActual < 0 Then @@ -22946,7 +22913,7 @@ Partial Class Ventas End If Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1") - Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}") + Dim DtUsosCFDI As DataTable = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}") If DtUsosCFDI.Rows.Count = 0 Then Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia) @@ -23203,7 +23170,7 @@ Partial Class Ventas Exit Sub End If - Dim EstatusDevolucion = If(Me.DevolucionAlmacen = 0, 1, 0) + Dim EstatusDevolucion As Integer = If(Me.DevolucionAlmacen = 0, 1, 0) Dim ObjV As New ClsVentas If ObjV.UpdateVentasDevolucionAlmacen(EstatusDevolucion, CveVenta) Then @@ -23223,7 +23190,7 @@ Partial Class Ventas #Region "D I R E C C I O N E N V I O" Private Sub CargaDireccionesEnvio() Dim ObjClientes As New ClsClientes - Dim TieneError = False + Dim TieneError As Boolean = False DdlDireccionEnvio.Items.Clear() If ObjClientes.DireccionEnvioGet(-1, CveCliente, CveClienteSucursal) Then @@ -23254,7 +23221,7 @@ Partial Class Ventas End Sub Private Sub BtnAgregarDireccion_Click(sender As Object, e As EventArgs) Handles BtnAgregarDireccion.Click Dim ObjClientes As New ClsClientes - Dim TieneError = False + Dim TieneError As Boolean = False Dim CveDireccionEnvio As Integer CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(CveCliente, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, DdlDirClienteColonia.SelectedItem.Text.Trim, DdlDirClienteMunicipio.SelectedItem.Text.Trim, DdlDirClienteEstado.SelectedItem.Text.Trim, TxtEnvioCP.Text.Trim(), TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, 1, CveClienteSucursal:=CveClienteSucursal, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), @@ -23680,7 +23647,7 @@ Partial Class Ventas Dim ObjetoPDF As Byte() = DescargarPDF(Encripta(String.Format("OP=CAN&CVEVTA={0}", CveVenta))) If ObjetoPDF IsNot Nothing Then - Dim RFC = UsuarioActual.Empresa.RFC + Dim RFC As String = UsuarioActual.Empresa.RFC Dim ObjMail As New ClsSisMail Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) Dim Asunto As String = String.Empty @@ -23852,7 +23819,7 @@ Partial Class Ventas Dim SWatch As New Stopwatch SWatch.Start() - Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True) + Dim Vigencia As timbrado.AcuseCancelacionSAT = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True) SWatch.Stop() @@ -23873,15 +23840,14 @@ Partial Class Ventas DivCanRem.Visible = False DivDevAlm.Visible = False - Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) + Dim Relacionados As Timbrado.MRespUUIDRelacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) If Relacionados IsNot Nothing Then If Relacionados.Codigo = 500 Then sbExtra.Append("El servicio de verificación de documentos relacionados no esta disponible.") Else sbExtra.Append(Relacionados.Mensaje) - - Dim SbHijos = New StringBuilder() - Dim SbPadres = New StringBuilder() + Dim SbHijos As New StringBuilder() + Dim SbPadres As New StringBuilder() 'If Relacionados.RelacionadosHijo IsNot Nothing Then ' For Each hijo In Relacionados.RelacionadosHijo @@ -23893,7 +23859,7 @@ Partial Class Ventas 'End If If Relacionados.RelacionadosPadre IsNot Nothing Then - For Each padre In Relacionados.RelacionadosPadre + For Each padre As Timbrado.RelacionadosPadre In Relacionados.RelacionadosPadre SbPadres.AppendFormat("{0};", padre.Uuid) Next If SbPadres.Length > 0 Then @@ -23902,13 +23868,11 @@ Partial Class Ventas End If Using ObjVentas As New ClsVentas - 'If SbHijos.Length > 0 Then ' If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbHijos.ToString(), UsuarioActual.CveEmpresa) Then ' GvFacturasHijosCancelar.DataSource = ObjVentas.DtResultados.Copy() ' End If 'End If - If SbPadres.Length > 0 Then If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then GvFacturasPadreCancelar.DataSource = ObjVentas.DtResultados.FiltraParametros($"CveVenta <> {CveVenta}") @@ -23916,7 +23880,6 @@ Partial Class Ventas End If End Using - 'GvFacturasHijosCancelar.DataBind() GvFacturasPadreCancelar.DataBind() End If @@ -24216,8 +24179,8 @@ Partial Class Ventas For Each RowBon As DataRow In DtBonificaciones.Rows Try 'VERIFICA SI TIENE RNC DE BONIFICACION - Dim Bon = New Modelos.Factura(UsuarioActual, RowBon("CveVentaBonificacion").ToString().ToEntero(), UsuarioActual.CveEmpresa, VerificaAlmacen:=False) - Dim respBon = Bon.CancelarFactura(False, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion) + Dim Bon As New Modelos.Factura(UsuarioActual, RowBon("CveVentaBonificacion").ToString().ToEntero(), UsuarioActual.CveEmpresa, VerificaAlmacen:=False) + Dim respBon As Modelos.Factura.MCancelacionVentaMensaje = Bon.CancelarFactura(False, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion) If respBon.HuboError Then strMensaje.AppendFormat("
Ocurrió un error al cancelar la remisión de NC de bonificación {0} .", Bon.SerieFolio) Else @@ -24290,7 +24253,7 @@ Partial Class Ventas #Region "CiclosComerciales" Private Sub CargaCicloComercialURL() Dim ObjContratos As New ClsContratos - Dim huboerror = False + Dim huboerror As Boolean = False Dim SubProyecto As String = "" Dim CveSubProyecto As Integer = -1 Dim Proyecto As String = "" @@ -24309,7 +24272,7 @@ Partial Class Ventas Dim tPSDescripcion As String = "-" Dim PSS As String = "" Dim Obs As String = "" - Dim SubTotalTemp = 0.0D + Dim SubTotalTemp As Decimal = 0 'Cargamos los datos del Cliente DtContratos = ObjContratos.DtResultados @@ -24379,7 +24342,7 @@ Partial Class Ventas If Plantilla.Contains("{MES}") Then Dim fecha As DateTime = DateTime.Now Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() Plantilla = Plantilla.ToString().Replace("{MES}", nombreMes) End If @@ -24395,7 +24358,7 @@ Partial Class Ventas If Plantilla.Contains("{MESANTERIOR}") Then Dim fecha As DateTime = DateTime.Now.AddMonths(-1) Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() Plantilla = Plantilla.ToString().Replace("{MESANTERIOR}", nombreMes) End If @@ -24403,7 +24366,7 @@ Partial Class Ventas If Plantilla.Contains("{INICIOMESANTERIOR}") Then Dim fecha As DateTime = DateTime.Now.AddMonths(-1) Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() Dim mesAnterior As String = String.Format("01 {0} {1}", nombreMes, fecha.Year) @@ -24413,9 +24376,9 @@ Partial Class Ventas If Plantilla.Contains("{FINMESANTERIOR}") Then Dim fecha As DateTime = DateTime.Now.AddMonths(-1) Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() - Dim LastDayOfMonth = DateTime.DaysInMonth(fecha.Year, fecha.Month) + Dim LastDayOfMonth As Integer = DateTime.DaysInMonth(fecha.Year, fecha.Month) Dim mesAnterior As String = String.Format("{0} {1} {2}", LastDayOfMonth, nombreMes, fecha.Year) @@ -24448,7 +24411,7 @@ Partial Class Ventas End Sub Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String, FileUrl As String) Dim dt As New DataTable - Dim ErrorArchivo = False + Dim ErrorArchivo As Boolean = False Dim n As Integer = 0 dt = ReadExcelFile(FileUrl, True) If Not ErrorArchivo Then @@ -24585,7 +24548,7 @@ Partial Class Ventas If CvePS > 0 Then If PrecioUnitario <= 0 Then - Dim ObjPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion) + Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion) PrecioUnitario = ObjPrecioSugerido.PrecioSugerido End If @@ -24853,7 +24816,7 @@ Partial Class Ventas Dim Cons As Integer = 1 TmpDT.Clear() - Dim Cantidad = 0.0D, PU = 0.0D, Descuento = 0.0D + Dim Cantidad As Decimal = 0, PU As Decimal = 0, Descuento As Decimal = 0 Dim Filtro As String = "" If ViewState("CveMovimientoDetalle").ToString().ToEntero() > 0 Then Filtro = $"AND CveMovimientoDetalle = {ViewState("CveMovimientoDetalle").ToString().ToEntero()}" @@ -24970,8 +24933,6 @@ Partial Class Ventas DdlClasificacionPS.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=1).FiltraParametros("", Orderby:="Clasificacion") 'DdlTipo.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=1).FiltraParametros("", Orderby:="Clasificacion") End If - - 'BLOQUEA DDL CLASIFICACION If UsuarioActual.Empresa.Funcionalidad(121) = "1" Then If Not UsuarioActual.TienePermisoProceso(147) Then @@ -25151,9 +25112,9 @@ Partial Class Ventas Return True End If - Dim CveMovimientoSalidaConsignacion = -1 - Dim CveMovimientoEntradaGeneral = -1 - Dim CveMovimientoSalidaGeneral = -1 + Dim CveMovimientoSalidaConsignacion As Integer = -1 + Dim CveMovimientoEntradaGeneral As Integer = -1 + Dim CveMovimientoSalidaGeneral As Integer = -1 'MOVIMIENTO DE SALIDA POR TRASPASO DEL ALMACEN DE CONSIGNACION @@ -25267,7 +25228,7 @@ Partial Class Ventas 'FolioVirtualSalida = ObjInventario.Folio For Each RowVirtual As DataRow In dtvirtual.Rows - Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() + Dim CvePS As Integer = RowVirtual("CvePS").ToString().ToEntero() Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble() Dim PU As Decimal = RowVirtual("PU").ToString().ToDecimal() Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() @@ -25314,7 +25275,7 @@ Partial Class Ventas End If End Sub Protected Sub BtnSerieConsignacion_Click(sender As Object, e As EventArgs) - Dim Argumentos = CType(sender, Button).CommandArgument.Split("°"c) + Dim Argumentos As String() = CType(sender, Button).CommandArgument.Split("°"c) CveConsecSerie = Argumentos(0).ToEntero() CvePSSerie = Argumentos(1).ToEntero() @@ -25357,8 +25318,7 @@ Partial Class Ventas Alert("El campo Serie es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub End If - - Dim SeriesArreglo = Serie.Trim.Split(";"c) + Dim SeriesArreglo As String() = Serie.Trim.Split(";"c) 'VALIDACION DE SERIES DUPLICADAS Dim MensajeAlert As New StringBuilder @@ -25370,7 +25330,7 @@ Partial Class Ventas ' Dim dr As DataRow = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CvePS = {0}", CvePSSerie), "PS") Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePSSerie).FiltroPrimero("", "PS") - For Each SerieRow In SeriesArreglo + For Each SerieRow As String In SeriesArreglo SerieRow = SerieRow.ToUpper DtDuplicado = DtContratosSerieDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Serie = '{SerieRow}'") @@ -25391,7 +25351,7 @@ Partial Class Ventas Continue For End If - Dim Row = DtSeriesNuevas.NewRow + Dim Row As DataRow = DtSeriesNuevas.NewRow Row("Serie") = SerieRow DtSeriesNuevas.Rows.Add(Row) Next @@ -25405,10 +25365,10 @@ Partial Class Ventas Dim MensajeSinExistencias As New StringBuilder Dim ObjInventarios As New ClsInventarios - Dim Index = 0 + Dim Index As Integer = 0 - For Each SerieRow In SeriesArreglo - Dim Row = DtContratosSerieDetalle.NewRow + For Each SerieRow As String In SeriesArreglo + Dim Row As DataRow = DtContratosSerieDetalle.NewRow Index = Index + 1 If Index > LbCantidad.Text.ToEntero() And LimitaCantidadSerie = 1 Then @@ -25417,7 +25377,7 @@ Partial Class Ventas End If 'VERIFICA EXISTENCIAS - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=SerieRow) + Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=SerieRow) If Existencia < 1 Then MensajeSinExistencias.Append($"Serie: {SerieRow}.
") Continue For @@ -25468,7 +25428,7 @@ Partial Class Ventas 'MODIFICA CANTIDAD DEL GV CONTRATOS For Each Gvr As GridViewRow In GvContratoDetalles.Rows If Gvr.DataKey("CvePS").ToEntero() = CvePSSerie Then - Dim Contador = DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("CveContratoDetalle"))).Rows.Count + Dim Contador As Integer = DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("CveContratoDetalle"))).Rows.Count Gvr.FCTextBox("TxtCant").Text = Contador.ToString() UPEstimaciones.Update() Exit For @@ -25488,7 +25448,7 @@ Partial Class Ventas '2 = ERROR '3 = SIN CELULAR - PROBLEMA CON EL CELULAR Try - Dim Mensaje = UsuarioActual.Empresa.Funcionalidad(152) + Dim Mensaje As String = UsuarioActual.Empresa.Funcionalidad(152) If Mensaje = "" Then Return 0 Dim Celular As String = "" @@ -25765,7 +25725,7 @@ Partial Class Ventas Dim tempArray() As String tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) If RequiereOC And Not BtnModalClienteDocumentoCancelar.Visible Then - Dim Count = 0 + Dim Count As Integer = 0 For Each GvRow As GridViewRow In GvDocumentosCliente.Rows If GvRow.DataKey("Orden").ToEntero() = 1 Then IndexDocumentoCliente = Count @@ -25933,7 +25893,7 @@ Partial Class Ventas Protected Sub CargarArchivosOC(sender As Object, e As EventArgs) Dim Documentacion As String = "" RegistraScript("$('#DivDocsCliente').modal({ backdrop: 'static', keyboard: false });", "ModalArchivos") - Dim Count = 0 + Dim Count As Integer = 0 For Each GvRow As GridViewRow In GvDocumentosCliente.Rows If GvRow.DataKey("Orden").ToEntero() = 1 Then IndexDocumentoCliente = Count @@ -26340,7 +26300,7 @@ Partial Class Ventas End If Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("EmpresaDireccion", UsuarioActual.Empresa.Direccion)) @@ -26664,9 +26624,9 @@ Partial Class Ventas TxtNCPorcentaje.Attributes.Add("onkeyup", "CalculaImporteNC();") TxtNCImporte.Attributes.Add("onkeyup", "CalculaPorcentajeNC();") - Dim PorcentajeMaximo = 0.0 + Dim PorcentajeMaximo As Decimal = 0 If TxtTotal.Text.ToDouble > 0 Then - PorcentajeMaximo = HplSaldoAuxiliar.Text.ToDouble * 100 / TxtTotal.Text.ToDouble + PorcentajeMaximo = HplSaldoAuxiliar.Text.ToDecimal * 100 / TxtTotal.Text.ToDecimal Else RVNCPorcentaje.MinimumValue = "0" RVTxtNCImporte.MinimumValue = "0" @@ -27030,7 +26990,7 @@ Partial Class Ventas SaldoMaximoUsadosFactura = SaldoMaximoCliente End If - Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado) + Dim SaldoMaximoUtilizable As Decimal = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado) If SaldoMaximoUtilizable > 0 Then HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() @@ -27195,7 +27155,7 @@ Partial Class Ventas SaldoMaximoUsadosFactura = SaldoMaximoCliente End If - Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado) + Dim SaldoMaximoUtilizable As Decimal = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado) If SaldoMaximoUtilizable > 0 Then HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() @@ -27350,7 +27310,7 @@ Partial Class Ventas End If If ListaBon.Count > 0 Then - Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString()) + Dim Bonificaciones As DataRow() = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString()) For Each RowBonificacion As DataRow In Bonificaciones Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero()) @@ -27495,7 +27455,7 @@ Partial Class Ventas Using ObjAcum As New ClsAcumuladores For Each CveVentaRNC As String In ListaVentasRNCCargos If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNC.ToEntero()) Then - Dim DtDist = ObjAcum.DtResultados.Copy() + Dim DtDist As DataTable = ObjAcum.DtResultados.Copy() If DtBon Is Nothing Then DtBon = DtDist.Clone() @@ -27527,7 +27487,7 @@ Partial Class Ventas End If If ListaBon.Count > 0 Then - Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString()) + Dim Bonificaciones As DataRow() = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString()) For Each RowBonificacion As DataRow In Bonificaciones Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero()) @@ -27964,7 +27924,7 @@ Partial Class Ventas PorcentajeIEPS = PorcentajeIEPS - Dim DrSubProyecto = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("") + Dim DrSubProyecto As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("") If DrSubProyecto Is Nothing Then Alert("Ocurrió un error al cargar la información de centro de costos. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError) @@ -28000,10 +27960,10 @@ Partial Class Ventas LimpiaDocumentoNC() End If - Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString().ToEntero() - Dim SubProyecto = DrSubProyecto("SubProyecto").ToString() - Dim CveProyecto = DrSubProyecto("CveProyecto").ToString().ToEntero() - Dim Proyecto = DrSubProyecto("Proyecto").ToString() + Dim CveSubProyecto As Integer = DrSubProyecto("CveSubProyecto").ToString().ToEntero() + Dim SubProyecto As String = DrSubProyecto("SubProyecto").ToString() + Dim CveProyecto As Integer = DrSubProyecto("CveProyecto").ToString().ToEntero() + Dim Proyecto As String = DrSubProyecto("Proyecto").ToString() AplicaNC = True @@ -28029,7 +27989,7 @@ Partial Class Ventas Dim DrBonRef As DataRow = Nothing 'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO' - Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("") + Dim DrPSBonificacion As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("") If DrPSBonificacion IsNot Nothing Then DrBonRef = DrPSBonificacion Else @@ -28094,7 +28054,7 @@ Partial Class Ventas NCBonificacion = ArrayNC(4).ToEntero() End If - Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("") + Dim DrPSBonificacion As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("") If DrPSBonificacion IsNot Nothing Then CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto) Else @@ -28176,7 +28136,7 @@ Partial Class Ventas End Sub Private Sub CrearDTNCCargo(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String) - For Each RNC In ListaNC + For Each RNC As Modelos.Factura In ListaNC Dim UltimoRenglonRNC As Integer = 1 Dim TotalAcumuladoRNC As Decimal = 0 Dim Terminar As Boolean = False @@ -28186,7 +28146,7 @@ Partial Class Ventas Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() Dim CvePSCargo As Integer = RowUsado("CvePS").ToString().ToEntero() - Dim Obs = "" + Dim Obs As String = "" 'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR If ClsPaginas.GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then Obs = RowUsado("CodigoPS").ToString() @@ -28198,15 +28158,15 @@ Partial Class Ventas Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim()) End If - Dim ImportePU = RowUsado("PU").ToString().ToDecimal + Dim ImportePU As Decimal = RowUsado("PU").ToString().ToDecimal Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU) - Dim ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteIEPS = (TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetISR = (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) - Dim ImporteTotal = TotalCalculableImpuestos + Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteIEPS As Decimal = (TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetIVA As Decimal = (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetISR As Decimal = (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) + Dim ImporteTotal As Decimal = TotalCalculableImpuestos TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) @@ -28264,7 +28224,7 @@ Partial Class Ventas Next End Sub Private Sub CrearDTNCCargoDetalle(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String) - For Each RNC In ListaNC + For Each RNC As Modelos.Factura In ListaNC Dim UltimoRenglonRNC As Integer = 1 Dim TotalAcumuladoRNC As Decimal = 0 Dim Terminar As Boolean = False @@ -28274,7 +28234,7 @@ Partial Class Ventas Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() Dim CvePSCargo As Integer = RowUsado("CvePS").ToString().ToEntero() - Dim Obs = "" + Dim Obs As String = "" 'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR If ClsPaginas.GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then Obs = RowUsado("CodigoPS").ToString() @@ -28292,15 +28252,15 @@ Partial Class Ventas Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim()) End If - Dim ImportePU = RowUsado("PU").ToString().ToDecimal + Dim ImportePU As Decimal = RowUsado("PU").ToString().ToDecimal Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU) - Dim ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteIEPS = 0 '(TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetIVA = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetISR = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) - Dim ImporteTotal = TotalCalculableImpuestos + Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteIEPS As Decimal = 0 '(TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetIVA As Decimal = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetISR As Decimal = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) + Dim ImporteTotal As Decimal = TotalCalculableImpuestos TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA) @@ -28364,7 +28324,7 @@ Partial Class Ventas TmpDTDescNCBonificacion = TmpDTNC.Clone() TmpDTDescNCBonificacion.Clear() - For Each RNCBonificacion In ListaNCBonificacion + For Each RNCBonificacion As Modelos.Factura In ListaNCBonificacion Dim UltimoRenglonRNC As Integer = 1 Dim TotalAcumuladoRNC As Decimal = 0 Dim Terminar As Boolean = False @@ -28373,25 +28333,25 @@ Partial Class Ventas For Each RowCargo As DataRow In RNCCargo.DtDetalle.FiltraParametros("", Orderby:="PU").Rows - Dim PorcentajeAplicado = (RNCBonificacion.TotalRemNCAplicado / RNCBonificacion.Total) + Dim PorcentajeAplicado As Decimal = (RNCBonificacion.TotalRemNCAplicado / RNCBonificacion.Total) Dim Cantidad As Decimal = RowCargo("Cantidad").ToString().ToDecimal() '* PorcentajeAplicado - Dim Obs = RowCargo("CodigoPS").ToString() + Dim Obs As String = RowCargo("CodigoPS").ToString() If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim()) End If - Dim ImportePU = RowCargo("PUBonificacion").ToString().ToDecimal + Dim ImportePU As Decimal = RowCargo("PUBonificacion").ToString().ToDecimal Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU) - Dim ImporteIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteIEPS = (TotalCalculableImpuestos * RowCargo("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetISR = (TotalCalculableImpuestos * RowCargo("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) - Dim ImporteTotal = TotalCalculableImpuestos + Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * RowCargo("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteIEPS As Decimal = (TotalCalculableImpuestos * RowCargo("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetIVA As Decimal = (TotalCalculableImpuestos * RowCargo("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetISR As Decimal = (TotalCalculableImpuestos * RowCargo("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) + Dim ImporteTotal As Decimal = TotalCalculableImpuestos TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) @@ -28452,7 +28412,7 @@ Partial Class Ventas TmpDTDescNCBonificacion = TmpDTNC.Clone() TmpDTDescNCBonificacion.Clear() - For Each RNCBonificacion In ListaNCBonificacion + For Each RNCBonificacion As Modelos.Factura In ListaNCBonificacion Dim UltimoRenglonRNC As Integer = 1 Dim TotalAcumuladoRNC As Decimal = 0 Dim Terminar As Boolean = False @@ -28460,16 +28420,16 @@ Partial Class Ventas 'Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNCBonificacion.CveVentaRNCCargo).FirstOrDefault() For Each RowCargo As DataRow In TmpDT.FiltraParametros("EsCargo = True", Orderby:="PU").Rows - Dim CantidadCargo = RowCargo("Cantidad").ToString().ToDecimal() + Dim CantidadCargo As Decimal = RowCargo("Cantidad").ToString().ToDecimal() Dim ImportePU As Decimal = ClsPaginas.GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Bonificacion", $"CvePSCargo={RowCargo("CvePS")}").ToDecimal() Dim TotalCalculableImpuestosCargo As Decimal = (CantidadCargo * ImportePU) Dim TotalCargo As Decimal = TotalCalculableImpuestosCargo + (TotalCalculableImpuestosCargo * RowCargo("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) - Dim PorcentajeAplicado = (RNCBonificacion.TotalRemNCAplicado / TotalCargo) + Dim PorcentajeAplicado As Decimal = (RNCBonificacion.TotalRemNCAplicado / TotalCargo) Dim Cantidad As Decimal = RowCargo("Cantidad").ToString().ToDecimal() * PorcentajeAplicado - Dim Obs = RowCargo("CodigoPS").ToString() + Dim Obs As String = RowCargo("CodigoPS").ToString() If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim()) @@ -28481,11 +28441,11 @@ Partial Class Ventas Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU) - Dim ImporteIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteIEPS = (TotalCalculableImpuestos * RowCargo("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetISR = (TotalCalculableImpuestos * RowCargo("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) - Dim ImporteTotal = TotalCalculableImpuestos + Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * RowCargo("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteIEPS As Decimal = (TotalCalculableImpuestos * RowCargo("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetIVA As Decimal = (TotalCalculableImpuestos * RowCargo("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetISR As Decimal = (TotalCalculableImpuestos * RowCargo("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) + Dim ImporteTotal As Decimal = TotalCalculableImpuestos TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) @@ -28546,7 +28506,7 @@ Partial Class Ventas TmpDTDescNCBonificacion = TmpDTCargo.Clone() TmpDTDescNCBonificacion.Clear() - For Each RNC In ListaNC + For Each RNC As Modelos.Factura In ListaNC Dim UltimoRenglonRNC As Integer = 1 Dim TotalAcumuladoRNC As Decimal = 0 Dim Terminar As Boolean = False @@ -28556,7 +28516,7 @@ Partial Class Ventas Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() Dim CvePSCargo As Integer = RowUsado("CvePS").ToString().ToEntero() - Dim Obs = "" + Dim Obs As String = "" 'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR If ClsPaginas.GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then Obs = RowUsado("CodigoPS").ToString() @@ -28568,15 +28528,15 @@ Partial Class Ventas Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim()) End If - Dim ImportePU = RowUsado("PU").ToString().ToDecimal + Dim ImportePU As Decimal = RowUsado("PU").ToString().ToDecimal Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU) - Dim ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteIEPS = 0 '(TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetIVA = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetISR = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) - Dim ImporteTotal = TotalCalculableImpuestos + Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteIEPS As Decimal = 0 '(TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetIVA As Decimal = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetISR As Decimal = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) + Dim ImporteTotal As Decimal = TotalCalculableImpuestos TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA) @@ -28634,30 +28594,30 @@ Partial Class Ventas End Sub Private Sub CrearDTNCDevolucion(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String) - For Each RNC In ListaNC + For Each RNC As Modelos.Factura In ListaNC Dim UltimoRenglonRNC As Integer = 1 Dim TotalAcumuladoRNC As Decimal = 0 Dim Terminar As Boolean = False For Each RowRNC As DataRow In RNC.DtDetalle.FiltraParametros("", Orderby:="PU").Rows - Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=RowRNC("CvePS").ToString().ToEntero()).FiltroPrimero("") + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=RowRNC("CvePS").ToString().ToEntero()).FiltroPrimero("") Dim Cantidad As Decimal = RowRNC("Cantidad").ToString().ToDecimal() Dim CvePSCargo As Integer = RowRNC("CvePS").ToString().ToEntero() - Dim ImportePU = RowRNC("PU").ToString().ToDecimal + Dim ImportePU As Decimal = RowRNC("PU").ToString().ToDecimal Dim Obs As String = "" Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU) - Dim ImporteIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteIEPS = (TotalCalculableImpuestos * RowRNC("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) - Dim ImporteRetISR = (TotalCalculableImpuestos * RowRNC("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) - Dim ImporteTotal = TotalCalculableImpuestos + Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * RowRNC("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteIEPS As Decimal = (TotalCalculableImpuestos * RowRNC("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetIVA As Decimal = (TotalCalculableImpuestos * RowRNC("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) + Dim ImporteRetISR As Decimal = (TotalCalculableImpuestos * RowRNC("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) + Dim ImporteTotal As Decimal = TotalCalculableImpuestos TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR).RoundSQL @@ -28760,8 +28720,7 @@ Partial Class Ventas End If ObjVentas.Dispose() - - Dim DtImpuestosLocal = TmpDT.FiltraParametros("", "", {"PorcentajeIVA", "PorcentajeRetIVA", "PorcentajeRetISR", "PorcentajeIEPS", "CveSubProyecto"}).Copy() + Dim DtImpuestosLocal As DataTable = TmpDT.FiltraParametros("", "", {"PorcentajeIVA", "PorcentajeRetIVA", "PorcentajeRetISR", "PorcentajeIEPS", "CveSubProyecto"}).Copy() DtImpuestosLocal.Columns.Add("ImportePU", GetType(Decimal)) DtImpuestosLocal.Columns.Add("ImporteTotal", GetType(Decimal)) DtImpuestosLocal.Columns.Add("ImporteIVA", GetType(Decimal)) @@ -28843,7 +28802,7 @@ Partial Class Ventas Next - Dim importeNC = (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) + Dim importeNC As Decimal = (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) If AplicaDescuentos Then importeNC -= DtImpuestosLocal.SUMD("Descuento") @@ -29091,7 +29050,7 @@ Partial Class Ventas End If - Dim Dr = DtVentasNC.NewRow + Dim Dr As DataRow = DtVentasNC.NewRow Dr("CveVenta") = pCveVenta Dr("Importe") = Importe @@ -30016,8 +29975,8 @@ Partial Class Ventas Dim ObjVentas As New ClsVentas Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL()) Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) - Dim OcurrioError = False - Dim MensajeError = "" + Dim OcurrioError As Boolean = False + Dim MensajeError As String = "" Try 'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS @@ -30166,7 +30125,7 @@ Partial Class Ventas ObjVentas.Commit() 'ELIMINA PDF VIEJO - Dim ArchivoPDF = New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}-{3}.pdf", UsuarioActual.Empresa.Ruta, DdlTipoComprobante.SelectedValue, Serie, Folio)) + Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}-{3}.pdf", UsuarioActual.Empresa.Ruta, DdlTipoComprobante.SelectedValue, Serie, Folio)) If ArchivoPDF.Exists Then ArchivoPDF.Delete() End If @@ -31410,7 +31369,7 @@ Partial Class Ventas Exit Sub End If - Dim CveTipoDocto = DdlTipoComprobante.SelectedValue + Dim CveTipoDocto As String = DdlTipoComprobante.SelectedValue DdlTipoComprobante.Items.Clear() DdlTipoComprobante.Items.Insert(0, New ListItem("Ingresos", "Ing")) DdlTipoComprobante.Items.Insert(1, New ListItem("Anticipos", "Ant")) @@ -32340,7 +32299,7 @@ Partial Class Ventas PorcentajeIVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2).ToDecimal For Each Row As DataRow In TmpDT.Rows If PorcentajeIVA > 0 Then - Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=Row("CvePS").ToString().ToEntero()).FiltroPrimero("") + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=Row("CvePS").ToString().ToEntero()).FiltroPrimero("") If DrPS IsNot Nothing Then If DrPS("IVA").ToString().Contiene("-1", "") Then Row("PorcentajeIVA") = PorcentajeIVA @@ -32348,7 +32307,7 @@ Partial Class Ventas Row("PorcentajeIVA") = DrPS("IVA") End If - Dim PU = Row("PU").ToString().ToDecimal().RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos + Dim PU As Decimal = Row("PU").ToString().ToDecimal().RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos Dim TotalCalculableImpuestos As Decimal = (Row("Cantidad").ToString().ToDecimal * PU) - Row("Descuento").ToString().ToDecimal Dim TotalCalculableImpuestosIVA As Decimal = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString().ToDecimal) @@ -32406,8 +32365,8 @@ Partial Class Ventas For Each GvRow As GridViewRow In GvRemisionesNCDetalle.Rows If GvRow.RowType = DataControlRowType.DataRow Then If GvRow.FCCheckBox("ChkAplicar").Checked Then - Dim Rows = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}") - For Each row In Rows + Dim Rows As DataRow() = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}") + For Each row As DataRow In Rows row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray) Next @@ -32526,8 +32485,8 @@ Partial Class Ventas For Each GvRow As GridViewRow In GvRemisionesNCBonDetalle.Rows If GvRow.RowType = DataControlRowType.DataRow Then If GvRow.FCCheckBox("ChkAplicar").Checked Then - Dim Rows = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}") - For Each row In Rows + Dim Rows As DataRow() = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}") + For Each row As DataRow In Rows row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray) Next @@ -32546,7 +32505,7 @@ Partial Class Ventas If GvRow.FCCheckBox("ChkAplicar").Checked AndAlso GvRow.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() Then Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() - Dim PU = GvRow.DataKey("PU").ToDecimal() + Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal() Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal() Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU) @@ -32652,7 +32611,7 @@ Partial Class Ventas Dim CvePSNC As Integer = ArrayNC(3).ToEntero() DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSNC, AplicaParaVenta:=1).FiltroPrimero("") Else - Dim CveSATNC = "84111506" + Dim CveSATNC As String = "84111506" DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0) End If @@ -32688,8 +32647,8 @@ Partial Class Ventas For Each GvRow As GridViewRow In GvDescNCCargosDetalle.Rows If GvRow.RowType = DataControlRowType.DataRow Then If GvRow.FCCheckBox("ChkAplicar").Checked Then - Dim Rows = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}") - For Each row In Rows + Dim Rows As DataRow() = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}") + For Each row As DataRow In Rows If GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() > 0 Then row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() @@ -32707,7 +32666,6 @@ Partial Class Ventas End If Next - If TmpDTRNCDetalleSelecciondas.SUMD("Total") > LblSaldoMaximoUsados.Text.ToDecimal() Then Alert($"El importe no debe exceder el saldo maximo utilizable. Importe:{TmpDTRNCDetalleSelecciondas.SUMD("Total"):N2}", TipoMensaje.MsgAdvertencia) TmpDTRNCDetalleSelecciondas.Clear() @@ -32728,7 +32686,7 @@ Partial Class Ventas Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() If Cantidad > 0 Then - Dim PU = GvRow.DataKey("PU").ToDecimal() + Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal() Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal() Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU) @@ -32808,7 +32766,7 @@ Partial Class Ventas 'SI TIENE ALGUN AJUSTE O GARANTIA If ListaNCDesc.Any(Function(RNC) RNC.Num2 = 1) Then - For Each RNC In ListaNCDesc.Where(Function(x) x.Num2 = 1) + For Each RNC As Modelos.Factura In ListaNCDesc.Where(Function(x) x.Num2 = 1) Dim Salir As Boolean = False Dim NCAjuste As Integer = -1 @@ -32852,8 +32810,8 @@ Partial Class Ventas For Each GvRow As GridViewRow In GvDescNCBonDetalle.Rows If GvRow.RowType = DataControlRowType.DataRow Then If GvRow.FCCheckBox("ChkAplicar").Checked Then - Dim Rows = TmpDTRNCBonificacionDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}") - For Each row In Rows + Dim Rows As DataRow() = TmpDTRNCBonificacionDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}") + For Each row As DataRow In Rows If GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() > 0 Then row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() @@ -32883,7 +32841,7 @@ Partial Class Ventas Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() If Cantidad > 0 Then - Dim PU = GvRow.DataKey("PU").ToDecimal() + Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal() Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal() Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU) @@ -33003,7 +32961,7 @@ Partial Class Ventas LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero LblTotalAPagar.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado - TotalProntoPago).FormatoNumero - Dim CvePS = DrPS("CvePS").ToString().ToEntero() + Dim CvePS As Integer = DrPS("CvePS").ToString().ToEntero() AplicarNC(CvePS, NCDescuento:=True) Catch ex As Exception @@ -33176,9 +33134,9 @@ Partial Class Ventas Try Using wc As New HttpClient() - Dim Url = New Uri("http://polizavirtual.com.mx/webservice/api/Venta") + Dim Url As New Uri("http://polizavirtual.com.mx/webservice/api/Venta") - Dim Parametros = New List(Of KeyValuePair(Of String, String)) + Dim Parametros As New List(Of KeyValuePair(Of String, String)) Parametros.Add(New KeyValuePair(Of String, String)("User", User)) Parametros.Add(New KeyValuePair(Of String, String)("password", Password)) @@ -33215,7 +33173,7 @@ Partial Class Ventas Respuesta = response.Content.ReadAsStringAsync().Result - Dim resp = JArray.Parse(Respuesta) + Dim resp As JArray = JArray.Parse(Respuesta) If resp.Count > 0 Then Dim Msg As New StringBuilder() @@ -33264,7 +33222,7 @@ Partial Class Ventas If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then For Each RowServicio As DataRow In TmpDT.Rows - Dim tClienteRetIVA = ClienteRetIVA + Dim tClienteRetIVA As Decimal = ClienteRetIVA If tClienteRetIVA <= 0 Then If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then tClienteRetIVA = 0.106667D @@ -33282,7 +33240,7 @@ Partial Class Ventas Next TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal().FormatoNumero(2) - Dim PorcentajeRetIVA = (TmpDT.MAX("PorcentajeRetIVA").ToDecimal() * 100) + Dim PorcentajeRetIVA As Decimal = (TmpDT.MAX("PorcentajeRetIVA").ToDecimal() * 100) LblRetIVA.Text = PorcentajeRetIVA.FormatoNumero(2) If PorcentajeRetIVA > 0 Then TrRetIVA.Style.Add("display", "") @@ -33375,12 +33333,12 @@ Partial Class Ventas strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) End If - Dim Url = New Uri(String.Format("{0}/Compras/PopUpVerFactura.aspx?P={1}", strURLHOST, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR={1}", CveVenta, If(Regenerar, "1", "0"))))) + Dim Url As New Uri(String.Format("{0}/Compras/PopUpVerFactura.aspx?P={1}", strURLHOST, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR={1}", CveVenta, If(Regenerar, "1", "0"))))) Dim File As Byte() = Nothing Try - Using httpClient = New HttpClient() + Using httpClient As New HttpClient() httpClient.Timeout = New TimeSpan(0, 2, 0) - Using request = New HttpRequestMessage(HttpMethod.Get, Url) + Using request As New HttpRequestMessage(HttpMethod.Get, Url) request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario={2}", CveEmpresa, DateTime.UtcNow.Ticks, CveUsuarioCreo))) Dim response = httpClient.SendAsync(request).Result If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then @@ -33529,7 +33487,7 @@ Partial Class Ventas ObjVentas.Commit() BtnEditar.Text = "Editar" - Dim Liga = $"document.location.href=""/Ventas/Ventas.aspx?CveVenta={Me.CveVenta}"";" + Dim Liga As String = $"document.location.href=""/Ventas/Ventas.aspx?CveVenta={Me.CveVenta}"";" Alert("La venta se actualizó correctamente", TipoMensaje.MsgInformacion, Liga, TextoConfirmacion:="Aceptar", TextoSegundoBoton:=Nothing, JSBtn2:=Nothing, ShowCloseButton:=False) UpParametros.Update() @@ -33848,7 +33806,7 @@ Partial Class Ventas ObjFacturaProntoPago.Entrega = "" ObjFacturaProntoPago.CveAlmacen = -1 - Dim DtVentasNC = InicializaDTVentasNCProntoPago() + Dim DtVentasNC As DataTable = InicializaDTVentasNCProntoPago() Dim TotalImporte As Decimal = ObjFacturaProntoPago.DtDetalle.SUMD("TotalImporte") Dim ImporteIVA As Decimal = ObjFacturaProntoPago.DtDetalle.SUMD("ImporteIVA") @@ -33871,7 +33829,7 @@ Partial Class Ventas ObjFacturaProntoPago.Total = Total ObjFacturaProntoPago.TotalOtrosConceptos = 0 - Dim Drt = DtVentasNC.NewRow + Dim Drt As DataRow = DtVentasNC.NewRow Drt("CveVenta") = ObjFactura.CveVenta Drt("Importe") = ObjFactura.DescuentoProntoPago Drt("FolioFiscal") = ObjFactura.FolioFiscal @@ -33994,9 +33952,9 @@ Partial Class Ventas Dim Cantidad As Decimal = 1 Dim CveProyecto As Integer = DrSubProyecto("CveProyecto").ToString().ToEntero() - Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString.ToEntero - Dim SubProyecto = DrSubProyecto("SubProyecto").ToString - Dim Proyecto = DrSubProyecto("Proyecto").ToString + Dim CveSubProyecto As Integer = DrSubProyecto("CveSubProyecto").ToString.ToEntero + Dim SubProyecto As String = DrSubProyecto("SubProyecto").ToString + Dim Proyecto As String = DrSubProyecto("Proyecto").ToString Dim CveSATNC As Integer Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray()) @@ -34004,7 +33962,7 @@ Partial Class Ventas If ArrayNC.Length > 6 Then 'CONCEPTO DE PRONTO PAGO CveSATNC = ArrayNC(6).ToEntero() End If - Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveSATNC, AplicaParaVenta:=1).FiltroPrimero("") + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveSATNC, AplicaParaVenta:=1).FiltroPrimero("") For Each Dr As DataRow In DtImpuestos.Rows AgregaTempDTNCProntoPago(ObjFacturaDevolucion.DtDetalle, DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero, @@ -34038,7 +33996,7 @@ Partial Class Ventas End If ObjVentas.Dispose() - Dim DtImpuestosLocal = TmpDT.FiltraParametros("", "", {"PorcentajeIVA", "PorcentajeRetIVA", "PorcentajeRetISR", "PorcentajeIEPS", "CveSubProyecto"}).Copy + Dim DtImpuestosLocal As DataTable = TmpDT.FiltraParametros("", "", {"PorcentajeIVA", "PorcentajeRetIVA", "PorcentajeRetISR", "PorcentajeIEPS", "CveSubProyecto"}).Copy DtImpuestosLocal.Columns.Add("ImportePU", GetType(Decimal)) DtImpuestosLocal.Columns.Add("ImporteTotal", GetType(Decimal)) DtImpuestosLocal.Columns.Add("ImporteIVA", GetType(Decimal)) @@ -34104,7 +34062,7 @@ Partial Class Ventas End Function Protected Function CreaDTDetalleNCProntoPago() As DataTable - Dim TmpDT = New DataTable + Dim TmpDT As New DataTable TmpDT.Columns.Add("CveVenta", GetType(Integer)) TmpDT.Columns.Add("Consec", GetType(Integer)) TmpDT.Columns.Add("Cantidad", GetType(Decimal)) @@ -34196,7 +34154,7 @@ Partial Class Ventas Return TmpDT End Function Private Function InicializaDTVentasNCProntoPago() As DataTable - Dim DtVentasNC = New DataTable + Dim DtVentasNC As New DataTable DtVentasNC.Columns.Add("CveVenta", GetType(Integer)) DtVentasNC.Columns.Add("Importe", GetType(Decimal)) DtVentasNC.Columns.Add("FolioFiscal", GetType(String)) @@ -35246,7 +35204,7 @@ Partial Class Ventas If UsuarioActual.CveEmpresa.Contiene(1) Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPorcentajeProductos(CveCliente) Then - Dim PrecioAplicado = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDecimal + Dim PrecioAplicado As Decimal = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDecimal If PrecioAplicado > 0 Then PrecioSugerido = PrecioAplicado End If @@ -35292,7 +35250,7 @@ Partial Class Ventas If PrecioSugerido = 0 Then Dim ObjInventarios As New ClsInventarios - Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidadMercancia.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) + Dim CostoPS As Decimal = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidadMercancia.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidadMercancia.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1) ObjInventarios.Dispose() @@ -35325,12 +35283,12 @@ Partial Class Ventas Protected Sub LnkUUIDRelacionados_Click(sender As Object, e As EventArgs) - Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, LblRFC.Text, TxtTotal.Text, True) + Dim Vigencia As Timbrado.AcuseCancelacionSAT = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, LblRFC.Text, TxtTotal.Text, True) Dim sb As New StringBuilder sb.AppendFormat("{0}
", Vigencia.EsCancelable) - Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) + Dim Relacionados As Timbrado.MRespUUIDRelacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) If Relacionados IsNot Nothing Then Dim sbExtra As New StringBuilder() If Relacionados.Codigo = 500 Then @@ -35338,11 +35296,11 @@ Partial Class Ventas Else sbExtra.Append(Relacionados.Mensaje) - Dim SbHijos = New StringBuilder() - Dim SbPadres = New StringBuilder() + Dim SbHijos As New StringBuilder() + Dim SbPadres As New StringBuilder() If Relacionados.RelacionadosPadre IsNot Nothing Then - For Each padre In Relacionados.RelacionadosPadre + For Each padre As Timbrado.RelacionadosPadre In Relacionados.RelacionadosPadre SbPadres.AppendFormat("{0};", padre.Uuid) Next If SbPadres.Length > 0 Then @@ -35512,7 +35470,7 @@ Partial Class Ventas 'VERIFICA QUE LA CATEGORIA DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL If TmpDT IsNot Nothing AndAlso Me.CveCategoriaLineaAdicional > 0 Then For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion"}).Rows - Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("") + Dim RowClasificacion As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("") If RowClasificacion IsNot Nothing Then Dim CveCategoria As Integer = RowClasificacion("CveCategoria").ToString().ToEntero() @@ -35647,7 +35605,7 @@ Partial Class Ventas If DivPrecioLista.Visible AndAlso DdlPrecioLista.SelectedValue.ToEntero() > 0 Then Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero()).FiltroPrimero("") - Dim ObjPrecioSugerido = CalculaPrecioSugerido(drPS("CvePS").ToString().ToEntero(), drPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=DdlPrecioLista.SelectedValue.ToEntero()) + Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(drPS("CvePS").ToString().ToEntero(), drPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=DdlPrecioLista.SelectedValue.ToEntero()) If ObjPrecioSugerido.PrecioSugerido > 0 Then TxtPrecio.Text = ObjPrecioSugerido.PrecioSugerido.ToString("#,###.####")