diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 13fde3fbe..c68979dc6 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -2275,7 +2275,7 @@ Public Class ClsContabilidad - Public Function GetDiarioPagosCompras(CveProveedor As Integer, FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveCuenta As Integer, CveTipoTransaccion As Integer, CveEmpresa As Integer) As DataSet + Public Function GetDiarioPagosCompras(CveProveedor As Integer, FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveCuenta As Integer, CveTipoTransaccion As Integer, CveEmpresa As Integer, Optional CvePersonal As Integer = -1) As DataSet Dim Retorno As New DataSet DataAdapter("PA_Conta_DiarioPagosComprasGet33") @@ -2287,6 +2287,7 @@ Public Class ClsContabilidad .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal End With Try diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 123eec236..32eda4c1c 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -317,26 +317,23 @@ Public Class ClsMovimientos Return Retorno End Function - Public Function GetCxCDetalle(FechaI As String, FechaF As String, CveCliente As Integer, CveSubProyecto As Integer, CveVendedor As Integer, CveUsuario As Integer, Anio As Integer, Mes As Integer, + Public Function GetCxCDetalle(FechaInicio As Date, FechaFin As Date, CveCliente As Integer, CveSubProyecto As Integer, CveVendedor As Integer, CveUsuario As Integer, Anio As Integer, Mes As Integer, AnioMes As String, Fecha As String, CveClienteSucursal As Integer, Opcion As String, CveEstatus As Integer, IVA As String, Agrupador As Integer, CveEmpresa As Integer, CveResponsable As Integer, TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional TipoDocto As String = "-1", - Optional FechaVI As String = "-1", Optional FechaVF As String = "1", Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1, + Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1, Optional CveCobranzaEstatus As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional LimiteCredito As Decimal = -1, Optional TipoCliente As Integer = -1, Optional CveMoneda As Integer = -1, Optional EstatusCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1, Optional TieneLineaAdicional As Integer = -1, Optional CveContrato As Integer = -1) As Boolean Dim Retorno As Boolean = False - DS = New DataSet - 'Data = New DataTable - 'SqlAdapter = New SqlDataAdapter("PA_RepCxCDetalle", SqlConexion) - 'SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure - + DS = New DataSet + DataAdapter("PA_RepCxCDetalle") With SqlAdapter.SelectCommand.Parameters '.Add("@CveVenta", SqlDbType.Int).Value = CveVenta - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveVendedor", SqlDbType.VarChar).Value = CveVendedor diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index bcc544f2b..ca1a663a7 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -9342,7 +9342,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/RepVentasUtilidad.aspx".ToUpper(), 590) PaginaDict.Add("/Ventas/RepVentasUtilidadDetalle.aspx".ToUpper(), 590) PaginaDict.Add("/Ventas/PV.aspx".ToUpper(), 163) - PaginaDict.Add("/Ventas/PVRene.aspx".ToUpper(), 163) + PaginaDict.Add("/Ventas/PVCobranza.aspx".ToUpper(), 319) PaginaDict.Add("/Ventas/Corporativo.aspx".ToUpper(), 807) PaginaDict.Add("/Ventas/RepRecuperacion.aspx".ToUpper(), 88) PaginaDict.Add("/Ventas/RepRecuperacionDetalle.aspx".ToUpper(), 88) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index eee002123..286a10cb5 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -5,7 +5,6 @@ Imports System.Data Imports System.IO Imports System.Net.Http Imports System.Xml -Imports DocumentFormat.OpenXml.VariantTypes Imports Extensiones Imports Microsoft.Reporting.WebForms @@ -7557,7 +7556,7 @@ Namespace Modelos Public Property ClaveUsoCFDI As String = "" Public Property CveTipoRelacion As Integer = -1 Public Property CveEstatusFactura As Integer - Public Property CveVendedor As Integer + Public Property CveVendedor As Integer = 0 Public Property VendedorCodigo As String = "" Public Property CveSucursalEjecucion As Integer Public Property FechaEjecucion As Date @@ -7572,7 +7571,7 @@ Namespace Modelos Public Property Entrega As String = "" Public Property TiempoEntrega As String = "" Public Property Vigencia As Date - Public Property TipoEstatus As Integer + Public Property TipoEstatus As Integer = 0 Public Property CveCondicionEntrega As Integer = -1 Public Property CondicionEntrega As String = "" diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index f0f2001cf..7ca31a268 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -326,7 +326,7 @@ Namespace Extensiones Public Sub GuardaLogAD(Mensaje As String, Optional Archivo As String = "Log") Dim ArchivoW As StreamWriter - Dim MensajeFormato = String.Format("{0}{1}Log: {2} | Fecha:{3}", Chr(13), Chr(10), Mensaje, ClsPaginas.NowADS().ToString("dd/MM/yyyy HH:mm")) + Dim MensajeFormato As String = String.Format("{0}{1}Log: {2} | Fecha:{3}", Chr(13), Chr(10), Mensaje, ClsPaginas.NowADS().ToString("dd/MM/yyyy HH:mm")) Try ArchivoW = New StreamWriter(String.Format("{0}\Log\{1}.txt", AppDomain.CurrentDomain.BaseDirectory, Archivo), True, System.Text.Encoding.UTF8) @@ -2893,7 +2893,7 @@ Namespace Extensiones 'CUERPO (TABLAS DEL REPORTE) 'Se tiene que convertir la salida en elementos y posteriormente agregarlos al documento para que se respeten los márgenes - Dim els = HtmlConverter.ConvertToElements(sw.ToString(), properties) + Dim els As IList(Of Element.IElement) = HtmlConverter.ConvertToElements(sw.ToString(), properties) For Each el As Element.IBlockElement In els document.Add(el) Next @@ -3867,19 +3867,19 @@ Namespace Extensiones End Sub Public Overrides Sub OnAuthorization(ByVal actionContext As HttpActionContext) - Dim authHeader = actionContext.Request.Headers.Authorization + Dim authHeader As Headers.AuthenticationHeaderValue = actionContext.Request.Headers.Authorization Dim noautorizado As Boolean = True If authHeader IsNot Nothing Then If Left(actionContext.Request.RequestUri.AbsolutePath, 11).ToUpper() = SigfoxPath.ToUpper() Then - Dim usernamePasswordArray = Encoding.UTF8.GetString(Convert.FromBase64String(authHeader.Parameter)).Split(":"c) - Dim userName = usernamePasswordArray(0) - Dim password = usernamePasswordArray(1) + Dim usernamePasswordArray As String() = Encoding.UTF8.GetString(Convert.FromBase64String(authHeader.Parameter)).Split(":"c) + Dim userName As String = usernamePasswordArray(0) + Dim password As String = usernamePasswordArray(1) noautorizado = Not (userName = Me.Usuario AndAlso password = Me.Contra) Else Try If actionContext.Request.RequestUri.AbsolutePath.ToUpper() <> LoginPath.ToUpper() Then - Dim dataArray = Extensiones.Decripta(authHeader.Parameter).Split("|"c) + Dim dataArray As String() = Extensiones.Decripta(authHeader.Parameter).Split("|"c) If dataArray.Length > 4 AndAlso IsNumeric(dataArray(0)) AndAlso IsNumeric(dataArray(1)) AndAlso IsNumeric(dataArray(4)) Then Dim CveUsuario As Integer = dataArray(0).ToEntero() diff --git a/Ashx/E119.ashx b/Ashx/E119.ashx index 24e9e93bf..addea2096 100644 --- a/Ashx/E119.ashx +++ b/Ashx/E119.ashx @@ -444,8 +444,14 @@ Public Class E119 : Implements IHttpHandler Resp = ObjFactura.EmitirFactura(False, Transac:=ObjClientes.IniciaTransacSQL()) If Resp.CveVenta > 0 Then + Dim data As New JArray + Dim objSucursal As New JObject( + New JProperty("Cve", Resp.CveVenta), + New JProperty("SerieFolio", Resp.SerieFolio) + ) + data.Add(objSucursal) Respuesta.status = "success" - Respuesta.data = Resp.SerieFolio + Respuesta.data = data Else TieneError = True End If diff --git a/Bancos/IE.aspx b/Bancos/IE.aspx index 9106c2511..544262f6e 100644 --- a/Bancos/IE.aspx +++ b/Bancos/IE.aspx @@ -247,10 +247,8 @@ - -
diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 81155906e..150540823 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -606,7 +606,6 @@ Partial Class Bancos_IE CargaTipoTransaccion() CargaCuenta() - CargaDDLPersonal() DdlProveedores.setEsWebService(True) DdlProveedores.Attributes.Add("data-metodo", "getproveedores") @@ -628,11 +627,9 @@ Partial Class Bancos_IE If Request("CveProveedor") IsNot Nothing AndAlso IsNumeric(Request("CveProveedor")) AndAlso Request("CveProveedor").ToEntero > 0 Then CveProveedor = Request("CveProveedor").ToEntero - CargaProveedor(CveProveedor, "-1") End If - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion") = "DevDinC" AndAlso Request("CveProveedor") IsNot Nothing AndAlso IsNumeric(Request("CveProveedor")) AndAlso Request("CveProveedor").ToEntero > 0 Then If Masivonotas Then 'CargaNotas() @@ -719,7 +716,6 @@ Partial Class Bancos_IE DdlProveedores.Enabled = False DdlPersonal.Visible = False - CargaDatos() BtnGuardar.Visible = False @@ -784,8 +780,6 @@ Partial Class Bancos_IE 'End If - - DdlMotivoCancelacion.DataSource = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltraParametros("CveSATMotivoCancelacion IN (2,3)") DdlMotivoCancelacion.DataBind() DdlMotivoCancelacion.Items.Insert(0, New ListItem("Seleccione uno", "-1")) @@ -794,7 +788,6 @@ Partial Class Bancos_IE DvFolioACCondiciones.Visible = True End If - If UsuarioActual.CveEmpresa.Contiene(13, 1) Then TRImporteDeduccionesPago.Visible = True End If @@ -816,7 +809,6 @@ Partial Class Bancos_IE End Try - CveIEDeposito = ObjIE.DtResultados(0)("CveIEDepositoPadre").ToString.ToEntero CuentaDepositoPadre = ObjIE.DtResultados(0)("CuentaDepositoPadre").ToString Cuenta = ObjIE.DtResultados(0)("NumCuenta").ToString @@ -1404,15 +1396,7 @@ Partial Class Bancos_IE DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) DdlPersonal.DataBind() DdlPersonal.Items.Insert(0, New ListItem("Seleccione Personal", "-1")) - 'Dim ObjPersonal As New ClsRH - 'If ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa) Then - ' If ObjPersonal.DtResultados.Rows.Count > 0 Then - ' DdlPersonal.DataSource = ObjPersonal.DtResultados - ' DdlPersonal.DataBind() - ' DdlPersonal.Items.Insert(0, New ListItem("Seleccione Personal", "-1")) - ' End If - 'End If - 'ObjPersonal.Dispose() + End Sub Protected Sub DdlPersonal_SelectedIndexChanged(sender As Object, e As EventArgs) @@ -3601,7 +3585,7 @@ Partial Class Bancos_IE ChkAplicaViatico.Visible = False If RBL.SelectedValue = "FE" Then If UsuarioActual.CveRol = 1 Then ChkAplicaViatico.Visible = True - + If DdlPersonal.Items.Count = 0 Then CargaDDLPersonal() DdlPersonal.Visible = True DdlProveedores.Visible = False DdlCliente.Visible = False @@ -4301,24 +4285,16 @@ Partial Class Bancos_IE If Not ErrorCompra Then If ObjAC IsNot Nothing Then ObjAC.Commit() - If Banc.ExisteConexion Then Banc.Commit() Alert($"El documento bancario quedó eliminado. {MsgEliminar}", TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") End If - Else - Alert($"El documento no ha sido eliminado. {If(UsuarioActual.CveRol = 1, MsgEliminar, "")}", TipoMensaje.MsgAdvertencia) - If ObjAC IsNot Nothing Then ObjAC.RollBack() - If Banc.ExisteConexion Then Banc.RollBack() - - End If - End If If ObjAC IsNot Nothing Then ObjAC.Dispose() diff --git a/Bancos/Transferencias.aspx b/Bancos/Transferencias.aspx index 80800329a..02e1234d8 100644 --- a/Bancos/Transferencias.aspx +++ b/Bancos/Transferencias.aspx @@ -53,10 +53,10 @@ - + Cuenta Destino: - + @@ -182,7 +182,7 @@ - + <%-- @@ -192,7 +192,7 @@ --%> - + diff --git a/Bancos/Transferencias.aspx.vb b/Bancos/Transferencias.aspx.vb index 7134865b9..bcfdd3191 100644 --- a/Bancos/Transferencias.aspx.vb +++ b/Bancos/Transferencias.aspx.vb @@ -60,12 +60,13 @@ Partial Class Bancos_Transferencias If Opcion = 1 Then LtlTitulo.Text = "Domicialización de tarjeta" RBLOpcion.Visible = True - TrCuentaOrigen.Visible = False + TrCuentaDestino.Visible = False chkMovimientoTarjeta.Checked = True chkMovimientoTarjeta.Enabled = False + CargaCuenta(-1, DdlCuentaOrigen) chkMovimientoTarjeta_CheckedChanged(Nothing, Nothing) - CargaCuenta(-1, DdlCuentaDestino) - CargaFolio(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) + + 'CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) Else CargaCuenta(-1, DdlCuentaOrigen) CargaCuenta(DdlCuentaOrigen.SelectedValue.ToEntero, DdlCuentaDestino) @@ -89,7 +90,7 @@ Partial Class Bancos_Transferencias End If Ddl.DataBind() - DdlCuentaDestino_SelectedIndexChanged(Nothing, Nothing) + 'DdlCuentaDestino_SelectedIndexChanged(Nothing, Nothing) If CveCuenta > 0 Then VerificaMonedas() @@ -155,43 +156,41 @@ Partial Class Bancos_Transferencias End Sub - Protected Sub DdlCuentaDestino_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuentaDestino.SelectedIndexChanged + 'Protected Sub DdlCuentaDestino_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuentaDestino.SelectedIndexChanged - VerificaMonedas() + ' VerificaMonedas() - If Opcion = 1 Then - CargaFolio(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) - End If + ' If Opcion = 1 Then + ' CargaFolio(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) + ' End If - If chkMovimientoTarjeta.Checked AndAlso GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveCuenta = {0} AND UsaTarjeta = 1", DdlCuentaDestino.SelectedValue.ToEntero)).Rows.Count > 0 Then - CargaGridTarjetas() - Else - GvTC.Visible = False - End If + ' If chkMovimientoTarjeta.Checked AndAlso GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveCuenta = {0} AND UsaTarjeta = 1", DdlCuentaDestino.SelectedValue.ToEntero)).Rows.Count > 0 Then + ' CargaGridTarjetas() + ' Else + ' GvTC.Visible = False + ' End If - End Sub + 'End Sub Private Sub CargaGridTarjetas() Dim ObjCreditos As New ClsBancos - If ObjCreditos.GetTarjetasCreditos(DdlCuentaDestino.SelectedValue.ToEntero) Then + If ObjCreditos.GetTarjetasCreditos(DdlCuentaOrigen.SelectedValue.ToEntero) Then If ObjCreditos.DtResultados.Rows.Count > 0 Then GvTC.DataSource = ObjCreditos.DtResultados + GvTC.Visible = True End If - - GvTC.DataBind() UpGvTC.Update() - - GvTC.Visible = True End If ObjCreditos.Dispose() + GvTC.DataBind() End Sub Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click 'VALIDACIONES Dim SumaImportesTarjeta As Decimal = 0D - If GvTC.Visible Then + If GvTC.Visible AndAlso GvTC.Rows.Count > 0 Then For Each row As GridViewRow In GvTC.Rows SumaImportesTarjeta += row.FCTextBox("TxtAbono").Text.ToDecimal Next @@ -202,8 +201,8 @@ Partial Class Bancos_Transferencias End If End If - If DdlCuentaDestino.SelectedValue = "" Then - Alert("Seleccione cuenta destino", TipoMensaje.MsgAdvertencia) + If DdlCuentaOrigen.SelectedValue = "" Then + Alert("Seleccione cuenta origen", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -225,8 +224,7 @@ Partial Class Bancos_Transferencias Dim ObjIE As New ClsBancos() Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) - 'Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL) - Dim TipoCambio As Double = If(TxtTipoCambio.Visible, TxtTipoCambio.Text.ToDecimal, 0) + Dim TipoCambio As Double = If(TxtTipoCambio.Visible, TxtTipoCambio.Text.ToDecimal, 1) Dim CveMonedaOrigen, CveMonedaDestino As Integer Dim FolioOrigen As String = TxtFolio.Text.Trim Dim FolioDestino As String = GetFolio(DdlCuentaDestino.SelectedValue.ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3)) @@ -246,15 +244,14 @@ Partial Class Bancos_Transferencias filemove = fileItem.filename Next - - dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaDestino.SelectedValue)) - If dr IsNot Nothing Then CveMonedaDestino = dr("CveMoneda").ToString.ToEntero + dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaOrigen.SelectedValue)) + If dr IsNot Nothing Then CveMonedaOrigen = dr("CveMoneda").ToString.ToEntero If Opcion = -1 Then - dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaOrigen.SelectedValue)) - If dr IsNot Nothing Then CveMonedaOrigen = dr("CveMoneda").ToString.ToEntero + dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaDestino.SelectedValue)) + If dr IsNot Nothing Then CveMonedaDestino = dr("CveMoneda").ToString.ToEntero Else - CveMonedaOrigen = CveMonedaDestino + CveMonedaDestino = CveMonedaOrigen End If If CveMonedaOrigen = 1 AndAlso CveMonedaDestino <> 1 Then @@ -275,21 +272,18 @@ Partial Class Bancos_Transferencias If CveMonedaOrigen = 2 AndAlso CveMonedaDestino = 2 Then TipoCambio = TxtTipoCambio.Text.ToDouble 'GlobalTipoCambio(TxtFechaDocumento.Text.ToDate) End If - - Dim CvePrePoliza As Integer = ObjMov.AddPrePolizas("Bancos/Transferencias", 13, TxtImporte.Text.Trim.ToDouble, TxtImporte.Text.Trim.ToDouble, CveMonedaOrigen, TxtFechaDocumento.Text.ToDate, $"Transferencia entre cuentas {TxtObservaciones.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If UsuarioActual.CveEmpresa = 48 Then CuentaDestino = "Alumbrado publico de Hermosillo S.A de C.V" Observaciones = String.Format("{0} {1}", DdlCuentaDestino.SelectedItem.Text, TxtObservaciones.Text.Trim) Else - CuentaDestino = String.Format("Transferencia Cta: {0}", DdlCuentaDestino.SelectedItem.Text) + CuentaDestino = String.Format("Transferencia Cta: {0}", If(DdlCuentaDestino.SelectedItem IsNot Nothing, DdlCuentaDestino.SelectedItem.Text, "")) Observaciones = TxtObservaciones.Text.Trim End If - If Opcion = 1 Then 'ESTO ES TRANSFERENCIA ENTRE - CveIE = ObjIE.AddBancos_IE(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, CuentaDestino, ImporteMXOrigen, CveMonedaOrigen, TipoCambio, Observaciones, "", False, False, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + CveIE = ObjIE.AddBancos_IE(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, CuentaDestino, ImporteMXOrigen, CveMonedaOrigen, TipoCambio, Observaciones, "", False, False, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CveIEDestino = CveIE Else @@ -321,19 +315,10 @@ Partial Class Bancos_Transferencias If (CveIE > 0 AndAlso CveIEDestino > 0 Or CveIE > 0 AndAlso chkMovimientoTarjeta.Checked AndAlso SumaImportesTarjeta <> 0) Then - If filemove <> "" Then - filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) - End If - 'inserto los movimientos de la conta para abonar al saldo If MsgError = "" Then If CvePrePoliza > 0 Then - - Dim alertaContabilizacion As String = "Se envió correctamente la siguiente póliza:

" - Dim CuentasContablesInvalidas As New StringBuilder - Dim RowCuentaOrigen As DataRow = Nothing - Dim TipoMovtoDetalle As Boolean = True If RBLOpcion.SelectedValue = "2" Then TipoMovtoDetalle = False ' cuando sea un reembolso/devolución, es ingreso a bancos Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal @@ -354,7 +339,6 @@ Partial Class Bancos_Transferencias TipoCambio:=TC) Then MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If - End If 'Agregamos los Movimientos de Acreedor cuando es tarjeta @@ -365,13 +349,12 @@ Partial Class Bancos_Transferencias For Each row As GridViewRow In GvTC.Rows If row.FCTextBox("TxtAbono").Text.ToDecimal > 0 Then - FolioDestino = GetFolio(row.DataKey("CveCuenta").ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3), TransaccioSQL:=ObjIE.IniciaTransacSQL()) + FolioDestino = GetFolio(row.DataKey("CveCuenta").ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3), TransaccionSQL:=ObjIE.IniciaTransacSQL()) If FolioDestino.Trim.Length = 0 Then MsgError = "Ocurrio un error al obtener el folio destino." Exit For End If - Dim PagueseA As String = $"Transferencia Cta: {If(DdlCuentaOrigen.SelectedItem Is Nothing, DdlCuentaDestino.SelectedItem.Text, DdlCuentaOrigen.SelectedItem.Text)}" CveIEDestino = ObjIE.AddBancos_IE(row.DataKey("CveCuenta").ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3), TxtFechaDocumento.Text.Trim.ToDate, FolioDestino, PagueseA, row.FCTextBox("TxtAbono").Text.ToDecimal, CveMonedaDestino, TipoCambio, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) @@ -385,9 +368,6 @@ Partial Class Bancos_Transferencias AlertaGlobal.AppendFormat("{1}
", CveIEDestino, FolioDestino) End If End If - - - Next 'Agregamos la contraria a bancos cuando es cuenta @@ -408,7 +388,6 @@ Partial Class Bancos_Transferencias ImporteME:=ImporteDestino, TipoCambio:=TC) Then MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If - End If End If @@ -424,22 +403,15 @@ Partial Class Bancos_Transferencias End If If MsgError = "" Then - If CveIE > 0 Then AlertaGlobal.AppendFormat("

Movimiento: {1}", CveIE, FolioOrigen) End If If CveIEDestino > 0 AndAlso CveIE <> CveIEDestino Then - If Not chkMovimientoTarjeta.Checked Then AlertaGlobal.AppendFormat("

Recepción: {1}", CveIEDestino, FolioDestino) End If - - End If - Else - MsgError = "no se pudo insertar el detalle de la póliza2" End If - Else MsgError = "no se pudo insertar el detalle de la póliza" End If @@ -454,13 +426,11 @@ Partial Class Bancos_Transferencias MsgError = "Error al guardar" End If - - - - - If MsgError = "" Then ObjIE.Commit() + If filemove <> "" Then + filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) + End If Alert(String.Format("El Movimiento se realizo correctamente.
{0}", AlertaGlobal), TipoMensaje.MsgInformacion) Anexo.Text = "" 'Enviar Correo a los usuarios que tienen acceso a las dos cuentas @@ -470,10 +440,7 @@ Partial Class Bancos_Transferencias CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) TxtImporte.Text = "" TxtObservaciones.Text = "" - - GeneraChequePDF(CveIEDestino, UsuarioActual.Empresa) - - + 'GeneraChequePDF(CveIEDestino, UsuarioActual.Empresa) Else ObjIE.RollBack() Alert(MsgError) @@ -481,7 +448,7 @@ Partial Class Bancos_Transferencias ObjIE.Dispose() ObjMov.Dispose() - 'If ObjComp IsNot Nothing Then ObjComp.Dispose() + End Sub Private Sub EnviaCorreo(Comprobante As String) @@ -607,24 +574,21 @@ Partial Class Bancos_Transferencias TxtFolio.Text = GetFolio(CveCuenta, CveTipoTransaccion) End Sub - Private Function GetFolio(CveCuenta As Integer, CveTipoTransaccion As Integer, Optional ByRef TransaccioSQL As SqlTransaction = Nothing) As String + Private Function GetFolio(CveCuenta As Integer, CveTipoTransaccion As Integer, Optional ByRef TransaccionSQL As SqlTransaction = Nothing) As String Dim Folio As String Dim Banco As ClsBancos - If TransaccioSQL Is Nothing Then + If TransaccionSQL Is Nothing Then Banco = New ClsBancos Else - Banco = New ClsBancos(TransaccioSQL) + Banco = New ClsBancos(TransaccionSQL) End If - Folio = Banco.GetNextFolio(CveCuenta, CveTipoTransaccion).ToString - If TransaccioSQL Is Nothing Then + If TransaccionSQL Is Nothing Then Banco.Dispose() End If - - Return Folio End Function @@ -644,18 +608,13 @@ Partial Class Bancos_Transferencias Private Sub DdlTipoMovto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoMovto.SelectedIndexChanged RFVTxtPaguese.Visible = False + CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) - If Opcion = 1 Then - CargaFolio(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) - Else - CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) - + If Not Opcion = 1 Then If DdlTipoMovto.SelectedValue.ToEntero = 1 And Opcion <> 1 Then 'CHEQUE ACTIVA EL REQUIRED DE TxtPaguese RFVTxtPaguese.Visible = True End If - End If - UPPDatos.Update() End Sub diff --git a/Contratos/Contrato.aspx.vb b/Contratos/Contrato.aspx.vb index 63649550f..1f9e235c0 100644 --- a/Contratos/Contrato.aspx.vb +++ b/Contratos/Contrato.aspx.vb @@ -590,8 +590,8 @@ Partial Class Contratos_Default 'TabContratosGastos.Visible = False 'DONDE OCUPA ALMACEN - Dim CveTipoAlmacenOrigen = "12,15" - Dim CveTipoAlmacenDestino = "11,12" + Dim CveTipoAlmacenOrigen As String = "12,15" + Dim CveTipoAlmacenDestino As String = "11,12" If TipoContrato.Contiene({7, 9, 13, 16, 18, 21, 27}) Then RowAlmacen.Visible = True If TipoContrato.Contiene(7, 9, 13, 21, 27) Then @@ -603,7 +603,7 @@ Partial Class Contratos_Default End If End If - Dim CveOrigen = DdlAlmacenOrigen.SelectedValue + Dim CveOrigen As String = DdlAlmacenOrigen.SelectedValue DdlAlmacenOrigen.Items.Clear() DdlAlmacenOrigen.SelectedValue = "-1" DdlAlmacenOrigen.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -616,7 +616,7 @@ Partial Class Contratos_Default DdlAlmacenOrigen.SelectedValueExist(CveOrigen) End If - Dim CveDestino = DdlAlmacenDestino.SelectedValue + Dim CveDestino As String = DdlAlmacenDestino.SelectedValue DdlAlmacenDestino.Items.Clear() DdlAlmacenDestino.SelectedValue = "-1" DdlAlmacenDestino.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -935,7 +935,7 @@ Partial Class Contratos_Default #Region " CARGA DATOS " Private Sub CargaDatos() Dim ObjContratos As New ClsContratos() - Dim Ruta = Request.ApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" + Dim Ruta As String = Request.ApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" DivTipoContrato.Visible = False If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then @@ -1339,11 +1339,11 @@ Partial Class Contratos_Default Exit Sub End If - Dim TieneError = False - Dim Modificado = False + Dim TieneError As Boolean = False + Dim Modificado As Boolean = False ' Dim Extension = Session("FileExtension").ToString - Dim Archivo = Session("FileUpload").ToString - Dim Ruta = Session("FileFolder").ToString + Dim Archivo As String = Session("FileUpload").ToString + Dim Ruta As String = Session("FileFolder").ToString Dim Minimo, Maximo, Total As Double 'If txtMinimo.Text.ToDouble > 0 Then Minimo = txtMinimo.Text.ToDouble Else Minimo = -1 @@ -1612,11 +1612,11 @@ Partial Class Contratos_Default For Ciclo As Integer = 1 To CiclosComercialesEnMeses Dim FechaRef As DateTime = FechaI.AddMonths(PeriodoMeses * Ciclo) - Dim lastDayOfMonth = DateTime.DaysInMonth(FechaRef.Year, FechaRef.Month) + Dim lastDayOfMonth As Integer = DateTime.DaysInMonth(FechaRef.Year, FechaRef.Month) Dim DiaMes As Integer = If(lastDayOfMonth < DdlDiaFact.SelectedValue.ToEntero(), lastDayOfMonth, DdlDiaFact.SelectedValue.ToEntero()) - Dim FechaFact = New DateTime(FechaRef.Year, FechaRef.Month, DiaMes) + Dim FechaFact As Date = New DateTime(FechaRef.Year, FechaRef.Month, DiaMes) FechaFact = If(FechaFact > FechaF, FechaF, FechaFact) If Not ObjContratos.CicloComercialAdd(CveContrato, -1, DdlCliente.SelectedValue.ToEntero, False, -1, 1, UsuarioActual.CveEmpresa, FechaFact) Then TieneError = True : Exit For @@ -1644,7 +1644,7 @@ Partial Class Contratos_Default Dim DiaAnterior As Integer = 0 - For CicloDias = 1 To CiclosPorMes + For CicloDias As Integer = 1 To CiclosPorMes Dim DiaMes As Integer = 0 If CicloDias = 1 Then @@ -1994,8 +1994,8 @@ Partial Class Contratos_Default UpGV.Update() End Sub Protected Sub BtnAutorizar_Click(sender As Object, e As EventArgs) Handles BtnAutorizar.Click - Dim pinterno = TmpDT.SUM("Total", "CveTipoPresupuesto=1").ToString.ToDouble - Dim pventas = TmpDT.SUM("Total", "CveTipoPresupuesto=2").ToString.ToDouble + Dim pinterno As Double = TmpDT.SUM("Total", "CveTipoPresupuesto=1").ToString.ToDouble + Dim pventas As Double = TmpDT.SUM("Total", "CveTipoPresupuesto=2").ToString.ToDouble If (pinterno < pventas) Then Dim objContrato As New ClsContratos @@ -2038,7 +2038,7 @@ Partial Class Contratos_Default Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") TmpDT.Rows.Add(Row) TmpDT.AcceptChanges() - Dim TotalRow = Row("Total").ToString.ToDouble + Dim TotalRow As Double = Row("Total").ToString.ToDouble CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) @@ -2086,7 +2086,7 @@ Partial Class Contratos_Default Dim CveContratoDetalle As Integer = gvr.DataKey("CveContratoDetalle").ToString.ToEntero Dim objContrato As New ClsContratos If objContrato.UpdateContratosDetalleEstimacion(CveContratoDetalle, IIf(btn.Checked, 1, 0).ToString.ToEntero) Then - Dim row = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) + Dim row As DataRow = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) row("PermitirEstimacion") = IIf(btn.Checked, 1, 0).ToString.ToEntero Alert("Se ha permitido estimar", TipoMensaje.MsgInformacion) Else @@ -2103,7 +2103,7 @@ Partial Class Contratos_Default Dim CveContratoDetalle As Integer = gvr.DataKey("CveContratoDetalle").ToString.ToEntero Dim objContrato As New ClsContratos If objContrato.UpdateContratosDetalleAvance(CveContratoDetalle, IIf(btn.Checked, 1, 0).ToString.ToEntero) Then - Dim row = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) + Dim row As DataRow = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) row("PermitirAvance") = IIf(btn.Checked, 1, 0).ToString.ToEntero @@ -2169,7 +2169,7 @@ Partial Class Contratos_Default OCInterna = Gv.Rows(e.RowIndex).FCTextBox("TxtOCInternaEdit").Text.ToString LimitarCantidad = Gv.Rows(e.RowIndex).FCCheckBox("ChkLimitarCantidad").Checked Observaciones = Gv.Rows(e.RowIndex).FCTextBox("TxtObservacion").Text.ToString - Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) + Dim row As DataRow = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) Dim LimitarCantidadValidator As Boolean = row("LimitarCantidad").ToString = "True" If row("CantidadContratada").ToString.ToEntero <> Cantidad OrElse row("PU").ToString.ToEntero <> PU OrElse CveUM <> row("CveUM").ToString.ToEntero OrElse row("NoIdentificacion").ToString <> NoIdentificacion OrElse row("OCInterna").ToString <> OCInterna OrElse LimitarCantidadValidator <> LimitarCantidad Then @@ -2284,7 +2284,7 @@ Partial Class Contratos_Default End If Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") TmpDT.Rows.Add(Row) - Dim TotalRow = Row("Total").ToString.ToDouble + Dim TotalRow As Double = Row("Total").ToString.ToDouble CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1")) @@ -2354,7 +2354,7 @@ Partial Class Contratos_Default NoIdentificacion = GvInsumos.Rows(e.RowIndex).FCTextBox("TxtNoIdentificacion").Text.ToString LimitarCantidad = GvInsumos.Rows(e.RowIndex).FCCheckBox("ChkLimitarCantidad").Checked - Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) + Dim row As DataRow = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) If row("Cantidad").ToString.ToEntero <> Cantidad OrElse row("PU").ToString.ToEntero <> PU OrElse CveUM <> row("CveUM").ToString.ToEntero OrElse row("NoIdentificacion").ToString <> NoIdentificacion OrElse (row("LimitarCantidad").ToString = "True") <> LimitarCantidad Then @@ -2453,7 +2453,7 @@ Partial Class Contratos_Default End If Row("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") TmpDT.Rows.Add(Row) - Dim TotalRow = Row("Total").ToString.ToDouble + Dim TotalRow As Double = Row("Total").ToString.ToDouble GvInt.DataSource = TmpDT.FiltraParametros("CveTipoPresupuesto=1") GvInt.DataBind() @@ -2494,10 +2494,10 @@ Partial Class Contratos_Default CveUM = GvInt.Rows(e.RowIndex).FCDropDownList("DdlUMEdit").SelectedValue.ToEntero 'NoIdentificacion = GvInt.Rows(e.RowIndex).FCDropDownList("NoIdentificacion").ToString - Dim row = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) - Dim c1 = row("Cantidad").ToString.ToEntero - Dim p1 = row("PU").ToString.ToEntero - Dim cvum1 = row("CveUM").ToString.ToEntero + Dim row As DataRow = TmpDT.Select(String.Format(" CveContratoDetalle={0}", CveContratoDetalle))(0) + Dim c1 As Integer = row("Cantidad").ToString.ToEntero + Dim p1 As Decimal = row("PU").ToString.ToDecimal + Dim cvum1 As Integer = row("CveUM").ToString.ToEntero If c1 <> Cantidad OrElse p1 <> PU OrElse CveUM <> cvum1 Then Dim ObjContratos As New ClsContratos @@ -2573,7 +2573,7 @@ Partial Class Contratos_Default TabReporteAvance.Visible = True lbImprimirAvance.Visible = True - Dim Modalidad = IfNull(Request("Tipo"), 1, 2) + Dim Modalidad As Integer = IfNull(Request("Tipo"), 1, 2).ToString.ToEntero If Modalidad.ToString.ToEntero = 2 Then Tab.ActiveTabIndex = 2 @@ -2613,19 +2613,19 @@ Partial Class Contratos_Default e.Row.CssClass = "SubTotales" End If - Dim Liga1 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|1" + Dim Liga1 As String = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|1" e.Row.FCLinkButton("LBAvanceCantidad").CommandArgument = Liga1 e.Row.FCLinkButton("LBAvanceImporte").CommandArgument = Liga1 - Dim Liga2 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|2" + Dim Liga2 As String = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|2" e.Row.FCLinkButton("LBAvanceXFacturarCantidad").CommandArgument = Liga2 e.Row.FCLinkButton("LBAvanceXFacturarImporte").CommandArgument = Liga2 End If End Sub Protected Sub MuestaModalVentasAvance(sender As Object, e As EventArgs) - Dim Btn = CType(sender, LinkButton) - Dim Parametros = Btn.CommandArgument.Split("|"c) + Dim Btn As LinkButton = CType(sender, LinkButton) + Dim Parametros As String() = Btn.CommandArgument.Split("|"c) Dim ObjContratos As New ClsContratos @@ -2987,7 +2987,7 @@ Partial Class Contratos_Default e.Row.Cells(4).Text = "" e.Row.Cells(5).Text = "" - Dim Texto = $"Pedido: {e.Row.DBCampo("SerieFolio")} | " + Dim Texto As String = $"Pedido: {e.Row.DBCampo("SerieFolio")} | " Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") e.Row.Cells(0).ColumnSpan = 2 @@ -3014,7 +3014,7 @@ Partial Class Contratos_Default e.Row.Cells(4).Text = "" e.Row.Cells(5).Text = "" - Dim Texto = $"Devolución: {e.Row.DBCampo("SerieFolio")} | " + Dim Texto As String = $"Devolución: {e.Row.DBCampo("SerieFolio")} | " Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") e.Row.Cells(0).ColumnSpan = 2 @@ -3102,7 +3102,7 @@ Partial Class Contratos_Default LBLAFValorActivo.Text = DT.SUM("ValorImporte", "CveMovimientoDetalle > 0").ToString("###,###,###.00") - Dim Total = DT.SUM("Cantidad", "CveMovimientoDetalle > 0 AND TipoDocto = 'Ped'") - DT.SUM("Cantidad", "TipoDocto = 'DPe'") + Dim Total As Decimal = DT.SUM("Cantidad", "CveMovimientoDetalle > 0 AND TipoDocto = 'Ped'") - DT.SUM("Cantidad", "TipoDocto = 'DPe'") LBLAFTotal.Text = DT.SUM("Cantidad", "CveMovimientoDetalle > 0").ToString() UPAFResumen.Update() @@ -3119,7 +3119,7 @@ Partial Class Contratos_Default e.Row.Cells(4).Text = "" e.Row.Cells(5).Text = "" - Dim Texto = $"{If(e.Row.DBCampo("TipoDocto") = "Ped", "Pedido", "Devolución") }: {e.Row.DBCampo("SerieFolio")} | " + Dim Texto As String = $"{If(e.Row.DBCampo("TipoDocto") = "Ped", "Pedido", "Devolución") }: {e.Row.DBCampo("SerieFolio")} | " Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: {e.Row.DBCampo("Folio")}") @@ -3169,7 +3169,7 @@ Partial Class Contratos_Default For Each GRow As GridViewRow In GvDatosAlmacen.Rows Dim CveMovimientoDetalle As Integer = GRow.DataKey("CveMovimientoDetalle").ToEntero - Dim ChkEsInterno = GRow.FCCheckBox("ChkEsInterno") + Dim ChkEsInterno As CheckBox = GRow.FCCheckBox("ChkEsInterno") If CveMovimientoDetalle > 0 And ChkEsInterno.Checked And DdlEsInterno.SelectedValue.ToEntero > 0 Then Dim EsInterno As Boolean @@ -3221,7 +3221,7 @@ Partial Class Contratos_Default Protected Sub BtnDevolucionAlmacen_Click(sender As Object, e As EventArgs) Dim ObjVentas As New ClsVentas ObjVentas.IniciaTransacSQL() - Dim TieneError = False + Dim TieneError As Boolean = False For Each Dr As DataRow In DtMovimientos.FiltraParametros("CveVenta IS NOT NULL AND CveMovimiento IS NOT NULL AND EsDevolucionVenta = 0", "", {"CveVenta"}).Rows If Not ObjVentas.UpdateVentasDevolucionAlmacen(1, Dr("CveVenta").ToString.ToEntero) Then @@ -3229,7 +3229,6 @@ Partial Class Contratos_Default End If Next - If Not TieneError Then ObjVentas.Commit() Alert("La solicitud de devolución se guardo correctamente.", TipoMensaje.MsgInformacion) @@ -3241,9 +3240,6 @@ Partial Class Contratos_Default ObjVentas.Dispose() End Sub - - - Public Sub CargaDatosEncabezado() TablaUtilidad.Visible = True @@ -3466,7 +3462,7 @@ Partial Class Contratos_Default Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String) Dim dt As New DataTable dt = ReadExcelFile(Ruta + FileName, True) - Dim ErrorArchivo = False + Dim ErrorArchivo As Boolean = False 'Dim Conexion As Odbc.OdbcConnection = Nothing 'Try @@ -3602,7 +3598,7 @@ Partial Class Contratos_Default guardarBitacora(msj) dr("CveContratoDetalle") = ObjContratos.DtResultados.Rows(0)("CveContratoDetalle") TmpDT.Rows.Add(dr) - Dim TotalRow = dr("Total").ToString.ToDouble + Dim TotalRow As Double = dr("Total").ToString.ToDouble CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) LbTotalGeneral.Text = (LbTotalGeneral.Text.ToDouble + TotalRow).ToString.FormatoNumero @@ -3708,7 +3704,7 @@ Partial Class Contratos_Default End Sub Private Sub CargaDiasMes(Optional NumMaxDias As Integer = 31) DdlDiaFact.Items.Clear() - For i = 1 To NumMaxDias + For i As Integer = 1 To NumMaxDias DdlDiaFact.Items.Add(New ListItem(i.ToString(), i.ToString())) Next End Sub @@ -4019,7 +4015,7 @@ Partial Class Contratos_Default End Sub Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) - Dim ListaTagsDocumentost = New List(Of TagsDocumentos) + Dim ListaTagsDocumentost As New List(Of TagsDocumentos) Dim ObjContratos As New ClsContratos If CveContrato <> -1 Then If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then @@ -4072,7 +4068,7 @@ Partial Class Contratos_Default #Region "CREAR A PARTIR DE" Private Sub BtnAgregarContratoHijo_Click(sender As Object, e As EventArgs) Handles BtnAgregarContratoHijo.Click - Dim TieneError = False + Dim TieneError As Boolean = False Dim ObjContratos As New ClsContratos ObjContratos.IniciaTransacSQL() @@ -4131,9 +4127,8 @@ Partial Class Contratos_Default End Sub - Private Function AgregarDetalleHijo(CveContratoHijo As Integer, ByRef ObjContratos As ClsContratos) As Boolean - Dim TieneError = False + Dim TieneError As Boolean = False Dim Cantidades As Double For Each Row As DataRow In TmpDT.Rows @@ -4600,8 +4595,8 @@ Partial Class Contratos_Default If Plantilla.Contains("{MES}") Then Dim fecha As DateTime = NowADS() - Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim formatoFecha As DateTimeFormatInfo = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() Plantilla = Plantilla.ToString().Replace("{MES}", nombreMes) End If @@ -4616,16 +4611,16 @@ Partial Class Contratos_Default If Plantilla.Contains("{MESANTERIOR}") Then Dim fecha As DateTime = NowADS().AddMonths(-1) - Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim formatoFecha As DateTimeFormatInfo = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() Plantilla = Plantilla.ToString().Replace("{MESANTERIOR}", nombreMes) End If If Plantilla.Contains("{INICIOMESANTERIOR}") Then Dim fecha As DateTime = NowADS().AddMonths(-1) - Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim formatoFecha As DateTimeFormatInfo = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() Dim mesAnterior As String = String.Format("01 {0} {1}", nombreMes, fecha.Year) @@ -4634,10 +4629,10 @@ Partial Class Contratos_Default If Plantilla.Contains("{FINMESANTERIOR}") Then Dim fecha As DateTime = NowADS().AddMonths(-1) - Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim formatoFecha As DateTimeFormatInfo = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + 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) @@ -4655,8 +4650,8 @@ Partial Class Contratos_Default If Plantilla.Contains("{MES}") Then Dim fecha As DateTime = NowADS() - Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim formatoFecha As DateTimeFormatInfo = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() Plantilla = Plantilla.ToString().Replace("{MES}", nombreMes) End If @@ -4671,16 +4666,16 @@ Partial Class Contratos_Default If Plantilla.Contains("{MESANTERIOR}") Then Dim fecha As DateTime = NowADS().AddMonths(-1) - Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim formatoFecha As DateTimeFormatInfo = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() Plantilla = Plantilla.ToString().Replace("{MESANTERIOR}", nombreMes) End If If Plantilla.Contains("{INICIOMESANTERIOR}") Then Dim fecha As DateTime = NowADS().AddMonths(-1) - Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim formatoFecha As DateTimeFormatInfo = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes As String = formatoFecha.GetMonthName(fecha.Month).ToUpper() Dim mesAnterior As String = String.Format("01 {0} {1}", nombreMes, fecha.Year) @@ -4689,10 +4684,10 @@ Partial Class Contratos_Default If Plantilla.Contains("{FINMESANTERIOR}") Then Dim fecha As DateTime = NowADS().AddMonths(-1) - Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat - Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + Dim formatoFecha As DateTimeFormatInfo = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + 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) diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index c15e1b5c5..5b74eeaa9 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -294,21 +294,6 @@ Partial Class General_SaldosIniciales Exit Sub End If - 'If Not dt.Columns(15).ColumnName = "IEPS" Then - ' Alert("El nombre de la decimosexta columna debe ser 'IEPS'. Favor de corregirlo", TipoMensaje.MsgError) - ' Exit Sub - 'End If - - 'If Not dt.Columns(16).ColumnName = "RetIVAPorcentaje" Then - ' Alert("El nombre de la decimoséptima columna debe ser 'RetIVAPorcentaje'. Favor de corregirlo", TipoMensaje.MsgError) - ' Exit Sub - 'End If - - 'If Not dt.Columns(17).ColumnName = "RetISRPorcentaje" Then - ' Alert("El nombre de la decimoctava columna debe ser 'RetISRPorcentaje'. Favor de corregirlo", TipoMensaje.MsgError) - ' Exit Sub - 'End If - 'If RblFormato.SelectedValue = "4" Then ' If Not dt.Columns(15).ColumnName = "ImpuestoLocal" Then ' Alert("El nombre de la diesciseisava columna debe ser 'ImpuestoLocal'. Favor de corregirlo", TipoMensaje.MsgError) @@ -716,7 +701,7 @@ Partial Class General_SaldosIniciales Dim NuevaClasificacion As Boolean = False - For Each Row As DataRow In dt.Rows + For Each Row As DataRow In dt.FiltraParametros("Descripcion <> ''").Rows Dim Codigo As String = Row("Codigo").ToString() Dim Descripcion As String = Row("Descripcion").ToString() Dim TipoPS As String = Row("Tipo").ToString().Trim.ToUpper @@ -1445,7 +1430,9 @@ Partial Class General_SaldosIniciales #Region "P R O V E E D O R E S - F A C T U R A S" + Dim ObjCompras As New ClsCompras Dim ErrorCompras As Boolean = False + Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL()) Dim CveCompra As Integer Dim Contador As Integer = 0 Dim ExisteCompra As Boolean = False @@ -1466,11 +1453,9 @@ Partial Class General_SaldosIniciales Dim CveClasificacion As Integer = drr("CveClasificacion").ToString().ToEntero() Dim dtsubp As DataTable = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString()}'") RFC = Row("RFC").ToString().Trim - RFC = Row("RFC").ToString().Trim Dim Serie As String = Row("Serie").ToString() Dim Folio As String = Row("Folio").ToString() Dim Fecha As Date = Row("Fecha").ToString().ToDate @@ -1478,31 +1463,30 @@ Partial Class General_SaldosIniciales Dim IVA As Decimal = Row("IVA").ToString().ToDecimal Dim Total As Decimal = Row("Total").ToString().ToDecimal Dim Saldo As Decimal = Row("Saldo").ToString().ToDecimal - Dim TipoDocumento As String = Row("Tipo Documento").ToString().Trim() + Dim TipoDocto As String = Row("Tipo Documento").ToString() Dim CveProveedor As Integer = DtProveedores.FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString().ToEntero() GuardaLog(Sucursal + " - " + Row("Sucursal").ToString()) Dim RetIVA As Decimal = Row("Ret IVA").ToString().ToDecimal Dim RetISR As Decimal = Row("Ret ISR").ToString().ToDecimal Dim IEPS As Decimal = If(dt.Columns.Contains("IEPS"), Row("IEPS").ToString(), "0").ToDecimal Dim Moneda As String = Row("Moneda").ToString() - Dim TipoCambio As String = Row("Tipo Cambio").ToString() + Dim TipoCambio As String = If(dt.Columns.Contains("Tipo Cambio"), Row("Tipo Cambio").ToString(), "1") Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString().ToDate Dim CveMoneda As Integer = 1 - Dim CveProveedorSucursal As Integer = Row("CveProveedorSucursal").ToString().ToEntero() - Dim PorcentajeIVA As String = Row("PorcentajeIVA").ToString() + Dim CveProveedorSucursal As Integer = If(dt.Columns.Contains("CveProveedorSucursal"), Row("CveProveedorSucursal").ToString(), "0").ToEntero + Dim PorcentajeIVA As String = If(dt.Columns.Contains("PorcentajeIVA"), Row("PorcentajeIVA").ToString(), "0") Dim ImpuestosLocales As Decimal = If(dt.Columns.Contains("ImpuestosLocales"), Row("ImpuestosLocales").ToString(), "0").ToDecimal Dim RetIVAPorcentaje As Decimal = If(dt.Columns.Contains("RetIVAPorcentaje"), Row("RetIVAPorcentaje").ToString(), "0").ToDecimal Dim RetISRPorcentaje As Decimal = If(dt.Columns.Contains("RetISRPorcentaje"), Row("RetISRPorcentaje").ToString(), "0").ToDecimal - + Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", String.Format("SubProyecto='{0}'", If(dt.Columns.Contains("SubProyecto"), Row("SubProyecto").ToString(), ""))).ToEntero + If CveSubProyecto = 0 Then CveSubProyecto = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorCompras = True If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorCompras = True If Not CveProveedor > 0 Then Alert(String.Format("No se encontró el Proveedor con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorCompras = True : Exit For If Not CveProveedorSucursal > 0 Then CveProveedorSucursal = -1 - Dim TipoDocto = IIf(TipoDocumento.ToUpper.Contiene("INGRESOS", "INGRESO", "ING", "FACTURA"), "Fac", "NC").ToString() - - + TipoDocto = IIf(TipoDocto.ToUpper.Contiene("INGRESOS", "INGRESO", "ING", "FACTURA"), "Fac", "NC").ToString() 'Temporalmente SE BORRARA Dim Transaccion As String = "" 'Row("Transaccion2").ToString() @@ -1529,11 +1513,9 @@ Partial Class General_SaldosIniciales If FechaVencimiento = "".ToDate Or FechaVencimiento < "1900/01/01".ToDate Then FechaVencimiento = Fecha End If - - 'Compra If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero(), SubTotal, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDecimal, FechaVencimiento, - False, CodProvee, 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorSucursal:=CveProveedorSucursal, - NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA.ToDecimal, TotalOriginal:=Total, CveSubProyecto:=Sucursal.ToEntero()) Then + False, CodProvee, 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorSucursal:=CveProveedorSucursal, + NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA.ToDecimal, TotalOriginal:=Total, CveSubProyecto:=CveSubProyecto) Then ErrorCompras = True Exit For End If @@ -1555,8 +1537,6 @@ Partial Class General_SaldosIniciales If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IVA, IVA, 14, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero(), CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeIVA.ToDecimal) Then ErrorCompras = True : Exit For End If - - If IEPS > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IEPS, IEPS, 25, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For If RetIVA > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetIVA, RetIVA, 15, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For @@ -1565,14 +1545,14 @@ Partial Class General_SaldosIniciales 'Saldo If Saldo < Total Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Total - Saldo, 17, $"{Folio} SALDO INICIAL", Folio, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Total - Saldo, 95, $"{Folio} SALDO INICIAL", Folio, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For End If Encontrados = Encontrados + 1 Next + If Not ErrorCompras Then + Next - Catch ex As Exception + Catch ex As Exception OnError("Ocurrió un error al cargar los datos", ex) ErrorCompras = True End Try @@ -2394,8 +2374,6 @@ Partial Class General_SaldosIniciales Dim ErrorProceso As Boolean = False - - Dim SBMensajesCuentasNoEncontradas As New StringBuilder For Each dRow As DataRow In dt.FiltraParametros(" LEN(Clasificacion) > 0 ").Rows @@ -2430,26 +2408,21 @@ Partial Class General_SaldosIniciales Dim ObjConta As New ClsContabilidad(ObjClasificaciones.IniciaTransacSQL) Dim Contador As Integer = 0 - - Dim DTClasificaiones As New DataTable - If ObjClasificaciones.GetClasificaciones(UsuarioActual.CveEmpresa) Then - DTClasificaiones = ObjClasificaciones.DtResultados - End If - - If Not DTClasificaiones.Rows.Count > 0 Then - ObjConta.Dispose() - Alert("Error a conusltar clasificaciones.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - + 'If ObjClasificaciones.GetClasificaciones(UsuarioActual.CveEmpresa) Then + ' DTClasificaiones = ObjClasificaciones.DtResultados + 'End If + 'If Not DTClasificaiones.Rows.Count > 0 Then + ' ObjConta.Dispose() + ' Alert("Error a consultar clasificaciones.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If DTClasificaiones.CaseSensitive = False For Each dRow As DataRow In dt.FiltraParametros(" LEN(Clasificacion) > 0 ").Rows - Dim Clasificacion As String = dRow("Clasificacion").ToString().Trim.Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") Dim Categoria As String = dRow("Categoria").ToString().Trim.Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") Dim UsoClasificacion As String = dRow("UsoClasificacion").ToString().Trim.ToUpper.Replace("\r\n", "").Replace(vbCrLf, "").Replace(vbCr, "") @@ -2459,12 +2432,8 @@ Partial Class General_SaldosIniciales Dim CveClasificacion As Integer = -1 Dim CveUsoClasificacion As Integer = -1 Dim CveCategoria As Integer = -1 - - CveCategoria = GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", $" Categoria = '{Categoria}' ").ToEntero() - - If Not CveCategoria > 0 Then CveCategoria = GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", "").ToEntero() If Not CveCategoria > 0 Then @@ -2472,7 +2441,6 @@ Partial Class General_SaldosIniciales ErrorProceso = True Exit For End If - End If @@ -2514,34 +2482,24 @@ Partial Class General_SaldosIniciales If ObjClasificaciones.AddClasificaciones(Clasificacion, "", CveCategoria, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, RequiereSerieLote:=0, UsoClasificacion:=CveUsoClasificacion, CveSATPS:=-1, RequiereAFCompra:=False, RequiereAFInsumo:=False, RequierePersonal:=False, EsAcumulador:=False, TopVentas:=False, TopCompras:=False, PrecioBaseCosto:=-1) Then - CveClasificacion = ObjClasificaciones.CveClasificacion - If CveClasificacion > 0 Then If ObjClasificaciones.GetClasificaciones(UsuarioActual.CveEmpresa) Then DTClasificaiones = ObjClasificaciones.DtResultados End If Else - ErrorProceso = True End If - - - Else ErrorProceso = True End If Else - If Not ObjClasificaciones.UpdateClasificacion(Clasificacion, "-1", True, True, CveCategoria, UsuarioActual.CveUsuario, CveClasificacion, UsoClasificacion:=CveUsoClasificacion) Then ErrorProceso = True End If - End If - If Not ErrorProceso Then - If CveCuentaContableIngreso > 0 Then If Not AsignacionCuenta(ObjConta, 4, CveCuentaContableIngreso, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CveClasificacion, OpActualizarClasificacion:=True) Then ErrorProceso = True @@ -2557,22 +2515,16 @@ Partial Class General_SaldosIniciales Exit For End If End If - End If - - Contador = Contador + 1 Next - If Not ErrorProceso Then ObjClasificaciones.Commit() Alert($"Se agregaron {Contador} Clasificaciones.") Else ObjClasificaciones.RollBack() End If - - ObjClasificaciones.Dispose() End Sub diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 6e11b2adc..7088e71a2 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -2089,7 +2089,7 @@ Partial Class Inventarios_EntradasSalidas Dim RetornoVirtual As MMovimientoVirtual = Nothing If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - RetornoVirtual = GenerarMovimientoVirtual(CveMovimiento, ObjInventario) + RetornoVirtual = GenerarMovimientoVirtual(CveMovimiento, ObjInventario, ObjConta) End If If RetornoVirtual IsNot Nothing Then @@ -2968,7 +2968,7 @@ Partial Class Inventarios_EntradasSalidas #Region " CONTABILIZAR " - Public Function ContabilizaMovimientoAlmacen(ByRef ObjConta As ClsContabilidad, Fecha As Date, Concepto As String, Modulo As String, CveMovimientoSalida As Integer, CveMovimientoEntrada As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer, Contabilizable As Boolean) As Integer + Public Function ContabilizaMovimientoAlmacen(ByRef ObjConta As ClsContabilidad, Fecha As Date, Concepto As String, Modulo As String, CveMovimientoSalida As Integer, CveMovimientoEntrada As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer, Contabilizable As Boolean, Optional dttCostos As DataTable = Nothing, Optional CveSubProyecto As Integer = -1) As Integer Dim Retorno As Integer = -1 Dim ErrorMovInv As Boolean = False @@ -2977,9 +2977,22 @@ Partial Class Inventarios_EntradasSalidas ErrorMovInv = True End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, Importe, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then - ErrorMovInv = True + If CveMovimientoEntrada > 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, Importe, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If End If + If dttCostos IsNot Nothing Then + For Each RowInv As DataRow In dttCostos.Rows + Dim ValorInventario As Decimal = dttCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorInventario, ValorInventario, 69, Concepto, Concepto, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=CveSubProyecto, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + Exit For + End If + Next + End If + If Not ErrorMovInv Then Retorno = CvePrePoliza @@ -4634,11 +4647,11 @@ Partial Class Inventarios_EntradasSalidas Dim RetornoVirtual As MMovimientoVirtual = Nothing If Not ErrorMovInv AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - If CveMovimientoSalida > 0 Then RetornoVirtual = GenerarMovimientoVirtual(CveMovimientoSalida, ObjInventario) + If CveMovimientoSalida > 0 Then RetornoVirtual = GenerarMovimientoVirtual(CveMovimientoSalida, ObjInventario, ObjConta) If RetornoVirtual IsNot Nothing Then ErrorMovInv = RetornoVirtual.TieneError - If CveMovimientoEntrada > 0 AndAlso Not ErrorMovInv Then RetornoVirtual = GenerarMovimientoVirtual(CveMovimientoEntrada, ObjInventario) + If CveMovimientoEntrada > 0 AndAlso Not ErrorMovInv Then RetornoVirtual = GenerarMovimientoVirtual(CveMovimientoEntrada, ObjInventario, ObjConta) If RetornoVirtual IsNot Nothing Then ErrorMovInv = RetornoVirtual.TieneError End If @@ -5421,8 +5434,8 @@ Partial Class Inventarios_EntradasSalidas Protected Sub LnkGenerarVirtual_Click(sender As Object, e As EventArgs) If CveMovimiento > 0 Then Dim ObjInventario As New ClsInventarios - ObjInventario.IniciaTransacSQL() - Dim Retorno As MMovimientoVirtual = GenerarMovimientoVirtual(Me.CveMovimiento, ObjInventario) + Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) + Dim Retorno As MMovimientoVirtual = GenerarMovimientoVirtual(Me.CveMovimiento, ObjInventario, ObjConta) If Retorno.TieneError Then ObjInventario.RollBack() @@ -5440,7 +5453,7 @@ Partial Class Inventarios_EntradasSalidas End Sub - Private Function GenerarMovimientoVirtual(CveMovimiento As Integer, ByRef ObjInventario As ClsInventarios) As MMovimientoVirtual + Private Function GenerarMovimientoVirtual(CveMovimiento As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad) As MMovimientoVirtual Dim ErrorMovInv As Boolean = False Dim DtPSVirtual As New DataTable("DtTamanios") @@ -5449,14 +5462,20 @@ Partial Class Inventarios_EntradasSalidas Dim tCveAlmacen As Integer = -1 Dim tOrigen As Integer = -1 + Dim tCveSubProyecto As Integer = -1 Try If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then tCveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero() tOrigen = ObjInventario.DtResultados.FiltroPrimeroValor("Origen").ToEntero() End If + Dim drAlmacenVirtual As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimero("") + Dim CveAlmacenVirtual As Integer + If drAlmacenVirtual IsNot Nothing Then + CveAlmacenVirtual = drAlmacenVirtual("CveAlmacenVirtual").ToString.ToEntero + tCveSubProyecto = drAlmacenVirtual("CveSubProyecto").ToString.ToEntero + End If - Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero() 'VERIFICA SI TIENE ALMACEN VIRTUAL If CveAlmacenVirtual > 0 Then @@ -5482,6 +5501,17 @@ Partial Class Inventarios_EntradasSalidas Next End If + If Not ErrorMovInv Then + Dim dttCosto As DataTable = Nothing + If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtual, UsuarioActual.CveEmpresa) Then + dttCosto = ObjInventario.DtResultados + End If + + If ContabilizaMovimientoAlmacen(ObjConta:=ObjConta, TxtFecha.Text.Replace(",", "").ToDate, "Virtual", "ES/GV", CveMovimientoVirtual, -1, DtPSVirtual.SUM("TotalCargo"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, True, dttCosto, tCveSubProyecto) > 0 Then + ErrorMovInv = True + End If + End If + End If Catch ex As Exception ErrorMovInv = True @@ -5506,55 +5536,24 @@ Partial Class Inventarios_EntradasSalidas Private Function CreaObjetosVenta() As Modelos.Factura Dim ObjFactura As New Modelos.Factura - ObjFactura.Version = "3.3" ObjFactura.CveUsuario = UsuarioActual.CveUsuario ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa ObjFactura.TipoCambio = 0 - ObjFactura.ConvertirPesos = False - ObjFactura.TipoCambio = 0 ObjFactura.CveMoneda = 1 ObjFactura.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {ObjFactura.CveMoneda} ") ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", "CveMoneda = 1") ObjFactura.MonedaAbreviatura = GlobalDTMonedas.FiltroPrimeroValor("Abreviatura", $"CveMoneda = {ObjFactura.CveMoneda} ") ObjFactura.TipoDocto = "Tra" - ObjFactura.RefDocto = "" ObjFactura.Folio = Folio.ToEntero ObjFactura.Serie = "Tra" 'ObjFactura.CveMesa = -1 ObjFactura.Fecha = NowADS() - ObjFactura.CvePrePoliza = -1 ObjFactura.FechaPago = NowADS() - ObjFactura.MotivoDescuento = "" - ObjFactura.Observaciones = "" ObjFactura.FechaEjecucion = NowADS() ObjFactura.UsuarioCreo = UsuarioActual.Usuario - ObjFactura.CveCondicionEntrega = -1 - ObjFactura.CondicionEntrega = "" - ObjFactura.NumeroCuenta = "" - ObjFactura.CondicionesPago = 0 - ObjFactura.FormaPago = 0 - ObjFactura.PedidoContrato = "" - ObjFactura.OrdenCompra = "" - ObjFactura.NumeroContrato = "" - ObjFactura.NumeroDescripcionContrato = "" - ObjFactura.DescripcionContrato = "" - ObjFactura.CveCorte = -1 ObjFactura.TipoDocumento = "Traspaso" - ObjFactura.Alfa1 = "" - ObjFactura.Alfa2 = "" - ObjFactura.Alfa3 = "" - ObjFactura.Descuento = 0 - ObjFactura.Amortizacion = 0 - ObjFactura.CveContrato = 0 - ObjFactura.CveVendedor = 0 ObjFactura.FechaVencimiento = NowADS() - ObjFactura.TipoEstatus = 0 - ObjFactura.Det_OrdenCompra = "" - ObjFactura.Inv_CveEstatusEntrega = 0 - ObjFactura.FormaPago33 = "" - ObjFactura.MetodoPago33 = "" - ObjFactura.UsoCFDI = "" - ObjFactura.CveClienteSucursal = 0 + Dim CveSubProyecto As Integer = -1 If GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {DdlAlmacen.SelectedValue}").Rows.Count > 0 Then CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {DdlAlmacen.SelectedValue}").Rows(0)("CveSubProyecto").ToString.ToEntero diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 093ae37f1..0bda8fec3 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -1083,6 +1083,17 @@ Partial Class Inventarios_TraspasoAlmacen ErrorMovInv = True End If + If Not ErrorMovInv Then + If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + 'MsgError = ObjMov.MensajePolizaDescuadre + ErrorMovInv = True + 'GuardaLogAD($"Bancos/Transferencias | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + Else + ErrorMovInv = True + End If + End If End If End If End If @@ -1156,6 +1167,17 @@ Partial Class Inventarios_TraspasoAlmacen ErrorMovInv = True End If + If Not ErrorMovInv Then + If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + 'MsgError = ObjMov.MensajePolizaDescuadre + ErrorMovInv = True + 'GuardaLogAD($"Bancos/Transferencias | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + Else + ErrorMovInv = True + End If + End If Else TextoError = "Ocurrió un error al generar el movimiento de salida virtual" ErrorMovInv = True @@ -1779,18 +1801,22 @@ Partial Class Inventarios_TraspasoAlmacen Else ErrorMovInv = True End If - + If Not ErrorMovInv Then + If ObjConta.ValidacionesPrePoliza(CvePrePolizaMovVirtual, UsuarioActual) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + 'MsgError = ObjMov.MensajePolizaDescuadre + ErrorMovInv = True + 'GuardaLogAD($"Bancos/Transferencias | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + Else + ErrorMovInv = True + End If + End If End If - - 'Else ' TextoError = "La Sucursal no tiene creado un almacen virtual" ' ErrorMovInv = True End If - - - - End If If Not ErrorMovInv Then @@ -1812,7 +1838,17 @@ Partial Class Inventarios_TraspasoAlmacen TextoError = "Ocurrió un error al cancelar el traspaso" End If End If - + If Not ErrorMovInv Then + If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + 'MsgError = ObjMov.MensajePolizaDescuadre + ErrorMovInv = True + 'GuardaLogAD($"Bancos/Transferencias | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + Else + ErrorMovInv = True + End If + End If End If End If @@ -2094,7 +2130,6 @@ Partial Class Inventarios_TraspasoAlmacen Exit Sub End If - Dim ObjInventario As New ClsInventarios Dim Dtt As DataTable = Nothing Dim CveMovimientoEntrada As Integer = 0 @@ -2216,11 +2251,21 @@ Partial Class Inventarios_TraspasoAlmacen If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, importe, 68, TxtObservaciones.Text, TxtObservaciones.Text, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If + If Not ErrorMovInv Then + If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + 'MsgError = ObjMov.MensajePolizaDescuadre + ErrorMovInv = True + 'GuardaLogAD($"Bancos/Transferencias | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + Else + ErrorMovInv = True + End If + End If End If End If End If - 'VIRTUAL ENTRADA Dim CveMovimientoVirtualEntrada, CveMovimientoVirtualSalida As Integer Dim FolioVirtualEntrada, FolioVirtualSalida As Integer @@ -2281,6 +2326,17 @@ Partial Class Inventarios_TraspasoAlmacen If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, importe, 68, TxtObservaciones.Text, TxtObservaciones.Text, CveMovimientoAlmacen:=CveMovimientoVirtualEntrada, Contabilizable:=False) Then ErrorMovInv = True End If + If Not ErrorMovInv Then + If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + 'MsgError = ObjMov.MensajePolizaDescuadre + ErrorMovInv = True + 'GuardaLogAD($"Bancos/Transferencias | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + Else + ErrorMovInv = True + End If + End If End If End If diff --git a/Ventas/PVCobranza.aspx b/Ventas/PVCobranza.aspx new file mode 100644 index 000000000..629c9c0bb --- /dev/null +++ b/Ventas/PVCobranza.aspx @@ -0,0 +1,289 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PVCobranza.aspx.vb" Inherits="Ventas_PVCobranza" %> + + + + + + + + + + + Cobranza + + + + + + + +
+
+
+ + +
+
+
+
+ Sucursal: +
+
+ + + +
+
+
+
+ +
+
+
+ + +
+
+ + + + + + + + + + + +
+
+ +
+
+ + Nombre: + +           + + + + + +
+
+
+
+ +
+
+
+
+ +
+ $ + + +
+
+ + + +
+
+
+ +
+
+ +
+ $ + + +
+
+ + + +
+
+ + MSI + 3M + 6M + 9M + 12M + + <%-- + --%> +
+
+
+ +
+
+ +
+ $ + + +
+
+ + + +
+
+
+
+
+ +
+ $ + + +
+
+ + + +
+
+
+ +
+
+ +
+ $ + + +
+
+ + + +
+
+
+ +
+
+ +
+ + Otros + Credito + Debito + Cheque + +
+ +
+ $ + + +
+ +
+ + + +
+ +
+ + Meses + 3M + 6M + 9M + 12M + +
+ +
+
+ +
+
+ +
+ $ + + + +
+ +
+ $ + + +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb new file mode 100644 index 000000000..ba2db00f7 --- /dev/null +++ b/Ventas/PVCobranza.aspx.vb @@ -0,0 +1,235 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports System.Runtime.Remoting +Imports Extensiones + +Partial Class Ventas_PVCobranza + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + CargaFiltros() + End If + End Sub + + Private Sub CargaFiltros() + + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyecto.DataBind() + + txtFechaI.Text = Now.AddYears(-1).ToShortDateString + txtFechaF.Text = Now.ToShortDateString + + 'DdlCuentaEfectivo.Items.Clear() + 'DdlCuentaTarjetaCredito.Items.Clear() + 'DdlCuentaTarjetaDebito.Items.Clear() + 'DdlCuentaCheque.Items.Clear() + 'DdlCuentaTransferencia.Items.Clear() + + Dim DtCC As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) + Dim CveMon As Integer = 1 + + 'MOSTRAR SOLO CUENTAS DE CONTADO EN BDH + 'If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + DdlCuentaEfectivo.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 0", CveMon)) + DdlCuentaCheque.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 0", CveMon)) + 'Else + ' DdlCuentaEfectivo.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon)) + ' DdlCuentaCheque.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon)) + 'End If + + 'If UsuarioActual.Empresa.Funcionalidad(558) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + DdlCuentaTarjetaCredito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", CveMon)) + DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", CveMon)) + 'Else + ' DdlCuentaTarjetaCredito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND (CveTipoCuenta <> 1 OR TieneTerminal = 1)", CveMon)) + 'DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND (CveTipoCuenta <> 1 OR TieneTerminal = 1)", CveMon)) + 'End If + + DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", CveMon)) + + DtCC.Dispose() + + DdlCuentaEfectivo.DataBind() + DdlCuentaTarjetaCredito.DataBind() + DdlCuentaTarjetaDebito.DataBind() + DdlCuentaCheque.DataBind() + DdlCuentaTransferencia.DataBind() + + End Sub + + Private Sub CargaDatos() + + Dim ObjMovtos As New ClsMovimientos() + Dim FechaI, FechaF As Date + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha).AddDays(1) + + If ObjMovtos.GetCxCDetalle(FechaI, FechaF, -1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, "-1", "-1", -1, "-1", -1, + "-1", 1, UsuarioActual.CveEmpresa, -1, 1, + TipoDocto:="Rem", FechaCorte:=NowADS.AddDays(1), CveUsuarioConsulta:=UsuarioActual.CveUsuario, AplicaAnticiposPagados:=0) Then + + Dim dtt As DataTable = ObjMovtos.DSResultados.Tables(0).FiltraParametros("CveVenta > 0") + 'si hay ya asignado, solo la mostrará + Dim Dtta As DataTable = dtt.FiltraParametros($"CveUsuarioCobranza = {UsuarioActual.CveUsuario}") + If Dtta IsNot Nothing AndAlso Dtta.Rows.Count > 0 Then dtt = Dtta + GvDatos.DataSource = dtt + End If + ObjMovtos.Dispose() + GvDatos.DataBind() + UpL.Update() + + End Sub + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click + CargaDatos() + End Sub + + Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveUsuarioCobranza") <> "" Then + e.Row.BackColor = Drawing.ColorTranslator.FromHtml("#3598dc") + 'e.Row.CssClass = "blue-madison" + End If + End If + End Sub + + Private Sub GvDatos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvDatos.RowCommand + If e.CommandName = "Cobrar" Then + Dim ImgBtn As LinkButton = DirectCast(e.CommandSource, LinkButton) + Dim GvRow As GridViewRow = DirectCast(ImgBtn.BindingContainer, GridViewRow) + Dim TieneError As Boolean = False + + Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero + Dim ObjVentas As New ClsVentas + ObjVentas.IniciaTransacSQL() + If Not ObjVentas.UpdateAsignaVentaCobranza(CveVenta, 1, UsuarioActual.CveUsuario, -1, "", Now) Then + TieneError = True + End If + HdnCveVenta.Value = CveVenta.ToString + TxtImporteEfectivo.Text = GvRow.DataKey("Saldo") + TxtImporteEfectivo.Focus() + LtlNombre.Text = GvRow.DataKey("DescripcionVenta") + LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero + 'carga información para cobranza + + If Not TieneError Then + ObjVentas.Commit() + PnlContado.Visible = True + Else + ObjVentas.RollBack() + PnlContado.Visible = False + Alert("Hubo un error al asignar datos de cobranza", TipoMensaje.MsgInformacion) + End If + + ObjVentas.Dispose() + 'CargaDatos() + End If + End Sub + + Private Sub BtnPagar_Click(sender As Object, e As EventArgs) Handles BtnPagar.Click + 'registrar pago + + 'validaciones + If TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal = 0 Then + Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia) + Exit Sub + End If + + Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero + Dim ObjVentas As New ClsVentas + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + Dim DbRowVenta As DataRow = ObjVentas.DtResultados.FiltroPrimero("") + + Dim VentaActual As New Venta(UsuarioActual) + VentaActual.CveVenta = CveVenta + + VentaActual.Fecha = DbRowVenta("Fecha").ToString.ToDate + VentaActual.CveCliente = DbRowVenta("CveCliente").ToString.ToEntero + VentaActual.CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero + VentaActual.SerieFolio = DbRowVenta("SerieFolio").ToString + VentaActual.ClienteNombre = DbRowVenta("ClienteNombre").ToString + VentaActual.TC = DbRowVenta("TipoCambio").ToString.ToDecimal + VentaActual.Total = DbRowVenta("Total").ToString.ToDecimal + VentaActual.IVA = DbRowVenta("IVA").ToString.ToDecimal + VentaActual.IEPS = DbRowVenta("IEPS").ToString.ToDecimal + VentaActual.RetIVA = DbRowVenta("RetIVA").ToString.ToDecimal + VentaActual.RetISR = DbRowVenta("RetISR").ToString.ToDecimal + + VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal + VentaActual.UsuarioActual = UsuarioActual + VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero + + Dim ObjConta As New ClsContabilidad + Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL()) + + Dim CvePrePoliza As Integer + Dim Fecha As Date = NowADS() + Dim Mensaje As String = "" + + CvePrePoliza = ObjConta.AddPrePolizas("PVCobranza", 5, 0, 0, 1, Fecha, $"Pago {VentaActual.SerieFolio}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If CvePrePoliza > 0 Then + + If TxtImporteEfectivo.Text.ToDecimal > 0 Then + Mensaje = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, TxtImporteEfectivo.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta) + End If + If TxtImporteCredito.Text.ToDecimal > 0 Then + Mensaje = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta) + End If + If TxtImporteDebito.Text.ToDecimal > 0 Then + Mensaje = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta) + End If + If TxtImporteCheque.Text.ToDecimal > 0 Then + Mensaje = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta) + End If + + Else + Mensaje = "Error al registrar prepólizas" + End If + + If Mensaje = "" Then + PnlContado.Visible = False + ObjConta.Commit() + CargaDatos() + Alert("Pago Registrado correctamente.", TipoMensaje.MsgInformacion) + Else + ObjConta.RollBack() + End If + + End If + + + + End Sub + + Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImportePago As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad) As String + Dim Retorno As String = "" + Dim CveIEPago As Integer = 0 + Dim ErrorConta As Boolean + CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImportePago, 1, 1, VentaActual.SerieFolio, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveIEPago > 0 Then + Dim Pago As New VentaPago + Pago.ImportePagoVenta = ImportePago + Pago.ImportePago = ImportePago + Pago.CveIE = CveIEPago + Pago.CveMonedaPago = VentaActual.CveMoneda + Pago.Fecha = NowADS() + Pago.Referencia = VentaActual.SerieFolio + + ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta) + If ErrorConta Then + Retorno = "Error en aplicación de pago" + End If + Else + Retorno = "Pago en Bancos no registrado" + ErrorConta = True + End If + + Return Retorno + End Function + +End Class diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index f25d14e3b..476164075 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2772,6 +2772,7 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then BtnCrearApartirDe.Visible = False If UsuarioActual.TienePermisoProceso(302) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Egs") Then BtnEditar.Visible = True + If UsuarioActual.TienePermisoProceso(302) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem") Then BtnPermisoEditarRemision.Visible = True DivFechaAnticipoCliente.Visible = True TxtFechaAnticipoCliente.Text = NowADS().ToShortDateString @@ -21219,6 +21220,7 @@ Partial Class Ventas DdlFormaPago33.Enabled = True UPCondicionesPago.Update() If Me.PermiteCredito Then RBLPago.Enabled = True + DdlVendedor.Enabled = True ModalidadEdicion = True