diff --git a/.gitignore b/.gitignore index da32853ea..7462e83a5 100644 --- a/.gitignore +++ b/.gitignore @@ -272,3 +272,4 @@ __pycache__/ /Default.aspx /Default.aspx.cs /App_WebReferences/WSRDLC +/wwwSIGGIT.rar diff --git a/AF/AF.aspx.vb b/AF/AF.aspx.vb index 8994113ac..f705a3c26 100644 --- a/AF/AF.aspx.vb +++ b/AF/AF.aspx.vb @@ -818,7 +818,7 @@ Partial Class AF_AF Filename = fileItem.filename Next - Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Licencias\{1}", AppDomain.CurrentDomain.BaseDirectory, Filename)) + Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Licencias\{1}", ModExtensiones.DirectorioBaseEmpresas, Filename)) If Archivo.Exists() Then Archivo.Delete() End If @@ -1743,102 +1743,102 @@ Partial Class AF_AF End If End If - End Sub - - 'Protected Sub GvResguardos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvResguardos.RowCancelingEdit - ' GvResguardos.EditIndex = -1 - ' GvResguardos.DataBind() - ' CargaResguardos() - 'End Sub - - 'Protected Sub GvResguardos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvResguardos.RowEditing - ' GvResguardos.EditIndex = e.NewEditIndex - ' CargaResguardos() - 'End Sub - - 'Protected Sub GvResguardos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvResguardos.RowUpdating - - ' Dim ObjResguardos As New ClsAF - - ' ' Dim FechaFin As String = DirectCast(GvResguardos.Rows(e.RowIndex).FindControl("TxtFechaFin"), TextBox).Text - ' ' FechaFin = If(IsDate(FechaFin), FechaFin, "-1") - ' Dim Observaciones As String = DirectCast(GvResguardos.Rows(e.RowIndex).FindControl("TxtObservaciones"), TextBox).Text.Trim - ' Dim URL As String = "-1" - ' Dim URL2 As String = "-1" - ' Dim RutaGuardar = "" - ' Dim RutaArchivo = "" - ' Dim RutaArchivo2 = "" - ' Dim Archivo As String = "" - ' Dim Archivo2 As String = "" - ' Dim CveActivoFijoResguardo As Integer = GvResguardos.DataKeys(e.RowIndex).Value.ToString.ToEntero - - ' 'If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(String.Format("{0}Temp\{1}", UsuarioActual.Empresa.Ruta, Session("FileUpload").ToString)) Then - ' ' Dim TmpArchivo As String = String.Format("{0}Temp\{1}", UsuarioActual.Empresa.Ruta, Session("FileUpload").ToString) - ' ' Dim TmpRuta As String = String.Format("{0}ActivosFijos\Resguardos\", UsuarioActual.Empresa.Ruta) - ' ' Dim Extension As String = Path.GetExtension(TmpArchivo) - ' ' TmpRuta.DirectoryExistsCreate() - ' ' 'If Not Directory.Exists(Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Resguardos\") Then Directory.CreateDirectory(Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Resguardos\") - ' ' TmpRuta = String.Format("{0}{1}{2}", TmpRuta, CveActivoFijoResguardo, Extension) - ' ' File.Move(TmpArchivo, TmpRuta) - ' ' Session("FileUpload") = "" - - ' ' If File.Exists(TmpRuta) Then - ' ' URL = URL & Extension - ' ' Else - ' ' URL = "" - ' ' End If - ' 'Else - ' ' URL = URLOld - ' 'End If - - - ' 'RutaGuardar = String.Format("{0}OI\", UsuarioActual.Empresa.Ruta) - ' 'If A2.HRef <> "" Then RutaArchivo = String.Format("{0}{1}", Request.PhysicalApplicationPath, A2.HRef.Substring(1)) - - - ' 'End If - - ' 'If UsuarioActual.CveRol = 1037 Then - ' ' RutaGuardar = String.Format("{0}Empresas\70\OI\", Request.PhysicalApplicationPath) - ' ' RutaGuardar.DirectoryExistsCreate() - ' 'End If - ' 'Else - ' RutaGuardar = String.Format("{0}AF\Resguardos\", UsuarioActual.Empresa.Ruta) - ' RutaArchivo = String.Format("{0}AF\Resguardos\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("AF")) - ' RutaArchivo2 = (String.Format("{0}AF\Resguardos\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("AF1"))) - - ' If Session("AF") IsNot Nothing AndAlso File.Exists(RutaArchivo) Then - ' If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar) - ' Archivo = Path.GetExtension(Session("AF").ToString) - ' File.Move(RutaArchivo, String.Format("{0}{1}", RutaGuardar, CveActivoFijoResguardo.ToString + "_1" + Archivo)) - ' Session("AF") = "" - ' URL = CveActivoFijoResguardo.ToString + "_1" + Archivo - ' End If - - - ' If Session("AF1") IsNot Nothing AndAlso File.Exists(RutaArchivo2) Then - ' If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar) - ' Archivo2 = Path.GetExtension(Session("AF1").ToString) - ' File.Move(RutaArchivo2, String.Format("{0}{1}", RutaGuardar, CveActivoFijoResguardo.ToString + "_2" + Archivo2)) - ' Session("AF1") = "" - ' URL2 = CveActivoFijoResguardo.ToString + "_2" + Archivo2 - ' End If - - - ' If ObjResguardos.UpdateActivosFijosResguardos("-1", Observaciones, URL, CveActivoFijoResguardo, -1, URL2) Then - ' GvResguardos.EditIndex = -1 - ' ViewState("DTResguardos") = ObjResguardos.DtResultados - ' GvResguardos.DataSource = ObjResguardos.DtResultados - ' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - ' 'If FechaFin <> "-1" Then DdlResponsable.Enabled = True : DdlResponsable.SelectedValue = "-1" - ' UPEstatus.Update() - ' End If - - ' ObjResguardos.Dispose() - ' GvResguardos.DataBind() - 'End Sub - - + End Sub + + 'Protected Sub GvResguardos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvResguardos.RowCancelingEdit + ' GvResguardos.EditIndex = -1 + ' GvResguardos.DataBind() + ' CargaResguardos() + 'End Sub + + 'Protected Sub GvResguardos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvResguardos.RowEditing + ' GvResguardos.EditIndex = e.NewEditIndex + ' CargaResguardos() + 'End Sub + + 'Protected Sub GvResguardos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvResguardos.RowUpdating + + ' Dim ObjResguardos As New ClsAF + + ' ' Dim FechaFin As String = DirectCast(GvResguardos.Rows(e.RowIndex).FindControl("TxtFechaFin"), TextBox).Text + ' ' FechaFin = If(IsDate(FechaFin), FechaFin, "-1") + ' Dim Observaciones As String = DirectCast(GvResguardos.Rows(e.RowIndex).FindControl("TxtObservaciones"), TextBox).Text.Trim + ' Dim URL As String = "-1" + ' Dim URL2 As String = "-1" + ' Dim RutaGuardar = "" + ' Dim RutaArchivo = "" + ' Dim RutaArchivo2 = "" + ' Dim Archivo As String = "" + ' Dim Archivo2 As String = "" + ' Dim CveActivoFijoResguardo As Integer = GvResguardos.DataKeys(e.RowIndex).Value.ToString.ToEntero + + ' 'If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(String.Format("{0}Temp\{1}", UsuarioActual.Empresa.Ruta, Session("FileUpload").ToString)) Then + ' ' Dim TmpArchivo As String = String.Format("{0}Temp\{1}", UsuarioActual.Empresa.Ruta, Session("FileUpload").ToString) + ' ' Dim TmpRuta As String = String.Format("{0}ActivosFijos\Resguardos\", UsuarioActual.Empresa.Ruta) + ' ' Dim Extension As String = Path.GetExtension(TmpArchivo) + ' ' TmpRuta.DirectoryExistsCreate() + ' ' 'If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Resguardos\") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Resguardos\") + ' ' TmpRuta = String.Format("{0}{1}{2}", TmpRuta, CveActivoFijoResguardo, Extension) + ' ' File.Move(TmpArchivo, TmpRuta) + ' ' Session("FileUpload") = "" + + ' ' If File.Exists(TmpRuta) Then + ' ' URL = URL & Extension + ' ' Else + ' ' URL = "" + ' ' End If + ' 'Else + ' ' URL = URLOld + ' 'End If + + + ' 'RutaGuardar = String.Format("{0}OI\", UsuarioActual.Empresa.Ruta) + ' 'If A2.HRef <> "" Then RutaArchivo = String.Format("{0}{1}", ModExtensiones.DirectorioBaseEmpresas, A2.HRef.Substring(1)) + + + ' 'End If + + ' 'If UsuarioActual.CveRol = 1037 Then + ' ' RutaGuardar = String.Format("{0}Empresas\70\OI\", ModExtensiones.DirectorioBaseEmpresas) + ' ' RutaGuardar.DirectoryExistsCreate() + ' 'End If + ' 'Else + ' RutaGuardar = String.Format("{0}AF\Resguardos\", UsuarioActual.Empresa.Ruta) + ' RutaArchivo = String.Format("{0}AF\Resguardos\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("AF")) + ' RutaArchivo2 = (String.Format("{0}AF\Resguardos\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("AF1"))) + + ' If Session("AF") IsNot Nothing AndAlso File.Exists(RutaArchivo) Then + ' If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar) + ' Archivo = Path.GetExtension(Session("AF").ToString) + ' File.Move(RutaArchivo, String.Format("{0}{1}", RutaGuardar, CveActivoFijoResguardo.ToString + "_1" + Archivo)) + ' Session("AF") = "" + ' URL = CveActivoFijoResguardo.ToString + "_1" + Archivo + ' End If + + + ' If Session("AF1") IsNot Nothing AndAlso File.Exists(RutaArchivo2) Then + ' If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar) + ' Archivo2 = Path.GetExtension(Session("AF1").ToString) + ' File.Move(RutaArchivo2, String.Format("{0}{1}", RutaGuardar, CveActivoFijoResguardo.ToString + "_2" + Archivo2)) + ' Session("AF1") = "" + ' URL2 = CveActivoFijoResguardo.ToString + "_2" + Archivo2 + ' End If + + + ' If ObjResguardos.UpdateActivosFijosResguardos("-1", Observaciones, URL, CveActivoFijoResguardo, -1, URL2) Then + ' GvResguardos.EditIndex = -1 + ' ViewState("DTResguardos") = ObjResguardos.DtResultados + ' GvResguardos.DataSource = ObjResguardos.DtResultados + ' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) + ' 'If FechaFin <> "-1" Then DdlResponsable.Enabled = True : DdlResponsable.SelectedValue = "-1" + ' UPEstatus.Update() + ' End If + + ' ObjResguardos.Dispose() + ' GvResguardos.DataBind() + 'End Sub + + #Region " ARCHIVO " Protected Sub ImgArchivo_Click(sender As Object, e As ImageClickEventArgs) CveResguardoPadre = CType(sender, ImageButton).CommandArgument.ToEntero @@ -1920,35 +1920,35 @@ Partial Class AF_AF nombreArchivoFormateado = nombreArchivoFormateado.Replace("~", "_") nombreArchivoFormateado = nombreArchivoFormateado.Replace("^", "_") Return nombreArchivoFormateado - End Function - + End Function + #End Region - - + + #End Region - + #Region "GALERIA DE IMAGENES" - 'Protected Sub BtnCargarArchivo_Click(sender As Object, e As System.EventArgs) Handles BtnCargarArchivo.Click - ' If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString) Then - ' Dim Extension As String = Path.GetExtension(Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString) - ' If Not Directory.Exists(Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes") Then Directory.CreateDirectory(Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes") - ' File.Move(Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString, Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\ActivosFijos\" & CveActivoFijo & "_" & ImgConsecutivo & Extension) - ' Session("FileUpload") = "" - - ' If File.Exists(Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes" & CveActivoFijo & "_" & ImgConsecutivo & Extension) Then - ' Dim ObjActivosFijos As New ClsAF - ' If ObjActivosFijos.AddActivosFijosImagenes(CveActivoFijo, CveActivoFijo & "_" & ImgConsecutivo & Extension, UsuarioActual.CveUsuario) Then - ' CargarArchivo() - ' Else - ' File.Delete(Request.PhysicalApplicationPath + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes" & CveActivoFijo & "_" & ImgConsecutivo & Extension) - ' End If - - ' ObjActivosFijos.Dispose() - - ' End If - ' End If - 'End Sub - + 'Protected Sub BtnCargarArchivo_Click(sender As Object, e As System.EventArgs) Handles BtnCargarArchivo.Click + ' If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString) Then + ' Dim Extension As String = Path.GetExtension(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString) + ' If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes") + ' File.Move(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString, ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\" & CveActivoFijo & "_" & ImgConsecutivo & Extension) + ' Session("FileUpload") = "" + + ' If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes" & CveActivoFijo & "_" & ImgConsecutivo & Extension) Then + ' Dim ObjActivosFijos As New ClsAF + ' If ObjActivosFijos.AddActivosFijosImagenes(CveActivoFijo, CveActivoFijo & "_" & ImgConsecutivo & Extension, UsuarioActual.CveUsuario) Then + ' CargarArchivo() + ' Else + ' File.Delete(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes" & CveActivoFijo & "_" & ImgConsecutivo & Extension) + ' End If + + ' ObjActivosFijos.Dispose() + + ' End If + ' End If + 'End Sub + Private Sub BtnUpFotos_Click(sender As Object, e As EventArgs) Handles BtnUpFotos.Click Dim FilesGral As List(Of Archivo) = TxtUpFotos.getfiles().Archivos @@ -1963,7 +1963,7 @@ Partial Class AF_AF Dim DirectorioOld As New StringBuilder Dim DirectorioNew As New StringBuilder DirectorioOld.AppendFormat("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, FileMove) - DirectorioNew.AppendFormat("{0}Empresas\{1}\AF\", AppDomain.CurrentDomain.BaseDirectory, CveEmpresaActual) + DirectorioNew.AppendFormat("{0}Empresas\{1}\AF\", ModExtensiones.DirectorioBaseEmpresas, CveEmpresaActual) If Not Directory.Exists(DirectorioNew.ToString) Then Directory.CreateDirectory(DirectorioNew.ToString) End If @@ -1995,7 +1995,7 @@ Partial Class AF_AF If (CveImagenActivoFijo > 0) Then Dim ObjActivoFijo As New ClsAF If ObjActivoFijo.RemoveActivosFijosImagenes(CveImagenActivoFijo) Then - File.Delete(String.Format("{0}Empresas\{1}\{2}", AppDomain.CurrentDomain.BaseDirectory, CveEmpresaActual, ObjActivoFijo.DtResultados.Rows(0)("URL"))) + File.Delete(String.Format("{0}Empresas\{1}\{2}", ModExtensiones.DirectorioBaseEmpresas, CveEmpresaActual, ObjActivoFijo.DtResultados.Rows(0)("URL"))) CargarArchivo() RegistraScript("initcarusel();") End If @@ -2407,7 +2407,7 @@ Partial Class AF_AF Dim filemove As String = "" For Each fileItem As Archivo In filesgral - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", ModExtensiones.DirectorioBaseEmpresas, fileItem.filename)).Replace(".", "") filemove = fileItem.filename Next diff --git a/AF/ResguardoAF.aspx.vb b/AF/ResguardoAF.aspx.vb index 0447d9c7d..5f48d7542 100644 --- a/AF/ResguardoAF.aspx.vb +++ b/AF/ResguardoAF.aspx.vb @@ -542,8 +542,8 @@ Partial Class AF_ResguardoAF If EsLiberacion Then If objAF.UpdateActivosFijosResguardosURL($"AFR{CveResguardoPadre}.{FileExtension}", "-1", CveResguardoPadre) Then If filemove <> "" Then - If File.Exists(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, AppDomain.CurrentDomain.BaseDirectory, FileExtension)) Then - File.Delete(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, AppDomain.CurrentDomain.BaseDirectory, FileExtension)) + If File.Exists(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) Then + File.Delete(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) End If If filemove.FilesMove(String.Format("AFR{0}", CveResguardoPadre), String.Format("Empresas\{0}\AF\Resguardos", UsuarioActual.CveEmpresa)) Then HuboError = False @@ -558,8 +558,8 @@ Partial Class AF_ResguardoAF If EsURL2 Then If objAF.UpdateActivosFijosResguardosURLGpo("-1", $"AFT{CveResguardoPadre}.{FileExtension}", CveResguardoPadre) Then If filemove <> "" Then - If File.Exists(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, AppDomain.CurrentDomain.BaseDirectory, FileExtension)) Then - File.Delete(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, AppDomain.CurrentDomain.BaseDirectory, FileExtension)) + If File.Exists(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) Then + File.Delete(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) End If If filemove.FilesMove(String.Format("AFT{0}", CveResguardoPadre), String.Format("Empresas\{0}\AF\Resguardos", UsuarioActual.CveEmpresa)) Then HuboError = False @@ -575,8 +575,8 @@ Partial Class AF_ResguardoAF If objAF.UpdateActivosFijosResguardosURLGpo($"AFR{CveResguardoPadre}.{FileExtension}", "-1", CveResguardoPadre) Then If filemove <> "" Then - If File.Exists(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, AppDomain.CurrentDomain.BaseDirectory, FileExtension)) Then - File.Delete(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, AppDomain.CurrentDomain.BaseDirectory, FileExtension)) + If File.Exists(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) Then + File.Delete(String.Format("{2}Empresas\{0}\AF\Resguardos\AFR{1}.{3}", UsuarioActual.CveEmpresa, CveResguardoPadre, ModExtensiones.DirectorioBaseEmpresas, FileExtension)) End If If filemove.FilesMove(String.Format("AFR{0}", CveResguardoPadre), String.Format("Empresas\{0}\AF\Resguardos", UsuarioActual.CveEmpresa)) Then HuboError = False diff --git a/AIMMGM/ConsultaCliente.aspx.vb b/AIMMGM/ConsultaCliente.aspx.vb index 17bcdf3cb..29c856863 100644 --- a/AIMMGM/ConsultaCliente.aspx.vb +++ b/AIMMGM/ConsultaCliente.aspx.vb @@ -323,7 +323,7 @@ Partial Class AIMMGM_ConsultaCliente 'Excel.DisplayAlerts = True 'Dim pdfFileOut As String 'Dim xlsxFileOut As String - 'Dim Ruta As String = String.Format("{0}\AIMMGM\Gafetes\", AppDomain.CurrentDomain.BaseDirectory) + 'Dim Ruta As String = String.Format("{0}\AIMMGM\Gafetes\", ModExtensiones.DirectorioBaseEmpresas) 'If IO.File.Exists(Ruta & "FormatoAIMMGM.xlsx") Then @@ -648,14 +648,14 @@ Partial Class AIMMGM_ConsultaCliente End If Dim AIM As New ClsAIMMGM - If Not IO.Directory.Exists(String.Format("{0}\Empresas\{1}\Documentos", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa)) Then - IO.Directory.CreateDirectory(String.Format("{0}\Empresas\{1}\Documentos", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa)) + If Not IO.Directory.Exists(String.Format("{0}\Empresas\{1}\Documentos", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) Then + IO.Directory.CreateDirectory(String.Format("{0}\Empresas\{1}\Documentos", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) End If Dim Cve As Integer = AIM.AddPago(CveCliente, CveVentaDetalle, TxtImporte.Text.ToDouble, 1, TxtFecha.Text.ToDate, IO.Path.GetExtension(FUComprobante.FileName), TxtObservaciones.Text.Trim, 9999, TxtAprobacion.Text.ToEntero) If Cve > 0 Then - FUComprobante.SaveAs(String.Format("{0}/Empresas/{1}/Documentos/{2}{3}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, Cve, IO.Path.GetExtension(FUComprobante.FileName))) + FUComprobante.SaveAs(String.Format("{0}/Empresas/{1}/Documentos/{2}{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Cve, IO.Path.GetExtension(FUComprobante.FileName))) Alert("Pago ingresado correctamente", TipoMensaje.MsgInformacion) End If AIM.Dispose() @@ -669,8 +669,8 @@ Partial Class AIMMGM_ConsultaCliente Exit Sub End If 'obtengo la clave de la publicidad - If Not IO.Directory.Exists(String.Format("{0}\Empresas\{1}\Documentos", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa)) Then - IO.Directory.CreateDirectory(String.Format("{0}\Empresas\{1}\Documentos", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa)) + If Not IO.Directory.Exists(String.Format("{0}\Empresas\{1}\Documentos", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) Then + IO.Directory.CreateDirectory(String.Format("{0}\Empresas\{1}\Documentos", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)) End If Dim Logo As String @@ -680,7 +680,7 @@ Partial Class AIMMGM_ConsultaCliente If AIM.DtResultados.Rows.Count > 0 Then CvePublicidad = AIM.DtResultados.Rows(0)("CvePublicidad").ToString.ToEntero Logo = String.Format("Logo{0}{1}", CvePublicidad, IO.Path.GetExtension(FULogo.FileName)) - FULogo.SaveAs(String.Format("{0}/Empresas/{1}/Documentos/{2}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, Logo)) + FULogo.SaveAs(String.Format("{0}/Empresas/{1}/Documentos/{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Logo)) AIM.UpdateLogo(CvePublicidad, Logo) ImgLogo.ImageUrl = String.Format("/Empresas/{0}/Documentos/{1}", UsuarioActual.CveEmpresa, Logo) diff --git a/AIMMGM/Pagos.aspx.vb b/AIMMGM/Pagos.aspx.vb index 0a19943c8..37f0c54a4 100644 --- a/AIMMGM/Pagos.aspx.vb +++ b/AIMMGM/Pagos.aspx.vb @@ -161,7 +161,7 @@ Partial Class AIMMGM_Pagos Next Next - Dim Archivoxlsx As String = String.Format("{0}/Empresas/{1}/Documentos/{2}.xlsx", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, NombreArchivoXLSX) + Dim Archivoxlsx As String = String.Format("{0}/Empresas/{1}/Documentos/{2}.xlsx", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, NombreArchivoXLSX) Using wb As New XLWorkbook() wb.Worksheets.Add(dtt) wb.SaveAs(Archivoxlsx) diff --git a/AIMMGM/Registro.aspx.vb b/AIMMGM/Registro.aspx.vb index 225c98d00..cc37fbe2f 100644 --- a/AIMMGM/Registro.aspx.vb +++ b/AIMMGM/Registro.aspx.vb @@ -125,7 +125,7 @@ Partial Class AIMMGM_Registro Private Sub CargaReCompra(ClavePago As String, CveCliente As Integer) Dim tmp As New DataTable - Dim Carpeta As String = String.Format("{0}AIMMGM/ePagos", AppDomain.CurrentDomain.BaseDirectory) + Dim Carpeta As String = String.Format("{0}AIMMGM/ePagos", ModExtensiones.DirectorioBaseEmpresas) Dim Archivo As String = String.Format("{0}/{1}.xml", Carpeta, ClavePago) Dim Archivo2 As String = String.Format("{0}/C{1}.xml", Carpeta, ClavePago) diff --git a/AIMMGM/ePagos.aspx.vb b/AIMMGM/ePagos.aspx.vb index 9011af649..75fc0b45a 100644 --- a/AIMMGM/ePagos.aspx.vb +++ b/AIMMGM/ePagos.aspx.vb @@ -90,7 +90,7 @@ Partial Class AIMMGM_ePagos Private Sub CargaCompra() Dim tmp As New DataTable - Dim Carpeta As String = String.Format("{0}AIMMGM/ePagos", AppDomain.CurrentDomain.BaseDirectory) + Dim Carpeta As String = String.Format("{0}AIMMGM/ePagos", ModExtensiones.DirectorioBaseEmpresas) Dim Archivo As String = String.Format("{0}/{1}.xml", Carpeta, ClavePago) Dim Archivo2 As String = String.Format("{0}/C{1}.xml", Carpeta, ClavePago) diff --git a/App_Code/BundleConfig.vb b/App_Code/BundleConfig.vb index e3da720f1..4331cdfa4 100644 --- a/App_Code/BundleConfig.vb +++ b/App_Code/BundleConfig.vb @@ -33,6 +33,28 @@ Public Class BundleConfig "~/Scripts/exporting.js" )) + bundles.Add(New ScriptBundle("~/Metronic/assets/global/scripts/JSNoCustom").Include( + "~/Metronic/assets/global/plugins/bootstrap/js/bootstrap.min.js", + "~/Metronic/assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js", + "~/Metronic/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js", + "~/Metronic/assets/global/plugins/jquery.blockui.min.js", + "~/Metronic/assets/global/plugins/jquery.cokie.min.js", + "~/Metronic/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js", + "~/Metronic/assets/global/plugins/select2/select2.full.min.js", + "~/Metronic/assets/global/plugins/select2/i18n/es.js", + "~/Metronic/assets/global/plugins/bootstrap-confirmation/bootstrap-confirmation.min.js", + "~/Metronic/assets/global/plugins/bootbox/bootbox.min.js", + "~/Metronic/assets/global/plugins/bootstrap-toastr/toastr.min.js", + "~/Metronic/assets/global/scripts/metronic.js", + "~/Metronic/assets/admin/layout/scripts/layout.js", + "~/Metronic/assets/admin/layout/scripts/quick-sidebar.js", + "~/Metronic/assets/admin/layout/scripts/demo.js", + "~/Metronic/assets/admin/pages/scripts/table-advanced.js", + "~/Metronic/assets/admin/pages/scripts/ui-alert-dialog-api.js", + "~/Metronic/assets/global/plugins/icheck/icheck.min.js", + "~/Metronic/assets/global/plugins/dropzone/dropzone.js", + "~/Metronic/assets/layouts/layout3/scripts/jquery.datetimepicker.full.js" + )) bundles.Add(New ScriptBundle("~/Metronic/assets/global/scripts/JS").Include( "~/Metronic/assets/global/plugins/bootstrap/js/bootstrap.min.js", "~/Metronic/assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js", diff --git a/App_Code/ClsAcarreos.vb b/App_Code/ClsAcarreos.vb index e039cb589..6ec08daaa 100644 --- a/App_Code/ClsAcarreos.vb +++ b/App_Code/ClsAcarreos.vb @@ -391,7 +391,7 @@ Public Class ClsAcarreos Dim CveAcarreo As Integer = Data(0)(0).ToString.ToEntero Dim AcarreoFolio As Integer = Data(0)(1).ToString.ToEntero - Dim Raiz As String = String.Format("{0}Empresas\{1}\Acarreos\", HttpContext.Current.Server.MapPath("~/"), CveEmpresa) + Dim Raiz As String = String.Format("{0}Empresas\{1}\Acarreos\", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa) If Not Directory.Exists(Raiz) Then Directory.CreateDirectory(Raiz) diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index 2d74b5f69..e451e5b44 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -797,6 +797,21 @@ Public Class ClsAcumuladores Return Retorno End Function + Public Function EliminarGarantiasDetalle(CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + SqlDataAdapter("PA_Acum_GarantiasDetallePolizaRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error a eliminar de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + #End Region @@ -863,6 +878,21 @@ Public Class ClsAcumuladores End Try Return Retorno End Function + + Public Function EliminarPolizaVirtual(CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + SqlDataAdapter("PA_Vta_PolizaVirtualRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un al eliminar poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function #End Region Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Integer, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer, diff --git a/App_Code/ClsDG.vb b/App_Code/ClsDG.vb index 7f6dad9c2..b4b540c45 100644 --- a/App_Code/ClsDG.vb +++ b/App_Code/ClsDG.vb @@ -614,7 +614,7 @@ Public Class ClsDG strLineaTMP = String.Format("{0} {1}:{2} {3} {0}", Chr(13), DateTime.Now.ToShortDateString, DateTime.Now.ToShortTimeString, pTexto) Try - ArchivoW = New StreamWriter(String.Format("{0}\LogDG.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8) + ArchivoW = New StreamWriter(String.Format("{0}\LogDG.txt", AppDomain.CurrentDomain), True, System.Text.Encoding.UTF8) Catch ex As Exception Exit Sub End Try diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 2a91b7d8b..aace420e7 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1232,7 +1232,14 @@ Public Class ClsInventarios Return Retorno End Function - + ''' + ''' Obtiene los valores para asignar a los movimientos virtuales + ''' + ''' Debe ser un movimiento de Salida o Entrada de almacen (2,3,18) + ''' + ''' + ''' Cuando sea cancelacion/devolucion hay que mandar este dato que seria la salida de almacen + ''' Public Function GetMovimientosDetalleVirtual(CveMovimiento As Integer, CveEmpresa As Integer, Optional CveCompra As Integer = -1, Optional CveMovimientoRelacionado As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_MovimientosDetalleVirtualGet") diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index a6056e0b2..658e42ace 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -15,6 +15,7 @@ Public Enum OITipoEventos ISO = 8 Soporte = 9 Gastos_Mes = 10 + Convocatorias = 11 End Enum Public Class ObjEventosCorreo @@ -218,9 +219,220 @@ Public Class ClsOIEventos Public Property objCorreo As ObjEventosCorreo #End Region +#Region "Trello" + Public Function GetTablero(cveTablero As Int32, cveUsuario As Int32, cveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_GetTablero", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTablero", SqlDbType.Int).Value = (cveTablero) + .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) + .Add("@CveEmpresa", SqlDbType.Int).Value = (cveEmpresa) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Tablero.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function AddTablero(tablero As String, cveUsuario As Int32, cveUsuarioIng As Int32, cveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_AddTablero", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@Tablero", SqlDbType.VarChar).Value = (tablero) + .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) + .Add("@CveUsuarioIng", SqlDbType.Int).Value = (cveUsuarioIng) + .Add("@CveEmpresa", SqlDbType.Int).Value = (cveEmpresa) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Tablero.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function UpTablero(cveTablero As Int32, tablero As String, cveUsuario As Int32, cveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_UpTablero", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTablero", SqlDbType.Int).Value = (cveTablero) + .Add("@Tablero", SqlDbType.VarChar).Value = (tablero) + .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) + .Add("@CveEmpresa", SqlDbType.Int).Value = (cveEmpresa) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Tablero.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function RemoveTablero(cveTablero As Int32, cveUsuario As Int32, cveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_RemoveTablero", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTablero", SqlDbType.Int).Value = (cveTablero) + .Add("@CveUsuario", SqlDbType.Int).Value = (cveUsuario) + .Add("@CveEmpresa", SqlDbType.Int).Value = (cveEmpresa) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Tablero.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + Public Function UpEventoLista(cveTableroLista As Int32, CveEvento As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_EventoLista", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTableroLista", SqlDbType.Int).Value = (cveTableroLista) + .Add("@CveEvento", SqlDbType.Int).Value = (CveEvento) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la Lista.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + + Public Function GetTableroListaTrello(cveTablero As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_GetTableroListaTrello", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTablero", SqlDbType.Int).Value = (cveTablero) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la Lista.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + Public Function GetTableroLista(cveTableroLista As Int32, cveTablero As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_GetTableroLista", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTableroLista", SqlDbType.Int).Value = (cveTableroLista) + .Add("@CveTablero", SqlDbType.Int).Value = (cveTablero) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la Lista.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function AddTableroLista(cveTablero As Int32, lista As String, cveUsuarioIng As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_AddTableroLista", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTablero", SqlDbType.Int).Value = cveTablero + .Add("@Lista", SqlDbType.VarChar).Value = (lista) + .Add("@CveUsuarioIng", SqlDbType.Int).Value = (cveUsuarioIng) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la Lista.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function UpTableroLista(cveTableroLista As Int32, lista As String) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_UpTableroLista", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTableroLista", SqlDbType.Int).Value = (cveTableroLista) + .Add("@Lista", SqlDbType.VarChar).Value = (lista) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Tablero.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function RemoveTableroLista(cveTableroLista As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_RemoveTableroLista", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTableroLista", SqlDbType.Int).Value = (cveTableroLista) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la Lista.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function +#End Region #Region "oieventos2.0" + Public Function UpEventosVinculos(cveEvento As Int32, cveActivoFijo As Int32, cveIE As Int32, cveProspecto As Int32, cveCliente As Int32, cveOS As Int32, cveOC As Int32, cvePersonal As Int32, + cveProveedor As Int32, cveCompra As Int32, cveVenta As Int32, cveContrato As Int32, cveSubProyecto As Int32, cveMovimientoAlmacen As Int32, + cveEmpresaCRM As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_EventosVinculosUp", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEvento", SqlDbType.Int).Value = (cveEvento) + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveActivoFijo", SqlDbType.Int).Value = (cveActivoFijo) + .Add("@CveIE", SqlDbType.Int).Value = (cveIE) + .Add("@CveProspecto", SqlDbType.Int).Value = (cveProspecto) + .Add("@CveCliente", SqlDbType.Int).Value = (cveCliente) + .Add("@CveOS", SqlDbType.Int).Value = (cveOS) + .Add("@CveOC", SqlDbType.Int).Value = (cveOC) + .Add("@CvePersonal", SqlDbType.Int).Value = (cvePersonal) + .Add("@CveProveedor", SqlDbType.Int).Value = (cveProveedor) + .Add("@CveCompra", SqlDbType.Int).Value = (cveCompra) + .Add("@CveVenta", SqlDbType.Int).Value = (cveVenta) + .Add("@CveContrato", SqlDbType.Int).Value = (cveContrato) + .Add("@CveSubProyecto", SqlDbType.Int).Value = (cveSubProyecto) + .Add("@CveMovimientoAlmacen", SqlDbType.Int).Value = (cveMovimientoAlmacen) + .Add("@CveEmpresaCRM", SqlDbType.Int).Value = (cveEmpresaCRM) + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Evento .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + Public Function RemoveEvento2(cveEvento As Integer, CveEmpresa As Integer, cveUsuario As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_OI_EventosRemove2", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEvento", SqlDbType.Int).Value = cveEvento + .Add("@cveUsuario", SqlDbType.Int).Value = cveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Evento .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function Public Function GetEventosUsuario2(CveEvento As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OI_EventosUsuarios2Get") @@ -238,13 +450,32 @@ Public Class ClsOIEventos Return Retorno End Function - Public Function UpUsuarioseventosVisto(CveEvento As Integer, CveUsuario As Integer) As Boolean + Public Function GetEventosVinculos(CveEvento As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False - DataAdapter("UPDATE OI_EventosUsuarios SET Visto=1 WHERE CveEvento =@CveEvento AND CveUsuario=@CveUsuario", CommandType.Text) + DataAdapter("PA_OI_EventosVinculosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEvento", SqlDbType.Int).Value = CveEvento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Evento Usuario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function UpUsuarioseventosVisto(CveEvento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + 'DataAdapter("UPDATE OI_EventosUsuarios SET Visto=1 WHERE CveEvento =@CveEvento AND CveUsuario=@CveUsuario;IF @@ROWCOUNT >0 BEGIN INSERT INTO OI_EventosComentarios (CveEvento, EventoComentario, CveUsuario) VALUES ( @CveEvento, CONCAT('El Usuario ""',(SELECT Nombre FROM Usuarios WHERE CveUsuario=@CveUsuario),'"" a visto la tarea'), @CveUsuario); END", CommandType.Text) + DataAdapter("PA_OI_EventosUpVisto") With SqlAdapter.SelectCommand.Parameters .Add("@CveEvento", SqlDbType.Int).Value = CveEvento .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try SqlAdapter.Fill(Data) @@ -286,17 +517,21 @@ Public Class ClsOIEventos Return retorno End Function - Public Function AddEventoMinuta2(Asunto As String, Descripcion As String, Acuerdos As String, CveUsuarioDe As Integer, CveUsuarioPara As Integer, FechaInicio As DateTime, Archivo As String, Lmiembros As List(Of Integer), chkList As List(Of String), CveUsuarioIng As Integer, CveEmpresa As Integer) As Boolean + Public Function AddEventoMinuta2(Asunto As String, Descripcion As String, Acuerdos As String, CveUsuarioDe As Integer, CveUsuarioPara As Integer, FechaInicio As DateTime, Archivo As String, Lmiembros As List(Of Integer), chkList As List(Of String), CveUsuarioIng As Integer, CveEmpresa As Integer, CorreoExterno As String) As Boolean Dim Retorno As Boolean = False - Retorno = AddOI_Eventos2(OITipoEventos.Minuta, Asunto, Descripcion, 3, -1, -1, String.Format("{0:yyyy/MM/dd HH:mm}", FechaInicio), "1900/01/01 00:00", -1, Archivo, Lmiembros, chkList, CveUsuarioIng, CveEmpresa, -1, Acuerdos) + Retorno = AddOI_Eventos2(OITipoEventos.Minuta, Asunto, Descripcion, 3, -1, -1, String.Format("{0:yyyy/MM/dd HH:mm}", FechaInicio), "1900/01/01 00:00", -1, Archivo, Lmiembros, chkList, CveUsuarioIng, CveEmpresa, -1, Acuerdos, CorreoExterno:=CorreoExterno) 'Retorno = AddEvento(5, -1, Asunto, Descripcion, 1, -1, -1, FechaInicio, ("01/01/1799").ToDate, -1, -1, "-1", CveUsuarioIng, CveEmpresa, -1, -1, -1, -1, -1, -1, -1, -1) Return Retorno End Function Public Function AddOI_Eventos2(cveTipoEvento As OITipoEventos, asunto As String, descripcion As String, prioridad As Int32, cveUsuarioDe As Int32, cveUsuarioPara As Int32, fechaInicio As String, fechaFin As String, cveRevision As Int32, archivo As String, Lmiembros As List(Of Integer), chkList As List(Of String), - cveUsuarioIng As Int32, cveEmpresa As Int32, Optional CveEventoPadre As Integer = -1, Optional Acuerdos As String = Nothing, Optional CveAgendaTipo As Integer = -1) As Boolean + cveUsuarioIng As Int32, cveEmpresa As Int32, Optional CveEventoPadre As Integer = -1, Optional Acuerdos As String = Nothing, Optional CveAgendaTipo As Integer = -1, + Optional CveActivoFijo As Integer = -1, Optional CveIE As Integer = -1, Optional CveProspecto As Integer = -1, Optional CveCliente As Integer = -1, + Optional CveOS As Integer = -1, Optional CveOC As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveProveedor As Integer = -1, + Optional CveCompra As Integer = -1, Optional CveVenta As Integer = -1, Optional CveContrato As Integer = -1, Optional CveSubProyecto As Integer = -1, + Optional CveMovimientoAlmacen As Integer = -1, Optional CorreoExterno As String = "", Optional CveTableroLista As Integer = -1, Optional Lugar As String = "") As Boolean Dim retorno As Boolean = False Dim xmlMiembros As System.Xml.Linq.XDocument = Nothing @@ -339,6 +574,24 @@ Public Class ClsOIEventos .Add("@CveEventoPadre", SqlDbType.Int).Value = CveEventoPadre .Add("@Acuerdos", SqlDbType.VarChar).Value = If(Acuerdos Is Nothing, DBNull.Value, DirectCast(Acuerdos, Object)) .Add("@CveAgendaTipo", SqlDbType.Int).Value = CveAgendaTipo + + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveProspecto", SqlDbType.Int).Value = CveProspecto + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveOS", SqlDbType.Int).Value = CveOS + .Add("@CveOC", SqlDbType.Int).Value = CveOC + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveMovimientoAlmacen", SqlDbType.Int).Value = CveMovimientoAlmacen + .Add("@CorreoExterno", SqlDbType.VarChar).Value = CorreoExterno + .Add("@Lugar", SqlDbType.VarChar).Value = Lugar + .Add("@CveTableroLista", SqlDbType.VarChar).Value = CveTableroLista + '.Add("@mailPara", SqlDbType.VarChar).Direction = ParameterDirection.Output '.Add("@mailBody", SqlDbType.Xml).Direction = ParameterDirection.Output End With @@ -1561,8 +1814,10 @@ Public Class ClsOIEventos SqlAdapter.Fill(Data) Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al guardar Tema.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) Catch ex As Exception - OnError("Ocurrió un error al guardar la Revision de Eventos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al guardar Tema.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 2564c030d..f0f9ee342 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -70,7 +70,11 @@ Public Class ClsPaginas Get Try 'UsuarioActual = DirectCast(Session("UsuarioSIG"), Usuario) - UsuarioActual = CType(Context.Session("UsuarioSIG"), Usuario) + If Context.Session("UsuarioSIG") Is Nothing Then + Usuario.CerrarSession() + Else + UsuarioActual = CType(Context.Session("UsuarioSIG"), Usuario) + End If Catch ex As Exception Usuario.CerrarSession() Return Nothing @@ -3579,6 +3583,10 @@ Public Class ClsPaginas PaginaDict.Add("/OI/Tareas.aspx".ToUpper(), -1) PaginaDict.Add("/OI/RepProyectos.aspx".ToUpper(), -1) PaginaDict.Add("/OI/Proyecto.aspx".ToUpper(), -1) + PaginaDict.Add("/OI/Tablero.aspx".ToUpper(), -1) + PaginaDict.Add("/OI/TableroDetalle.aspx".ToUpper(), -1) + PaginaDict.Add("/OI/ConvocatoriaDetalle.aspx".ToUpper(), -1) + PaginaDict.Add("/OI/RepReuniones.aspx".ToUpper(), -1) PaginaDict.Add("/AdSistemasTeam/ProcedimientosAlmacenados.aspx".ToUpper(), -1) PaginaDict.Add("/OS/CatOrdenesServiciosCaracteristicas.aspx".ToUpper(), -1) PaginaDict.Add("/OS/CatOSCaracteristicasOpciones.aspx".ToUpper(), -1) @@ -5182,13 +5190,15 @@ Public Class ClsPaginas Dim sw As New System.Diagnostics.Stopwatch() sw.Start() Dim Bytes As Byte() = Nothing + + Dim bdir As String = If(RutaReporte.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory) + RutaReporte.Replace("/", "\") + If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then + RutaReporte = String.Format("{0}{1}", bdir, RutaReporte) + End If + If EsProduccion Then - Dim bdir As String = AppDomain.CurrentDomain.BaseDirectory - RutaReporte.Replace("/", "\") - If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then - RutaReporte = String.Format("{0}{1}", bdir, RutaReporte) - End If Dim CveUsuario As Integer = 0 Dim CveEmpresa As Integer = 0 If Context.Session("UsuarioSIG") IsNot Nothing Then @@ -5580,7 +5590,7 @@ Public Class ClsPaginas Dim retorno As Byte() = Nothing 'DATOS GENERALES - Dim Ruta As String = $"{AppDomain.CurrentDomain.BaseDirectory}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" Dim PathXML As String = $"{Ruta}XML\{Vta.TipoDocto}\{Vta.SerieFolio}.xml" Dim NombreArchivo As String = "" Dim NombreArchivoDescarga As String = "" @@ -6093,7 +6103,7 @@ Public Class ClsPaginas ' Dim ObjVentas As New ClsVentas 'DATOS GENERALES - Dim Ruta As String = $"{AppDomain.CurrentDomain.BaseDirectory}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" Dim PathXML As String = $"{Ruta}XML\{Vta.TipoDocto}\{Vta.SerieFolio}.xml" Dim NombreArchivo As String = "" Dim NombreArchivoDescarga As String = "" @@ -6797,7 +6807,7 @@ Public Class ClsPaginas Dim rds5 As New ReportDataSource With {.Name = "DataSet5", .Value = If(Vta.DtNCVinculadas IsNot Nothing, Vta.DtNCVinculadas, New DataTable)} ' sino esta creado el objeto, lo creamos, para que no truene el reporte lrds.Add(rds5) - If UsuarioActual.CveEmpresa = 141 AndAlso RutaFormato.Contains("Factura") Then + If UsuarioActual.CveEmpresa = 141 AndAlso (RutaFormato.Contains("Factura") Or RutaFormato.Contains("Cotizacion")) Then params.Add(New ReportParameter("Kilometraje", Vta.Kilometraje.ToString)) End If 'Imprime los parametros @@ -7195,10 +7205,15 @@ Public Class ClsPaginas End If 'params.Add(New ReportParameter("FechaOC", ObjOC.Fecha.ToShortDateString)) + Dim RutaFisicaSol As String = String.Format("Empresas\{0}\Firmas\{1}.png", EmpresaActual.CveEmpresa, CveUsuarioSol) + Dim RutaVirtuaSol As String = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={0}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(RutaFisicaSol)) Dim FirmaSol As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", EmpresaActual.Ruta, CveUsuarioSol)) - params.Add(New ReportParameter("FirmaSolicito", If(FirmaSol.Exists, New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", EmpresaActual.CveEmpresa, CveUsuarioSol))).AbsoluteUri, ""))) + params.Add(New ReportParameter("FirmaSolicito", If(FirmaSol.Exists, RutaVirtuaSol, ""))) + + Dim RutaFisicaAut As String = String.Format("Empresas\{0}\Firmas\{1}.png", EmpresaActual.CveEmpresa, CveUsuarioAut) + Dim RutaVirtuaAut As String = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(RutaFisicaAut)) Dim FirmaAut As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", EmpresaActual.Ruta, CveUsuarioAut)) - params.Add(New ReportParameter("FirmaAutorizo", If(FirmaAut.Exists, New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", EmpresaActual.CveEmpresa, CveUsuarioAut))).AbsoluteUri, ""))) + params.Add(New ReportParameter("FirmaAutorizo", If(FirmaAut.Exists, RutaVirtuaAut, ""))) If Archivo.Exists Then bytes = StreamPDF(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta), DtDetalle, params, $"OC_{ObjOC.Folio.ToString}", RDSName:="DsOC", MR:=MR) @@ -7445,7 +7460,7 @@ Public Class ClsPaginas Dim DTPercepciones As Data.DataTable Dim DTDeducciones As Data.DataTable - Dim Ruta As String = $"{AppDomain.CurrentDomain.BaseDirectory}Empresas\{CveEmpresa}\" + Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\" Dim PathXML As String = $"{Ruta}XML\Nomina\{ObjNomina.SerieFolio}.xml" Dim FechaEmision, FechaCertificacion As DateTime Dim FolioFiscal, NoSerieCertificado, NoSerieCertificadoContribuyente, SelloCFDi, SelloSAT As String @@ -7750,7 +7765,7 @@ Public Class ClsPaginas params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToString)) 'DATOS GENERALES - Dim Ruta As String = $"{AppDomain.CurrentDomain.BaseDirectory}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" Dim PathXML As String = $"{Ruta}XML\Pag\{Serie}-{Folio}.xml" Dim PathPDF As String = $"{Ruta}PDF\Pag\{Serie}-{Folio}.pdf" SerieFolio = $"{Serie}-{Folio}" diff --git a/App_Code/ClsSCTLicencias.vb b/App_Code/ClsSCTLicencias.vb index 943f606b1..bdf704c01 100644 --- a/App_Code/ClsSCTLicencias.vb +++ b/App_Code/ClsSCTLicencias.vb @@ -676,7 +676,7 @@ End Class ' dtMenu.TableName = "ModulosUsuarios" ' Try -' dtMenu.WriteXml(AppDomain.CurrentDomain.BaseDirectory & "\Menu\" & _Usuario & ".xml", XmlWriteMode.WriteSchema) +' dtMenu.WriteXml(ModExtensiones.DirectorioBaseEmpresas & "\Menu\" & _Usuario & ".xml", XmlWriteMode.WriteSchema) ' Retorno = True ' Catch ex As Exception ' OnError("Ocurrió un error al generar el menú del usuario.", ex) diff --git a/App_Code/ClsSisEmpresas.vb b/App_Code/ClsSisEmpresas.vb index 19ac5cf29..8c83cfb7a 100644 --- a/App_Code/ClsSisEmpresas.vb +++ b/App_Code/ClsSisEmpresas.vb @@ -445,7 +445,7 @@ Public Class ClsSisEmpresas _Empresa.Buzon_Tipo = Data.Rows(0)("Buzon_Tipo").ToString _Empresa.ContaContabilizacionNC = Data.Rows(0)("Conta_ContabilizacionNC").ToString.ToEntero - _Empresa.Ruta = String.Format("{0}Empresas\{1}\", AppDomain.CurrentDomain.BaseDirectory, _Empresa.CveEmpresa) + '_Empresa.Ruta = String.Format("{0}Empresas\{1}\", ModExtensiones.DirectorioBaseEmpresas, _Empresa.CveEmpresa) _Empresa.PV_TerminalTipo = Data.Rows(0)("PV_TerminalTipo").ToString.ToEntero _Empresa.EjercicioActual = Data.Rows(0)("EjercicioActual").ToString.ToEntero _Empresa.PeriodoActual = Data.Rows(0)("PeriodoActual").ToString.ToEntero diff --git a/App_Code/ClsSisNotificaciones.vb b/App_Code/ClsSisNotificaciones.vb index bbe272683..c914aa79e 100644 --- a/App_Code/ClsSisNotificaciones.vb +++ b/App_Code/ClsSisNotificaciones.vb @@ -320,7 +320,7 @@ Public Class ClsSisNotificaciones Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) Dim ObjGPS As New ClsGPS Try - RutaReporte = $"{AppDomain.CurrentDomain.BaseDirectory}/Empresas/Grales/ReportesProgramados/RPTUltimaPosicion.rdlc" + RutaReporte = $"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/Grales/ReportesProgramados/RPTUltimaPosicion.rdlc" Dim Direcciones As JArray = Nothing If Formato = "Excel" Then Dim Dispositivos As New StringBuilder @@ -369,7 +369,7 @@ Public Class ClsSisNotificaciones Dim ObjGPS As New ClsGPS Try - RutaReporte = $"{AppDomain.CurrentDomain.BaseDirectory}/Empresas/Grales/ReportesProgramados/RPTHistorico.rpt" + RutaReporte = $"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/Grales/ReportesProgramados/RPTHistorico.rpt" Dim ObjMail As New ClsSisMail() Dim ResultadoMail As Integer = 0 Dim Archivos As New List(Of ClsSisMail.ArchivoMail) @@ -429,7 +429,7 @@ Public Class ClsSisNotificaciones Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) Dim ObjGPS As New ClsGPS Try - RutaReporte = $"{AppDomain.CurrentDomain.BaseDirectory}/Empresas/Grales/ReportesProgramados/RPTiempoMuerto.rpt" + RutaReporte = $"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/Grales/ReportesProgramados/RPTiempoMuerto.rpt" Dim DataSource As DataSet = Nothing Dim Direcciones As JArray = Nothing If Formato = "Excel" Then @@ -478,7 +478,7 @@ Public Class ClsSisNotificaciones Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) Dim ObjGPS As New ClsGPS Try - RutaReporte = $"{AppDomain.CurrentDomain.BaseDirectory}/Empresas/Grales/ReportesProgramados/RPTEventos.rpt" + RutaReporte = $"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/Grales/ReportesProgramados/RPTEventos.rpt" Dim Direcciones As JArray = Nothing Dim Dispositivos As New StringBuilder For Each Row As DataRow In DtDispositivos.Rows @@ -520,7 +520,7 @@ Public Class ClsSisNotificaciones Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) Dim ObjGPS As New ClsGPS Try - RutaReporte = $"{AppDomain.CurrentDomain.BaseDirectory}/Empresas/Grales/ReportesProgramados/RPTRalenti.rdlc" + RutaReporte = $"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/Grales/ReportesProgramados/RPTRalenti.rdlc" Dim Direcciones As JArray = Nothing If Formato = "Excel" Then Dim Dispositivos As New StringBuilder @@ -565,7 +565,7 @@ Public Class ClsSisNotificaciones End Try ObjGPS.Dispose() Case 6 'Geocercas - RutaReporte = $"{AppDomain.CurrentDomain.BaseDirectory}/Empresas/Grales/ReportesProgramados/RPGeocercas.rdlc" + RutaReporte = $"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/Grales/ReportesProgramados/RPGeocercas.rdlc" Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) Dim ObjGPS As New ClsGPS Try @@ -604,7 +604,7 @@ Public Class ClsSisNotificaciones End Try ObjGPS.Dispose() Case 7 'Puntos de Interes - RutaReporte = $"{AppDomain.CurrentDomain.BaseDirectory}/Empresas/Grales/ReportesProgramados/RPPuntosDeInteres.rdlc" + RutaReporte = $"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/Grales/ReportesProgramados/RPPuntosDeInteres.rdlc" Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) Dim ObjGPS As New ClsGPS Try diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index a9e28e571..5d07b8c90 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -4496,6 +4496,25 @@ Public Class ClsVentas Return Retorno End Function + + Public Function EliminarUsados(CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_VentasUsadosRemove", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function GetVentasUsados(CveVenta As Integer, CveSubProyecto As Integer, Fecha As DateTime, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/Empresa.vb b/App_Code/Empresa.vb index 2492f959c..d2fef276f 100644 --- a/App_Code/Empresa.vb +++ b/App_Code/Empresa.vb @@ -101,7 +101,11 @@ Public Class Empresa Public Property Soporte_PWD As String Public Property Soporte_Tipo As String Public Property Timbres As Integer - Public Property Ruta As String + Public ReadOnly Property Ruta As String + Get + Return String.Format("{0}\{1}\", Extensiones.ModExtensiones.DirectorioEmpresas, Me.CveEmpresa) + End Get + End Property Public Property IdCuentaIVAxTrasladar As Integer Public Property IdCuentaIVATrasladado As Integer Public Property IdCuentaPerdidaCambiaria As Integer diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index b8b2b091a..cda859572 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -328,7 +328,7 @@ Namespace Modelos End If SetMetodoPago(ObjsClsPaginas) Timbre = New CFDITimbre - DirectorioServidor = ObjsClsPaginas.Server.MapPath("/") + DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas End Sub Public Sub New(ObjsClsPaginas As ClsPaginas, CveVenta As Integer, CveEmpresa As Integer) @@ -342,7 +342,7 @@ Namespace Modelos End If End If ObjVentas.Dispose() - DirectorioServidor = ObjsClsPaginas.Server.MapPath("/") + DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas End Sub Public Sub New(ObjsClsPaginas As ClsPaginas, UsuarioActual As Usuario, Optional Row As Data.DataRow = Nothing) Me.UsuarioActual = UsuarioActual @@ -359,7 +359,7 @@ Namespace Modelos SetSubProyecto(ObjsClsPaginas) SetSubProyectoMatriz(ObjsClsPaginas) Timbre = New CFDITimbre - DirectorioServidor = ObjsClsPaginas.Server.MapPath("/") + DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas End Sub Public Sub New(UsuarioActual As Usuario, Optional Row As Data.DataRow = Nothing) Me.UsuarioActual = UsuarioActual @@ -400,7 +400,7 @@ Namespace Modelos ObjVentas.Dispose() IniciaValoresVentas(EsCancelacion) If String.IsNullOrEmpty(DirectorioServidor) Then - DirectorioServidor = HttpContext.Current.Server.MapPath("/") + DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas End If Me.DirectorioServidor = DirectorioServidor Timbre = New CFDITimbre @@ -878,9 +878,9 @@ Namespace Modelos Try If Not String.IsNullOrEmpty(DirectorioServidor) Then - Dim DirectoriArchivoXML As String = System.IO.Path.Combine(DirectorioServidor, "Empresas", UsuarioActual.CveEmpresa.ToString, Me.TipoDocto) - If Not Directory.Exists(DirectoriArchivoXML) Then - Directory.CreateDirectory(DirectoriArchivoXML) + Dim DirectorioArchivoXML As String = System.IO.Path.Combine(UsuarioActual.Empresa.Ruta, "XML", Me.TipoDocto) + If Not Directory.Exists(DirectorioArchivoXML) Then + Directory.CreateDirectory(DirectorioArchivoXML) End If End If @@ -4537,6 +4537,13 @@ Namespace Modelos End If End If + + 'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL + If Not GeneraMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowMovimiento("CveMovimiento").ToString().ToEntero(), ObjInventario) Then + ErrorCancelar = True + MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar." + End If + 'AGREGA BITACORA A VENTA If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimientoDevolucion > 0 Then Dim MensajeBitacora = "Devuelta" @@ -4580,12 +4587,6 @@ Namespace Modelos Next End If - 'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL - If Not GeneraMovimientosVirtuales(CveVenta, ObjInventario) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar." - End If - 'VERIFICAR MOVIMIENTOS DE APARTADOS If Not ErrorCancelar Then If Not GeneraMovimientosApartados(ObjInventario) Then @@ -4809,41 +4810,36 @@ Namespace Modelos Return Retorno End Function - Private Function GeneraMovimientosVirtuales(CveVenta As Integer, ByRef ObjInventario As ClsInventarios) As Boolean + Private Function GeneraMovimientosVirtuales(CveVenta As Integer, CveMovimiento As Integer, CveMovimientoRelacionado As Integer, ByRef ObjInventario As ClsInventarios) As Boolean Dim ErrorCancelar As Boolean = False Try If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then - Dim CveMovimientoSalida As Integer = -1 - Dim CveAlmacenVirutal As Integer = -1 + Dim CveMovimientoVirtual As Integer = -1 + Dim ValidaVirtual = True + Dim DtPSVirtual As New DataTable("DtTamanios") - Dim DtMovtosDev As DataTable = Nothing - - If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then - Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND CveTipoAlmacen = 24 AND CveConcepto = 3 AND CveVenta > 0") - CveMovimientoSalida = RowMovimiento("CveMovimiento").ToString().ToEntero() - CveAlmacenVirutal = RowMovimiento("CveAlmacen").ToString().ToEntero() - Else - ErrorCancelar = True + If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoRelacionado) Then + DtPSVirtual = ObjInventario.DtResultados End If - If CveMovimientoSalida > 0 Then - 'CARGA CONCEPTOS DEVUELTOS EN LA VENTA - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - DtMovtosDev = ObjInventario.DtResultados.Copy() - Else - ErrorCancelar = True - End If + Dim CveConceptoMovimientoVirtual As Integer = 36 + Dim CveAlmacenVirtual As Integer = -1 + Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento - If DtMovtosDev IsNot Nothing AndAlso DtMovtosDev.Rows.Count > 0 Then - Dim CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenVirutal, 18, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, CveMovimientoRelacionado:=CveMovimientoSalida) + CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero() - For Each RowUsado As DataRow In DtMovtosDev.Rows + If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then + CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, + Observaciones:="", Guia:="", CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="Modelos/CancelarVirtual") + + If CveMovimientoVirtual > 0 Then + For Each RowUsado As DataRow In DtPSVirtual.Rows Dim CvePS = RowUsado("CvePS").ToString().ToEntero() Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble() - Dim PU As Decimal = RowUsado("PU").ToString().ToDecimal() + Dim PU As Decimal = RowUsado("PUOriginal").ToString().ToDecimal() Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero() - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then ErrorCancelar = True Exit For End If @@ -4851,7 +4847,14 @@ Namespace Modelos Else ErrorCancelar = True End If + Else + If ValidaVirtual Then + ErrorCancelar = True + End If + End If + If DtPSVirtual.Rows.Count = 0 AndAlso ValidaVirtual = True Then + ErrorCancelar = True End If End If Catch ex As Exception @@ -4861,6 +4864,7 @@ Namespace Modelos Return Not ErrorCancelar End Function + Private Function GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento As Integer, ByRef ObjVentas As ClsVentas, ByRef ObjInventario As ClsInventarios, ByRef DtDevRem As DataTable, ByRef ListaRemisionesCancelar As List(Of Integer)) As Boolean Dim ErrorCancelar As Boolean = False diff --git a/App_Code/WS/WSApiController.vb b/App_Code/WS/WSApiController.vb index 720bea720..f01545bfb 100644 --- a/App_Code/WS/WSApiController.vb +++ b/App_Code/WS/WSApiController.vb @@ -18,7 +18,7 @@ Public Class WSApiController Public ReadOnly Property RutaEmpresa As String Get - Return String.Format("{0}Empresas\{1}\", AppDomain.CurrentDomain.BaseDirectory, Decripta(Request.Headers.Authorization.Parameter).Split("|"c)(4)) + Return String.Format("{0}Empresas\{1}\", ModExtensiones.DirectorioBaseEmpresas, Decripta(Request.Headers.Authorization.Parameter).Split("|"c)(4)) End Get End Property ' diff --git a/App_Code/WS/WSUSer.vb b/App_Code/WS/WSUSer.vb index d2bf5a24d..cc02c4fab 100644 --- a/App_Code/WS/WSUSer.vb +++ b/App_Code/WS/WSUSer.vb @@ -108,7 +108,7 @@ Namespace SIG If ObjEmpresas.GetEmpresas(-1, "-1", "-1", "-1", "-1") Then 'verifico si existe la carpeta de la empresa, sino la crea For Each dr As Data.DataRow In ObjEmpresas.DtResultados.Rows - Dim Ruta As String = String.Format("{0}Empresas\{1}", AppDomain.CurrentDomain.BaseDirectory, dr("CveEmpresa")) + Dim Ruta As String = String.Format("{0}Empresas\{1}", ModExtensiones.DirectorioBaseEmpresas, dr("CveEmpresa")) If Not IO.Directory.Exists(Ruta) Then IO.Directory.CreateDirectory(Ruta) If Not System.IO.Directory.Exists(String.Format("{0}\XML\", Ruta)) Then System.IO.Directory.CreateDirectory(String.Format("{0}\XML\", Ruta)) If Not System.IO.Directory.Exists(String.Format("{0}\PDF\", Ruta)) Then System.IO.Directory.CreateDirectory(String.Format("{0}\PDF\", Ruta)) diff --git a/App_Code/WS_PuntoVenta.vb b/App_Code/WS_PuntoVenta.vb index 9fd221fe0..cd18bf021 100644 --- a/App_Code/WS_PuntoVenta.vb +++ b/App_Code/WS_PuntoVenta.vb @@ -1467,7 +1467,7 @@ Public Class WS_PuntoVenta Dim ObjEmpresa As New ClsSisEmpresas() If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then Empresa = ObjEmpresa.Empresa - Empresa.Ruta = String.Format("{0}Empresas\{1}\", AppDomain.CurrentDomain.BaseDirectory, CveEmpresa) + 'Empresa.Ruta = String.Format("{0}Empresas\{1}\", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa) End If ObjEmpresa.Dispose() diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index ed22628cc..7f7473927 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -29,16 +29,36 @@ Imports System.Web.Http.Controllers Imports System.Net.Http Imports System.Net -Namespace Extensiones - +Namespace Extensiones + #Region "E X T E N S I O N E S" - Public Module ModExtensiones + Public Module ModExtensiones + Public ReadOnly Property DirectorioBaseEmpresas As String + Get + If IsNothing(System.Configuration.ConfigurationManager.AppSettings("DirectorioBaseEmpresas")) Then + Return AppDomain.CurrentDomain.BaseDirectory + Else + Return System.Configuration.ConfigurationManager.AppSettings("DirectorioBaseEmpresas").ToString() + End If + End Get + End Property + Public ReadOnly DirectorioEmpresas As String = String.Format("{0}Empresas\", DirectorioBaseEmpresas) + + Public ReadOnly Property GOOGLE_MAPS_API_KEY As String + Get + If IsNothing(System.Configuration.ConfigurationManager.AppSettings("GOOGLE_MAPS_API_KEY")) Then + Return "" + Else + Return System.Configuration.ConfigurationManager.AppSettings("GOOGLE_MAPS_API_KEY").ToString() + End If + End Get + End Property Public Const IMEI As String = "IMEISISTEMAGERENCIAL" Public Const MinFecha As Date = #1/1/1900# Public Const MaxFecha As Date = #1/1/9999# - Public Const GlobalRowVersion As Integer = 555555 - + Public Const GlobalRowVersion As Integer = 555555 + #Region "PropiedadesEncriptación" Private _Key() As Byte = {} Private ReadOnly _IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF} @@ -78,10 +98,10 @@ Namespace Extensiones Else Return Valor End If - End Function - + End Function + #Region "Log" - + Public Sub GuardaLog(Str As String) Dim ArchivoW As StreamWriter @@ -227,11 +247,11 @@ Namespace Extensiones End Try ArchivoW.Close() ArchivoW.Dispose() - End Sub + End Sub #End Region - + #Region "Alertas y notificaciones" - + Public Enum TipoMensaje As Integer MsgError = 1 MsgInformacion = 2 @@ -317,7 +337,7 @@ Namespace Extensiones script = String.Format("alertatoast({3},'{0}',function(){{{1}}},{2});", Mensaje, JSBtnAceptar, TimeoutToast, DirectCast(pOpcion, Integer)) End If - ScriptManager.RegisterStartupScript(Pag, Pag.GetType(), String.Format("Alert{0}", (DateTime.Now.Ticks + 1).ToString()), Script, True) + ScriptManager.RegisterStartupScript(Pag, Pag.GetType(), String.Format("Alert{0}", (DateTime.Now.Ticks + 1).ToString()), script, True) Pag = Nothing Catch ex As Exception Mensaje.GuardaLog(String.Format("Error Alert : {0}", Mensaje)) @@ -400,35 +420,35 @@ Namespace Extensiones Dim Time As String = "" If Fecha <> "" Then Time = String.Format("{0}", Fecha) Return String.Format("
  • {0}{3}
  • ", Time, Tipo, Ico, Mensaje, Link) - End Function - ' - 'Public Function addindicador(Obj As Object, color As String, icono As String, titulo As String, comentario As String, link As String) As String - ' Try - ' Dim htmlobj = DirectCast(Obj, HtmlGenericControl) - ' color = color.Replace("'", "\'") - ' icono = icono.Replace("'", "\'") - ' titulo = titulo.Replace("'", "\'") - ' comentario = comentario.Replace("'", "\'") - ' link = link.Replace("'", "\'") - ' Dim script As String = " addindicadortext('" & color & "','" & icono & "','" & titulo & "','" & comentario & "','" & link & "',$('#" & htmlobj.ClientID.ToString & "')); " - ' Return script - - ' Catch ex As Exception - ' Return "" - ' End Try - 'End Function - - ' - 'Public Sub updateindicador(Obj As Object, script As String) - ' Dim Pag As Page = DirectCast(System.Web.HttpContext.Current.Handler, Page) - ' ScriptManager.RegisterStartupScript(Pag, Pag.GetType(), (DateTime.Now.Ticks + 1).ToString(), script, True) - ' Pag = Nothing - 'End Sub - + End Function + ' + 'Public Function addindicador(Obj As Object, color As String, icono As String, titulo As String, comentario As String, link As String) As String + ' Try + ' Dim htmlobj = DirectCast(Obj, HtmlGenericControl) + ' color = color.Replace("'", "\'") + ' icono = icono.Replace("'", "\'") + ' titulo = titulo.Replace("'", "\'") + ' comentario = comentario.Replace("'", "\'") + ' link = link.Replace("'", "\'") + ' Dim script As String = " addindicadortext('" & color & "','" & icono & "','" & titulo & "','" & comentario & "','" & link & "',$('#" & htmlobj.ClientID.ToString & "')); " + ' Return script + + ' Catch ex As Exception + ' Return "" + ' End Try + 'End Function + + ' + 'Public Sub updateindicador(Obj As Object, script As String) + ' Dim Pag As Page = DirectCast(System.Web.HttpContext.Current.Handler, Page) + ' ScriptManager.RegisterStartupScript(Pag, Pag.GetType(), (DateTime.Now.Ticks + 1).ToString(), script, True) + ' Pag = Nothing + 'End Sub + #End Region - + #Region "files dropzone" - + Public Function getfiles(txt As TextBox) As Files Dim retorno As New Files @@ -458,7 +478,14 @@ Namespace Extensiones Else newName = String.Format("{0}{1}", newName, IO.Path.GetExtension(directorioOld.ToString())) End If - directorioNew.AppendFormat("{0}{1}\", AppDomain.CurrentDomain.BaseDirectory, newDirectorio) + + 'SI VA A LA CARPETA DE EMPRESAS TIENE QUE TOMAR LA RUTA DE EMPRESAS + If newDirectorio.Contains("Empresas") Then + directorioNew.AppendFormat("{0}{1}\", ModExtensiones.DirectorioBaseEmpresas, newDirectorio) + Else + directorioNew.AppendFormat("{0}{1}\", AppDomain.CurrentDomain.BaseDirectory, newDirectorio) + End If + If Not Directory.Exists(directorioNew.ToString) Then Directory.CreateDirectory(directorioNew.ToString) End If @@ -478,9 +505,9 @@ Namespace Extensiones 'Verifico que no exista el directory y que se halla creado, si se creo el directorio regresa true Return Not Directory.Exists(NombreDirectorio) AndAlso Directory.CreateDirectory(NombreDirectorio) IsNot Nothing - End Function + End Function #End Region - + #Region " obj to entero date, double, etc. formato numero" Public Function ToEnterodb(Obj As SqlClient.SqlDataReader, key As String) As Integer @@ -914,13 +941,13 @@ Namespace Extensiones Public Function Abs(Valor As Decimal) As Decimal Return Math.Abs(Valor) - End Function - - + End Function + + #End Region - + #Region "DataTable operation" - 'Dejar el parametro 'dt' en ByVal, para que no se autoasigne el valor, en el caso de filtrar lo GlobalDT(ByRef, pierde los valores y solo deja los filtrados) + 'Dejar el parametro 'dt' en ByVal, para que no se autoasigne el valor, en el caso de filtrar lo GlobalDT(ByRef, pierde los valores y solo deja los filtrados) Public Function FiltraParametros(dt As DataTable, RowFilter As String, Optional Orderby As String = "", Optional DistinctColumns() As String = Nothing) As DataTable Dim TmpDt As New DataTable @@ -1351,12 +1378,12 @@ Namespace Extensiones names.Add(column.ColumnName) Next Return names - End Function - + End Function + #End Region - + #Region "gridview operations" - + Public Function FCHyperLink(ByVal Row As GridViewRow, ByVal Control As String) As HyperLink Return DirectCast(Row.FindControl(Control), HyperLink) @@ -1475,9 +1502,9 @@ Namespace Extensiones Public Function FCRangeValidator(ByVal Row As GridViewRow, ByVal Control As String) As RangeValidator Return DirectCast(Row.FindControl(Control), RangeValidator) - End Function + End Function #End Region - + #Region "Excel PDF" Public Sub GeneraChequePDF(pCveIE As Integer, tEmpresa As Empresa, Optional IDPoliza As Integer = -1, Optional MuestraAlert As Boolean = True) @@ -1540,7 +1567,7 @@ Namespace Extensiones ' If Not IO.File.Exists(String.Format("{0}Cheques\", Ruta)) Then IO.Directory.CreateDirectory(String.Format("{0}Cheques\", Ruta)) ' If Not IO.File.Exists(Ruta & FormatoCheque) Then - ' IO.File.Copy(String.Format("{0}Empresas\Grales\Cheque.xlsm", AppDomain.CurrentDomain.BaseDirectory), Ruta & FormatoCheque, False) + ' IO.File.Copy(String.Format("{0}Empresas\Grales\Cheque.xlsm", ModExtensiones.DirectorioBaseEmpresas), Ruta & FormatoCheque, False) ' End If ' Dim ArchivoBase As New System.IO.FileInfo(Ruta & FormatoCheque) @@ -1770,7 +1797,7 @@ Namespace Extensiones ' If Not IO.File.Exists(String.Format("{0}Cheques\", Ruta)) Then IO.Directory.CreateDirectory(String.Format("{0}Cheques\", Ruta)) ' If Not IO.File.Exists(String.Format("{0}{1}", Ruta, FormatoCheque)) Then - ' IO.File.Copy(String.Format("{0}Empresas\Grales\Transferencia.xlsm", AppDomain.CurrentDomain.BaseDirectory), String.Format("{0}{1}", Ruta, FormatoCheque), False) + ' IO.File.Copy(String.Format("{0}Empresas\Grales\Transferencia.xlsm", ModExtensiones.DirectorioBaseEmpresas), String.Format("{0}{1}", Ruta, FormatoCheque), False) ' End If ' Dim ArchivoBase As New System.IO.FileInfo(String.Format("{0}{1}", Ruta, FormatoCheque)) @@ -2164,16 +2191,15 @@ Namespace Extensiones worksheet.Rows(IndexEndTable).Cells(6).Value = "Fecha Impresión" worksheet.Rows(IndexEndTable + 1).Cells(6).Value = DateTime.Now.ToString("dd/MM/yyyy") - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) - - If Imagen.Exists Then - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Usuario.CveEmpresa) - Using webClient As New Net.WebClient() - Dim imageBytes = webClient.DownloadData(logouri) - Dim stream As New MemoryStream(imageBytes) - worksheet.Pictures.Add(stream, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) - 'worksheet.Pictures.Add(stream, GemBox.Spreadsheet.ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, GemBox.Document.LengthUnit.Pixel) - End Using + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) + + If Imagen.Exists Then + Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) + Using sr As New StreamReader(Ruta) + Dim ms As New MemoryStream() + sr.BaseStream.CopyTo(ms) + worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + End Using End If End If @@ -2353,164 +2379,164 @@ Namespace Extensiones Gv.Controls(0).Controls.AddAt(0, row) End If - End Sub - 'Public Function GeneraBytesOC(tCveOrdenCompra As Integer, Optional MR As ReportViewer = Nothing, Optional ConBitacora As Boolean = False) As Byte() - ' Dim bytes As Byte() = Nothing - ' Try - - ' Dim DtDetalle As DataTable = Nothing - ' Dim ObjOC As New ClsOC - ' If ObjOC.GetOC(tCveOrdenCompra, ObjClsPaginas.UsuarioActual.CveEmpresa) Then - ' Dim dtOC As DataTable = ObjOC.DtResultados - ' If ObjOC.GetOrdenesDetalle(ObjOC.CveOrdenCompra) Then 'Obtenemos el Detalle de la Oorden de Compra - ' DtDetalle = ObjOC.DtResultados - ' End If - - ' Dim CveUsuarioSol As Integer = dtOC(0)("CveUsuarioSolicito").ToString.ToEntero - ' Dim CveUsuarioAut As Integer = dtOC(0)("CveUsuarioAutorizo").ToString.ToEntero - ' Dim drSol As DataRow = ObjClsPaginas.GlobalDTUsuarios(CveUsuarioSol, ObjClsPaginas.UsuarioActual.CveEmpresa).FiltroPrimero("") 'DataRow (incluye el NOMBRE de quien SOLICITÓ la OC) - ' Dim drAut As DataRow = ObjClsPaginas.GlobalDTUsuarios(CveUsuarioAut, ObjClsPaginas.UsuarioActual.CveEmpresa).FiltroPrimero("") 'DataRow (incluye el NOMBRE de quien AUTORIZÓ la OC) - - ' Dim CvePersonalSol, CvePersonalAut As Integer - - ' Dim PuestoSol As String = "" - ' Dim PuestoAut As String = "" - - ' If drSol IsNot Nothing AndAlso drSol("CvePersonal").ToString.ToEntero > 0 Then CvePersonalSol = drSol("CvePersonal").ToString.ToEntero - ' If drAut IsNot Nothing AndAlso drAut("CvePersonal").ToString.ToEntero > 0 Then CvePersonalAut = drAut("CvePersonal").ToString.ToEntero - - ' Dim ObjRH As New ClsRH() - ' If ObjRH.GetPersonal(CvePersonalSol, ObjClsPaginas.UsuarioActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then - ' PuestoSol = ObjRH.DtResultados(0)("Puesto").ToString - ' End If - ' If ObjRH.GetPersonal(CvePersonalAut, ObjClsPaginas.UsuarioActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then - ' PuestoAut = ObjRH.DtResultados(0)("Puesto").ToString - ' End If - ' ObjRH.Dispose() - - ' Dim TipoCambio As String - ' If ObjOC.CveMoneda = 1 Then - ' TipoCambio = "1.00" - ' Else - ' TipoCambio = ObjClsPaginas.GlobalTipoCambio.ToString() - ' End If - - ' Dim params As New List(Of ReportParameter) - - ' Dim nombreautorizo As String = dtOC(0)("UsuarioAutorizo").ToString - - ' 'If ObjClsPaginas.UsuarioActual.CveEmpresa = 48 Then - ' ' nombreautorizo = "Lic. LUIS JORGE CONTRERAS LANDGRAVE" - ' 'End If - - ' If ObjClsPaginas.UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12) Then - ' params.Add(New ReportParameter("ReferenciaBancaria", dtOC(0)("BancoCuenta").ToString)) - ' params.Add(New ReportParameter("ReferenciaBanco", dtOC(0)("BancoNombre").ToString)) - ' params.Add(New ReportParameter("Justificacion", dtOC(0)("Justificacion").ToString)) - ' params.Add(New ReportParameter("TipoTermino", ObjOC.TipoTermino.ToString)) - ' params.Add(New ReportParameter("Proyecto", If(DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0, DtDetalle.MAX("SubProyecto").ToString, ""))) - ' params.Add(New ReportParameter("Descuento", DtDetalle.SUM("Descuento").ToString.FormatoNumero(2))) - ' params.Add(New ReportParameter("SubTotal", DtDetalle.SUM("Total").ToString)) - ' Else - ' params.Add(New ReportParameter("Proyecto", If(DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0, DtDetalle.MAX("Proyecto").ToString, ""))) - ' params.Add(New ReportParameter("SubTotal", ObjOC.SubTotal.ToString)) - ' End If - ' params.Add(New ReportParameter("CentroCostos", If(DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0, DtDetalle.MAX("Proyecto").ToString, ""))) - ' params.Add(New ReportParameter("FechaSolicitud", ObjOC.Fecha.ToShortDateString)) - ' params.Add(New ReportParameter("Folio", ObjOC.Folio.ToString)) - ' params.Add(New ReportParameter("ProveedorNombre", ObjOC.RazonSocial)) - ' params.Add(New ReportParameter("ProveedorDireccion", ObjOC.Direccion)) - ' params.Add(New ReportParameter("ProveedorLugar", ObjOC.LugarEntrega)) - ' params.Add(New ReportParameter("ProveedorTel", ObjOC.Telefono)) - ' params.Add(New ReportParameter("ProveedorRFC", ObjOC.RFC)) - ' params.Add(New ReportParameter("Asunto", ObjOC.Justificacion)) - ' params.Add(New ReportParameter("IVA", ObjOC.IVA.ToString)) - ' params.Add(New ReportParameter("RetIVA", ObjOC.RetIVA.ToString.FormatoNumero(2))) - ' params.Add(New ReportParameter("RetISR", ObjOC.RetISR.ToString.FormatoNumero(2))) - ' params.Add(New ReportParameter("Total", ObjOC.Total.ToString)) - ' params.Add(New ReportParameter("ImporteLetra", (ObjOC.Total).ToString.ToDouble.Texto2Letras(ObjOC.CveMoneda))) - ' params.Add(New ReportParameter("CorreoControl", If(drAut IsNot Nothing, drAut("Correo").ToString, ""))) - ' params.Add(New ReportParameter("Moneda", ObjOC.Moneda)) - ' params.Add(New ReportParameter("TipoCambio", TipoCambio)) - ' params.Add(New ReportParameter("NombreSolicito", dtOC(0)("UsuarioSolicito").ToString)) 'drSol("Nombre").ToString)) - ' params.Add(New ReportParameter("PuestoSolicito", PuestoSol)) 'drPuestoSol("Puesto").ToString - ' params.Add(New ReportParameter("NombreAutorizo", nombreautorizo)) - ' params.Add(New ReportParameter("PuestoAutorizo", PuestoAut)) 'drPuestoAut("Puesto").ToString - ' params.Add(New ReportParameter("TipoOC", If(ObjOC.Tipo = "OC", "Orden de Compra", "Requisición"))) - ' params.Add(New ReportParameter("Estatus", ObjOC.Estatus)) - ' params.Add(New ReportParameter("Descripcion", ObjOC.Descripcion)) - ' params.Add(New ReportParameter("FechaEstimadaEntrega", ObjOC.FechaEstimadaEntrega.ToShortDateString)) - ' 'params.Add(New ReportParameter("FechaOC", ObjOC.Fecha.ToShortDateString)) - ' Dim FirmaSol As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", ObjClsPaginas.UsuarioActual.Empresa.Ruta, CveUsuarioSol)) - ' params.Add(New ReportParameter("FirmaSolicito", If(FirmaSol.Exists, New Uri(ObjClsPaginas.Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", ObjClsPaginas.UsuarioActual.CveEmpresa, CveUsuarioSol))).AbsoluteUri, ""))) - ' Dim FirmaAut As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", ObjClsPaginas.UsuarioActual.Empresa.Ruta, CveUsuarioAut)) - ' params.Add(New ReportParameter("FirmaAutorizo", If(FirmaAut.Exists, New Uri(ObjClsPaginas.Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", ObjClsPaginas.UsuarioActual.CveEmpresa, CveUsuarioAut))).AbsoluteUri, ""))) - ' Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\OC.rdlc", ObjClsPaginas.UsuarioActual.Empresa.Ruta)) - ' If Archivo.Exists Then - ' bytes = ObjClsPaginas.StreamPDF(String.Format("{0}Formatos\OC.rdlc", ObjClsPaginas.UsuarioActual.Empresa.Ruta), DtDetalle, params, "OrdenCompra", RDSName:="DsOC", MR:=MR) - ' Else - ' params.Add(New ReportParameter("Empresa", ObjClsPaginas.UsuarioActual.Empresa.Empresa)) - ' bytes = ObjClsPaginas.StreamPDF("Empresas\Grales\Formatos\OC.rdlc", DtDetalle, params, "OrdenCompra", RDSName:="DsOC", MR:=MR) - ' End If - ' If ConBitacora Then - ' Dim dttemp As New DataTable - ' Dim ObjEventoBitacora As New ClsOIEventos() - ' If ObjEventoBitacora.GetAgendaBitacora(ObjClsPaginas.UsuarioActual.CveUsuario, ObjClsPaginas.UsuarioActual.CveEmpresa, CveOC:=tCveOrdenCompra) Then - ' dttemp = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2") - ' End If - ' ObjEventoBitacora.Dispose() - ' If Not IsNothing(dttemp) AndAlso dttemp.Rows.Count > 0 Then - - ' Dim paramsest As New List(Of ReportParameter) - ' paramsest.Add(New ReportParameter("Empresa", ObjClsPaginas.UsuarioActual.Empresa.Empresa)) - ' paramsest.Add(New ReportParameter("Titulo", "Bitácora de órdenes de compra")) - ' paramsest.Add(New ReportParameter("Folio", ObjOC.Folio.ToString)) - ' paramsest.Add(New ReportParameter("TipoOC", If(ObjOC.Tipo = "OC", "Orden de Compra", "Requisición"))) - ' Dim bytes2 As Byte() - ' bytes2 = ObjClsPaginas.StreamPDF("Empresas\Grales\Formatos\Bitacora.rdlc", dttemp, paramsest, "OrdenCompra", MR:=MR) - ' Using ms As New MemoryStream() - ' Using document As New iTextSharp.text.Document() - ' Using copy As New PdfCopy(document, ms) - ' document.Open() - - ' Dim reader As New PdfReader(bytes) - ' ' loop over the pages in that document - ' Dim n As Integer = reader.NumberOfPages - ' Dim page As Integer = 0 - ' While page < n - ' page = page + 1 - ' copy.AddPage(copy.GetImportedPage(reader, page)) - ' End While - - - ' reader = New PdfReader(bytes2) - ' ' loop over the pages in that document - ' n = reader.NumberOfPages - ' page = 0 - ' While page < n - ' page = page + 1 - ' copy.AddPage(copy.GetImportedPage(reader, page)) - ' End While - - ' End Using - ' End Using - ' bytes = ms.ToArray() - ' End Using - ' End If - ' dttemp.Dispose() - ' End If - - ' End If - ' ObjOC.Dispose() - - ' DtDetalle.Dispose() - - ' Catch ex As Exception - ' GuardaLog(String.Format("Ocurrio un error al generar el strem de la oc={0}. {1}", tCveOrdenCompra, ex.Message)) - ' End Try - - ' Return bytes - 'End Function + End Sub + 'Public Function GeneraBytesOC(tCveOrdenCompra As Integer, Optional MR As ReportViewer = Nothing, Optional ConBitacora As Boolean = False) As Byte() + ' Dim bytes As Byte() = Nothing + ' Try + + ' Dim DtDetalle As DataTable = Nothing + ' Dim ObjOC As New ClsOC + ' If ObjOC.GetOC(tCveOrdenCompra, ObjClsPaginas.UsuarioActual.CveEmpresa) Then + ' Dim dtOC As DataTable = ObjOC.DtResultados + ' If ObjOC.GetOrdenesDetalle(ObjOC.CveOrdenCompra) Then 'Obtenemos el Detalle de la Oorden de Compra + ' DtDetalle = ObjOC.DtResultados + ' End If + + ' Dim CveUsuarioSol As Integer = dtOC(0)("CveUsuarioSolicito").ToString.ToEntero + ' Dim CveUsuarioAut As Integer = dtOC(0)("CveUsuarioAutorizo").ToString.ToEntero + ' Dim drSol As DataRow = ObjClsPaginas.GlobalDTUsuarios(CveUsuarioSol, ObjClsPaginas.UsuarioActual.CveEmpresa).FiltroPrimero("") 'DataRow (incluye el NOMBRE de quien SOLICITÓ la OC) + ' Dim drAut As DataRow = ObjClsPaginas.GlobalDTUsuarios(CveUsuarioAut, ObjClsPaginas.UsuarioActual.CveEmpresa).FiltroPrimero("") 'DataRow (incluye el NOMBRE de quien AUTORIZÓ la OC) + + ' Dim CvePersonalSol, CvePersonalAut As Integer + + ' Dim PuestoSol As String = "" + ' Dim PuestoAut As String = "" + + ' If drSol IsNot Nothing AndAlso drSol("CvePersonal").ToString.ToEntero > 0 Then CvePersonalSol = drSol("CvePersonal").ToString.ToEntero + ' If drAut IsNot Nothing AndAlso drAut("CvePersonal").ToString.ToEntero > 0 Then CvePersonalAut = drAut("CvePersonal").ToString.ToEntero + + ' Dim ObjRH As New ClsRH() + ' If ObjRH.GetPersonal(CvePersonalSol, ObjClsPaginas.UsuarioActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then + ' PuestoSol = ObjRH.DtResultados(0)("Puesto").ToString + ' End If + ' If ObjRH.GetPersonal(CvePersonalAut, ObjClsPaginas.UsuarioActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then + ' PuestoAut = ObjRH.DtResultados(0)("Puesto").ToString + ' End If + ' ObjRH.Dispose() + + ' Dim TipoCambio As String + ' If ObjOC.CveMoneda = 1 Then + ' TipoCambio = "1.00" + ' Else + ' TipoCambio = ObjClsPaginas.GlobalTipoCambio.ToString() + ' End If + + ' Dim params As New List(Of ReportParameter) + + ' Dim nombreautorizo As String = dtOC(0)("UsuarioAutorizo").ToString + + ' 'If ObjClsPaginas.UsuarioActual.CveEmpresa = 48 Then + ' ' nombreautorizo = "Lic. LUIS JORGE CONTRERAS LANDGRAVE" + ' 'End If + + ' If ObjClsPaginas.UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12) Then + ' params.Add(New ReportParameter("ReferenciaBancaria", dtOC(0)("BancoCuenta").ToString)) + ' params.Add(New ReportParameter("ReferenciaBanco", dtOC(0)("BancoNombre").ToString)) + ' params.Add(New ReportParameter("Justificacion", dtOC(0)("Justificacion").ToString)) + ' params.Add(New ReportParameter("TipoTermino", ObjOC.TipoTermino.ToString)) + ' params.Add(New ReportParameter("Proyecto", If(DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0, DtDetalle.MAX("SubProyecto").ToString, ""))) + ' params.Add(New ReportParameter("Descuento", DtDetalle.SUM("Descuento").ToString.FormatoNumero(2))) + ' params.Add(New ReportParameter("SubTotal", DtDetalle.SUM("Total").ToString)) + ' Else + ' params.Add(New ReportParameter("Proyecto", If(DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0, DtDetalle.MAX("Proyecto").ToString, ""))) + ' params.Add(New ReportParameter("SubTotal", ObjOC.SubTotal.ToString)) + ' End If + ' params.Add(New ReportParameter("CentroCostos", If(DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0, DtDetalle.MAX("Proyecto").ToString, ""))) + ' params.Add(New ReportParameter("FechaSolicitud", ObjOC.Fecha.ToShortDateString)) + ' params.Add(New ReportParameter("Folio", ObjOC.Folio.ToString)) + ' params.Add(New ReportParameter("ProveedorNombre", ObjOC.RazonSocial)) + ' params.Add(New ReportParameter("ProveedorDireccion", ObjOC.Direccion)) + ' params.Add(New ReportParameter("ProveedorLugar", ObjOC.LugarEntrega)) + ' params.Add(New ReportParameter("ProveedorTel", ObjOC.Telefono)) + ' params.Add(New ReportParameter("ProveedorRFC", ObjOC.RFC)) + ' params.Add(New ReportParameter("Asunto", ObjOC.Justificacion)) + ' params.Add(New ReportParameter("IVA", ObjOC.IVA.ToString)) + ' params.Add(New ReportParameter("RetIVA", ObjOC.RetIVA.ToString.FormatoNumero(2))) + ' params.Add(New ReportParameter("RetISR", ObjOC.RetISR.ToString.FormatoNumero(2))) + ' params.Add(New ReportParameter("Total", ObjOC.Total.ToString)) + ' params.Add(New ReportParameter("ImporteLetra", (ObjOC.Total).ToString.ToDouble.Texto2Letras(ObjOC.CveMoneda))) + ' params.Add(New ReportParameter("CorreoControl", If(drAut IsNot Nothing, drAut("Correo").ToString, ""))) + ' params.Add(New ReportParameter("Moneda", ObjOC.Moneda)) + ' params.Add(New ReportParameter("TipoCambio", TipoCambio)) + ' params.Add(New ReportParameter("NombreSolicito", dtOC(0)("UsuarioSolicito").ToString)) 'drSol("Nombre").ToString)) + ' params.Add(New ReportParameter("PuestoSolicito", PuestoSol)) 'drPuestoSol("Puesto").ToString + ' params.Add(New ReportParameter("NombreAutorizo", nombreautorizo)) + ' params.Add(New ReportParameter("PuestoAutorizo", PuestoAut)) 'drPuestoAut("Puesto").ToString + ' params.Add(New ReportParameter("TipoOC", If(ObjOC.Tipo = "OC", "Orden de Compra", "Requisición"))) + ' params.Add(New ReportParameter("Estatus", ObjOC.Estatus)) + ' params.Add(New ReportParameter("Descripcion", ObjOC.Descripcion)) + ' params.Add(New ReportParameter("FechaEstimadaEntrega", ObjOC.FechaEstimadaEntrega.ToShortDateString)) + ' 'params.Add(New ReportParameter("FechaOC", ObjOC.Fecha.ToShortDateString)) + ' Dim FirmaSol As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", ObjClsPaginas.UsuarioActual.Empresa.Ruta, CveUsuarioSol)) + ' params.Add(New ReportParameter("FirmaSolicito", If(FirmaSol.Exists, New Uri(ObjClsPaginas.Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", ObjClsPaginas.UsuarioActual.CveEmpresa, CveUsuarioSol))).AbsoluteUri, ""))) + ' Dim FirmaAut As New System.IO.FileInfo(String.Format("{0}Firmas\{1}.png", ObjClsPaginas.UsuarioActual.Empresa.Ruta, CveUsuarioAut)) + ' params.Add(New ReportParameter("FirmaAutorizo", If(FirmaAut.Exists, New Uri(ObjClsPaginas.Server.MapPath(String.Format("~/Empresas/{0}/Firmas/{1}.png", ObjClsPaginas.UsuarioActual.CveEmpresa, CveUsuarioAut))).AbsoluteUri, ""))) + ' Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\OC.rdlc", ObjClsPaginas.UsuarioActual.Empresa.Ruta)) + ' If Archivo.Exists Then + ' bytes = ObjClsPaginas.StreamPDF(String.Format("{0}Formatos\OC.rdlc", ObjClsPaginas.UsuarioActual.Empresa.Ruta), DtDetalle, params, "OrdenCompra", RDSName:="DsOC", MR:=MR) + ' Else + ' params.Add(New ReportParameter("Empresa", ObjClsPaginas.UsuarioActual.Empresa.Empresa)) + ' bytes = ObjClsPaginas.StreamPDF("Empresas\Grales\Formatos\OC.rdlc", DtDetalle, params, "OrdenCompra", RDSName:="DsOC", MR:=MR) + ' End If + ' If ConBitacora Then + ' Dim dttemp As New DataTable + ' Dim ObjEventoBitacora As New ClsOIEventos() + ' If ObjEventoBitacora.GetAgendaBitacora(ObjClsPaginas.UsuarioActual.CveUsuario, ObjClsPaginas.UsuarioActual.CveEmpresa, CveOC:=tCveOrdenCompra) Then + ' dttemp = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2") + ' End If + ' ObjEventoBitacora.Dispose() + ' If Not IsNothing(dttemp) AndAlso dttemp.Rows.Count > 0 Then + + ' Dim paramsest As New List(Of ReportParameter) + ' paramsest.Add(New ReportParameter("Empresa", ObjClsPaginas.UsuarioActual.Empresa.Empresa)) + ' paramsest.Add(New ReportParameter("Titulo", "Bitácora de órdenes de compra")) + ' paramsest.Add(New ReportParameter("Folio", ObjOC.Folio.ToString)) + ' paramsest.Add(New ReportParameter("TipoOC", If(ObjOC.Tipo = "OC", "Orden de Compra", "Requisición"))) + ' Dim bytes2 As Byte() + ' bytes2 = ObjClsPaginas.StreamPDF("Empresas\Grales\Formatos\Bitacora.rdlc", dttemp, paramsest, "OrdenCompra", MR:=MR) + ' Using ms As New MemoryStream() + ' Using document As New iTextSharp.text.Document() + ' Using copy As New PdfCopy(document, ms) + ' document.Open() + + ' Dim reader As New PdfReader(bytes) + ' ' loop over the pages in that document + ' Dim n As Integer = reader.NumberOfPages + ' Dim page As Integer = 0 + ' While page < n + ' page = page + 1 + ' copy.AddPage(copy.GetImportedPage(reader, page)) + ' End While + + + ' reader = New PdfReader(bytes2) + ' ' loop over the pages in that document + ' n = reader.NumberOfPages + ' page = 0 + ' While page < n + ' page = page + 1 + ' copy.AddPage(copy.GetImportedPage(reader, page)) + ' End While + + ' End Using + ' End Using + ' bytes = ms.ToArray() + ' End Using + ' End If + ' dttemp.Dispose() + ' End If + + ' End If + ' ObjOC.Dispose() + + ' DtDetalle.Dispose() + + ' Catch ex As Exception + ' GuardaLog(String.Format("Ocurrio un error al generar el strem de la oc={0}. {1}", tCveOrdenCompra, ex.Message)) + ' End Try + + ' Return bytes + 'End Function #End Region Public Function IsFileLocked(path As String, Optional access As FileAccess = FileAccess.Write) As Boolean Try @@ -2665,8 +2691,8 @@ Namespace Extensiones Return Retorno - End Function - + End Function + #Region "Contabilidad" Public Function ObtenerCuentaDobleConta(IdCtaContable As Integer, CveEmpresa As Integer) As Integer Dim Retorno As Integer = -1 @@ -2678,9 +2704,9 @@ Namespace Extensiones ObjContabilidad.Dispose() Return Retorno - End Function + End Function #End Region - + #Region "GPS" Public Function InfoWindow(Header As String, ExtraBody As String, CveDispositivo As Integer, row As DataRow, Optional PermisoComandos As Boolean = True) As String Dim SBuilder As New StringBuilder @@ -2794,8 +2820,8 @@ Namespace Extensiones End If Next Return Str.ToString - End Function - + End Function + #End Region Private Function GeneraCadenaDinamica(Optional Longitud As Integer = 8) As String @@ -2823,9 +2849,9 @@ Namespace Extensiones Return Array.IndexOf(Valores, Valor) >= 0 - End Function - - + End Function + + #Region "selected" Public Sub SelectedValueExist(Obj As DropDownList, Valor As Object) @@ -2931,7 +2957,7 @@ Namespace Extensiones End If Next Return retorno.ToString() - End Function + End Function #End Region Public Enum TipoContaReferencia As Integer Compra = 1 @@ -3147,9 +3173,9 @@ Namespace Extensiones Return fecha >= FechaI AndAlso fecha <= FechaF End Function - End Module + End Module #End Region - + #Region "C L A S E S" Public Class Archivo Public Sub New() @@ -3163,7 +3189,7 @@ Namespace Extensiones Public Property descripcion As String Public ReadOnly Property Extencion As String Get - Return IO.Path.GetExtension(String.Format("{0}{1}{2}", AppDomain.CurrentDomain.BaseDirectory, patch, filename)).Replace(".", "") + Return IO.Path.GetExtension(String.Format("{0}{1}{2}", If(patch.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory), patch, filename)).Replace(".", "") End Get End Property Public ReadOnly Property filenameO As String @@ -3173,7 +3199,7 @@ Namespace Extensiones End Property Public ReadOnly Property FileUrl As String Get - Return String.Format("{0}{1}{2}", AppDomain.CurrentDomain.BaseDirectory, patch, filename) + Return String.Format("{0}{1}{2}", If(patch.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory), patch, filename) End Get End Property End Class diff --git a/App_Code/wsSIG.vb b/App_Code/wsSIG.vb index 98f382990..acad4e26f 100644 --- a/App_Code/wsSIG.vb +++ b/App_Code/wsSIG.vb @@ -291,7 +291,7 @@ Public Class wsSIG Fecha = ArrCadena(6).ToString.ToDate Fecha.ToShortDateString().GuardaLog() If Fecha > Now.AddSeconds(TiempoValido) Then - Dim Dir As String = String.Format("{0}Empresas\{1}\", AppDomain.CurrentDomain.BaseDirectory, pCveEmpresa) + Dim Dir As String = String.Format("{0}Empresas\{1}\", ModExtensiones.DirectorioBaseEmpresas, pCveEmpresa) Dim Ruta As String = "" Dim RutaDB3 As String = "" Dim RutaThumb As String = "" diff --git a/Ashx/GenerarPDFFactura.ashx b/Ashx/GenerarPDFFactura.ashx index bf3b15b44..e4e126787 100644 --- a/Ashx/GenerarPDFFactura.ashx +++ b/Ashx/GenerarPDFFactura.ashx @@ -34,7 +34,7 @@ Public Class GenerarPDFFactura : Implements IHttpHandler Dim ListaDS = New List(Of ReportDataSource) Dim Parametros As New List(Of ReportParameter) - Dim Formato = context.Server.MapPath("/") + "Empresas/1/Report.rdlc" + Dim Formato = context.ModExtensiones.DirectorioBaseEmpresas + "Empresas/1/Report.rdlc" Parametros.Add(New ReportParameter("Empresa", datos.Empresa.Empresa)) Parametros.Add(New ReportParameter("RFC", datos.Empresa.RFC)) diff --git a/Ashx/SIGCRM.ashx b/Ashx/SIGCRM.ashx index 71bcdeb87..dacdc1843 100644 --- a/Ashx/SIGCRM.ashx +++ b/Ashx/SIGCRM.ashx @@ -56,7 +56,7 @@ Public Class SIGCRM : Implements IHttpHandler, IRequiresSessionState Dim Usuario As Usuario = UsuarioActual(context) If Not IsNothing(Usuario) Then - Dim Url = String.Format("{0}\Empresas\{1}\Acercamientos\{2}\Imagenes\{3}", AppDomain.CurrentDomain.BaseDirectory, Usuario.CveEmpresa, CveAcercamiento, Archivo) + Dim Url = String.Format("{0}\Empresas\{1}\Acercamientos\{2}\Imagenes\{3}", ModExtensiones.DirectorioBaseEmpresas, Usuario.CveEmpresa, CveAcercamiento, Archivo) If File.Exists(Url) Then context.Response.ContentType = String.Format("image/{0}", Extension) diff --git a/Ashx/SIGFacturacion.ashx b/Ashx/SIGFacturacion.ashx index 8a81cd9fa..a98d3c130 100644 --- a/Ashx/SIGFacturacion.ashx +++ b/Ashx/SIGFacturacion.ashx @@ -60,7 +60,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Dim Usuario = ValidaUsuarioSistema(CveEmpresa) Dim FechaI, FechaF As DateTime - 'EnviarCorreoFactura(New Modelos.Factura(Usuario, 844966, 1, context.Server.MapPath("/")), Usuario) + 'EnviarCorreoFactura(New Modelos.Factura(Usuario, 844966, 1, context.ModExtensiones.DirectorioBaseEmpresas), Usuario) If String.IsNullOrEmpty(pFechaI) AndAlso String.IsNullOrEmpty(pFechaF) Then Dim FechaReferencia = Now @@ -904,7 +904,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState ' strLineaTMP = Chr(13) & Chr(10) & Day(Now) & "/" & Month(Now) & "/" & Year(Now) & " " & Hour(Now) & ":" & Minuto & ". " & Str & Chr(13) & Chr(10) strLineaTMP = String.Format("{0}{1}Log: {2}{3}:{4}", Chr(13), Chr(10), Str, DateTime.Now.ToShortDateString, DateTime.Now.ToShortTimeString) Try - ArchivoW = New StreamWriter(String.Format("{0}\LogFacturacion.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8) + ArchivoW = New StreamWriter(String.Format("{0}\LogFacturacion.txt", ModExtensiones.DirectorioBaseEmpresas), True, System.Text.Encoding.UTF8) Catch ex As UnauthorizedAccessException 'Alert("No hay permisos para guardar en el Log.", Extensiones.TipoMensaje.MsgError) Exit Sub diff --git a/Ashx/SIGGPS.ashx b/Ashx/SIGGPS.ashx index f257e947b..64678a627 100644 --- a/Ashx/SIGGPS.ashx +++ b/Ashx/SIGGPS.ashx @@ -1,13 +1,13 @@ -<%@ WebHandler Language="VB" Class="SIGGPS" %> -'Option Explicit On -'Option Strict On - +<%@ WebHandler Language="VB" Class="SIGGPS" %> +'Option Explicit On +'Option Strict On + Imports System Imports System.Web Imports System.Data Imports Newtonsoft.Json.Linq Imports Extensiones -Imports System.IO +Imports System.IO Imports Microsoft.AspNet.SignalR Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState @@ -17,10 +17,10 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState If context.Request("metodo") IsNot Nothing Then Select Case context.Request("metodo") Case "getimginstalacion" - GetImgInstalacion(context) - Case "EjecutarNotificaciones" - EjecutarNotificaciones(context) - Case "EjecutaTrayectos" + GetImgInstalacion(context) + Case "EjecutarNotificaciones" + EjecutarNotificaciones(context) + Case "EjecutaTrayectos" EnviarCorreoTrayectos(context, context.Request("CveTrayecto").ToString().ToEntero()) End Select ElseIf context.Request.InputStream IsNot Nothing Then @@ -69,19 +69,19 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState Return URLParametros End Function - Private Sub EjecutarNotificaciones(ByVal context As HttpContext) - Dim Retorno As String = "[]" - 'Dim contextc = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext(Of MyGPSHub)() - 'SendNotificacionGPS(contextc, 5, 1727, "Encabezado", "Mensaje", 2, "{""timeOut"":15000, ""extendedTimeOut"":16000}", "142608__autistic-lucario__error.wav", 0, SQLToGmapsJArray("POINT (-99.211688 19.717715)", "POINT").ToString()) - Using ObjGPS As New ClsSisNotificaciones - ObjGPS.ObtenerNotificaciones() - End Using - context.Response.Write(Retorno) - End Sub - - Public Sub SendNotificacionGPS(context As Microsoft.AspNet.SignalR.IHubContext, CveNotificacionBitacora As Integer, CveUsuario As Integer, Encabezado As String, Mensaje As String, TipoNotificacion As Integer, Pie As String, Sonido As String, Persistencia As Boolean, Coords As String) - context.Clients.All.addLatestNotification(Mensaje, CveUsuario, Encabezado, TipoNotificacion, Pie, Sonido, CveNotificacionBitacora, Persistencia, Coords) - End Sub + Private Sub EjecutarNotificaciones(ByVal context As HttpContext) + Dim Retorno As String = "[]" + 'Dim contextc = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext(Of MyGPSHub)() + 'SendNotificacionGPS(contextc, 5, 1727, "Encabezado", "Mensaje", 2, "{""timeOut"":15000, ""extendedTimeOut"":16000}", "142608__autistic-lucario__error.wav", 0, SQLToGmapsJArray("POINT (-99.211688 19.717715)", "POINT").ToString()) + Using ObjGPS As New ClsSisNotificaciones + ObjGPS.ObtenerNotificaciones() + End Using + context.Response.Write(Retorno) + End Sub + + Public Sub SendNotificacionGPS(context As Microsoft.AspNet.SignalR.IHubContext, CveNotificacionBitacora As Integer, CveUsuario As Integer, Encabezado As String, Mensaje As String, TipoNotificacion As Integer, Pie As String, Sonido As String, Persistencia As Boolean, Coords As String) + context.Clients.All.addLatestNotification(Mensaje, CveUsuario, Encabezado, TipoNotificacion, Pie, Sonido, CveNotificacionBitacora, Persistencia, Coords) + End Sub Private Sub GetImgInstalacion(ByVal context As HttpContext) Dim params As String = Decripta(context.Request("r").ToString) Dim Parametros = Me.Parametros(params) @@ -91,7 +91,7 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState Dim Usuario As Usuario = UsuarioActual(context) If Not IsNothing(Usuario) Then - Dim Url = String.Format("{0}\Empresas\{1}\Dispositivos\{2}\Imagenes\{3}", AppDomain.CurrentDomain.BaseDirectory, Usuario.CveEmpresa, CveDispositivo, Archivo) + Dim Url = String.Format("{0}\Empresas\{1}\Dispositivos\{2}\Imagenes\{3}", ModExtensiones.DirectorioBaseEmpresas, Usuario.CveEmpresa, CveDispositivo, Archivo) If File.Exists(Url) Then context.Response.ContentType = String.Format("image/{0}", Extension) @@ -232,158 +232,158 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState ) Return Json - End Function - -#Region "N O T F I C A C I O N - T R A Y E C T O S" - Private Sub EnviarCorreoTrayectos(ByVal context As HttpContext, CveTrayecto As Integer) - Dim Retorno As JObject = New JObject(New JProperty("EnvioCorreo", False), New JProperty("Mensaje", "")) - Try - Dim DtInfoTrayecto As DataTable = Nothing - Dim DtTrayecto As DataTable = Nothing - - Using ObjGPS As New ClsGPS - If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then - DtTrayecto = ObjGPS.DtResultados.Copy() - End If - - If ObjGPS.GetTrayectosDatos(CveTrayecto) Then - DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy() - End If - End Using - - If DtTrayecto IsNot Nothing AndAlso DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then - Dim RowTrayecto As DataRow = DtTrayecto.Rows(0) - Dim RowInfo As DataRow = DtInfoTrayecto.Rows(0) - - Dim EnviarLiga As Boolean = CBool(RowTrayecto("EnviarLiga").ToString()) - - Dim Asunto As String = "Estatus de Trayecto" - Dim Cuerpo As String = GeneraCorreo(CveTrayecto, EnviarLiga, RowInfo) - Dim Correos As String = RowTrayecto("CorreosNotificacion").ToString() - - Dim ObjMail As New ClsSisMail - If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, Asunto, Cuerpo) Then - Retorno("EnvioCorreo") = True - Retorno("Mensaje") = "El correo fue enviado correctamente" - Else - Retorno("EnvioCorreo") = False - Retorno("Mensaje") = "Ocurrió un error al enviar el correo" - End If - - End If - Catch ex As Exception - OnError("Ocurrió un error al enviar el correo", ex) - End Try - - context.Response.Write(Retorno.ToString()) - End Sub - - Protected Function GeneraCorreo(CveTrayecto As Integer, EnviarLiga As Boolean, Row As DataRow) As String - Dim strBody As New StringBuilder - Try - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append("
    ") - strBody.Append(" ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append("
    Datos del Trayecto") - strBody.Append("") - strBody.Append("") - strBody.Append("") - strBody.Append("") - strBody.AppendFormat("", Row("Trayecto")) - strBody.Append("") - strBody.Append("") - strBody.Append("") - strBody.AppendFormat("", Row("Vehiculo")) - strBody.Append("") - strBody.Append("") - strBody.Append("") - strBody.AppendFormat("", Row("Estatus")) - strBody.Append("") - strBody.Append("") - strBody.Append("") - strBody.Append("") - strBody.AppendFormat("", Row("LatitudActual")) - strBody.Append("") - strBody.Append("") - strBody.Append("") - strBody.AppendFormat("", Row("LongitudActual")) - strBody.Append("") - strBody.Append("") - strBody.Append("") - strBody.AppendFormat("", Row("LatitudActual"), Row("LongitudActual")) - strBody.Append("") - If EnviarLiga Then - strBody.Append("") - strBody.Append("") - strBody.AppendFormat("", Encripta($"CveTrayecto={Row("CveTrayecto").ToString()}")) - strBody.Append("") - End If - strBody.Append("") - strBody.AppendFormat("", Row("Liga")) - strBody.Append("") - strBody.Append("") - strBody.Append("
     Trayecto: {0}
     Vehículo: {0}strong>
     Estatus: {0}
     Latitud: {0}
     Longitud: {0}
     Posición: Ver en google maps
     Rastreo: Rastrear Vehículo
    ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append(" ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append("") - Catch ex As Exception - OnError("Ocurrio un error al general el correo.", ex) - End Try - Return strBody.ToString() - End Function -#End Region - + End Function + +#Region "N O T F I C A C I O N - T R A Y E C T O S" + Private Sub EnviarCorreoTrayectos(ByVal context As HttpContext, CveTrayecto As Integer) + Dim Retorno As JObject = New JObject(New JProperty("EnvioCorreo", False), New JProperty("Mensaje", "")) + Try + Dim DtInfoTrayecto As DataTable = Nothing + Dim DtTrayecto As DataTable = Nothing + + Using ObjGPS As New ClsGPS + If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then + DtTrayecto = ObjGPS.DtResultados.Copy() + End If + + If ObjGPS.GetTrayectosDatos(CveTrayecto) Then + DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy() + End If + End Using + + If DtTrayecto IsNot Nothing AndAlso DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then + Dim RowTrayecto As DataRow = DtTrayecto.Rows(0) + Dim RowInfo As DataRow = DtInfoTrayecto.Rows(0) + + Dim EnviarLiga As Boolean = CBool(RowTrayecto("EnviarLiga").ToString()) + + Dim Asunto As String = "Estatus de Trayecto" + Dim Cuerpo As String = GeneraCorreo(CveTrayecto, EnviarLiga, RowInfo) + Dim Correos As String = RowTrayecto("CorreosNotificacion").ToString() + + Dim ObjMail As New ClsSisMail + If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, Asunto, Cuerpo) Then + Retorno("EnvioCorreo") = True + Retorno("Mensaje") = "El correo fue enviado correctamente" + Else + Retorno("EnvioCorreo") = False + Retorno("Mensaje") = "Ocurrió un error al enviar el correo" + End If + + End If + Catch ex As Exception + OnError("Ocurrió un error al enviar el correo", ex) + End Try + + context.Response.Write(Retorno.ToString()) + End Sub + + Protected Function GeneraCorreo(CveTrayecto As Integer, EnviarLiga As Boolean, Row As DataRow) As String + Dim strBody As New StringBuilder + Try + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append("
    ") + strBody.Append(" ") + strBody.Append("
    ") + strBody.Append("
    ") + strBody.Append("
    Datos del Trayecto") + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("Trayecto")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("Vehiculo")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("Estatus")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("LatitudActual")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("LongitudActual")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("LatitudActual"), Row("LongitudActual")) + strBody.Append("") + If EnviarLiga Then + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Encripta($"CveTrayecto={Row("CveTrayecto").ToString()}")) + strBody.Append("") + End If + strBody.Append("") + strBody.AppendFormat("", Row("Liga")) + strBody.Append("") + strBody.Append("") + strBody.Append("
     Trayecto: {0}
     Vehículo: {0}strong>
     Estatus: {0}
     Latitud: {0}
     Longitud: {0}
     Posición: Ver en google maps
     Rastreo: Rastrear Vehículo
    ") + strBody.Append("
    ") + strBody.Append("
    ") + strBody.Append(" ") + strBody.Append("
    ") + strBody.Append("
    ") + strBody.Append("") + Catch ex As Exception + OnError("Ocurrio un error al general el correo.", ex) + End Try + Return strBody.ToString() + End Function +#End Region + End Class \ No newline at end of file diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index c4c0f3fcb..8ae61eb7e 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -106,7 +106,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Dim usuario As Usuario = UsuarioActual(context) If Not IsNothing(usuario) Then - Url = String.Format("{0}Empresas\{1}\{2}", AppDomain.CurrentDomain.BaseDirectory, usuario.CveEmpresa, Url) + Url = String.Format("{0}Empresas\{1}\{2}", ModExtensiones.DirectorioBaseEmpresas, usuario.CveEmpresa, Url) Dim FileInfo As FileInfo = New FileInfo(Url) If FileInfo.Exists Then context.Response.ContentType = "image/png" diff --git a/Ashx/SigFiles.ashx b/Ashx/SigFiles.ashx new file mode 100644 index 000000000..bb4a91d48 --- /dev/null +++ b/Ashx/SigFiles.ashx @@ -0,0 +1,64 @@ +<%@ WebHandler Language="C#" Class="SigFiles" %> + +using System; +using System.Web; +using Extensiones; + +public class SigFiles : IHttpHandler +{ + + public void ProcessRequest(HttpContext context) + { + //context.Response.ContentType = "text/plain"; + //context.Response.Write("Hello World"); + string path = ""; + if (context.Request["FileUrl"] != null) + { + path = string.Format("{0}{1}", ModExtensiones.DirectorioBaseEmpresas, context.Request["FileUrl"]); + } + if (context.Request["P"] != null) + { + path = string.Format("{0}{1}", ModExtensiones.DirectorioBaseEmpresas,ModExtensiones.Decripta( context.Request["P"])); + } + if (path != null && path.Length>0) + { + + try + { + if (System.IO.File.Exists(path)) + { + System.IO.FileInfo file = new System.IO.FileInfo(path); + string mimeType = "text/plain"; + try + { + mimeType = MimeMapping.GetMimeMapping(path); + } + catch (Exception) { }//si truena no existe el arhivo + context.Response.Clear(); + context.Response.ClearHeaders(); + context.Response.ClearContent(); + context.Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}"); + context.Response.AddHeader("Content-Length", file.Length.ToString()); + context.Response.ContentType = mimeType; + context.Response.Flush(); + context.Response.TransmitFile(file.FullName); + + } + } + catch (Exception ex) + { + this.GuardaLog(ex.ToString()); + } + } + context.Response.End(); + } + + public bool IsReusable + { + get + { + return false; + } + } + +} \ No newline at end of file diff --git a/Bancos/CargarConciliacionesBancarias.aspx.vb b/Bancos/CargarConciliacionesBancarias.aspx.vb index 27ab10ceb..662e7ca6c 100644 --- a/Bancos/CargarConciliacionesBancarias.aspx.vb +++ b/Bancos/CargarConciliacionesBancarias.aspx.vb @@ -77,7 +77,7 @@ Partial Class Bancos_CargarConciliacionesBancarias Protected Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) If TxtExcel.getfiles().Archivos.Count > 0 Then Dim file As Archivo = TxtExcel.getfiles().Archivos(0) - Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch + Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") CargaExcel(Directorio, file.filename, Tipo) Else diff --git a/Bancos/CreditosPagoMultiple.aspx.vb b/Bancos/CreditosPagoMultiple.aspx.vb index 70a1873b4..615b0c0b8 100644 --- a/Bancos/CreditosPagoMultiple.aspx.vb +++ b/Bancos/CreditosPagoMultiple.aspx.vb @@ -216,7 +216,7 @@ Partial Class Bancos_CreditosPagoMultiple Dim filemove As String = "" Dim Comprobante As String = "" For Each fileItem As Archivo In filesgral - Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", ModExtensiones.DirectorioBaseEmpresas, fileItem.filename)).Replace(".", "") filemove = fileItem.filename Next diff --git a/Bancos/Devoluciones.aspx.cs b/Bancos/Devoluciones.aspx.cs index bebd16b8c..da3d4ae99 100644 --- a/Bancos/Devoluciones.aspx.cs +++ b/Bancos/Devoluciones.aspx.cs @@ -510,7 +510,7 @@ public partial class Bancos_Devoluciones : ClsPaginas if (!archivo.Exists) { - archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)); + archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)); } } else if (DdlTipoTransanccion.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72) diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 25548fcf6..beb0c14e3 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -930,7 +930,7 @@ Partial Class Bancos_IE If ObjIE.Comprobante <> "" Then HplComprobante.Visible = True - HplComprobante.NavigateUrl = String.Format("/Empresas/{0}/IE/{1}", UsuarioActual.CveEmpresa, ObjIE.Comprobante) + HplComprobante.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta($"OP=IEComprobante&Comprobante={ObjIE.Comprobante}")) End If If CveIEDeposito > 0 Then @@ -2471,7 +2471,7 @@ Partial Class Bancos_IE If CveIE > 0 Then - If DdlTipoTransaccion.SelectedValue = "1" AndAlso usuarioactual.cveempresa <> 119 Then FolioFijo = ObjIE.Folio.ToEntero 'cheque + If DdlTipoTransaccion.SelectedValue = "1" AndAlso UsuarioActual.CveEmpresa <> 119 Then FolioFijo = ObjIE.Folio.ToEntero 'cheque CvePrePoliza = ObjMov.AddPrePolizas("Bancos/IE " + If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "") + " " + RBL.SelectedValue, CvePlantillaPoliza, TxtImporte.Text.Trim.ToDouble, TxtImporte.Text.Trim.ToDouble, tCveMoneda, TxtFechaDocumento.Text.ToDate, PagueseA, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, Nothing, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa)) 'valida prepoliza @@ -2728,6 +2728,7 @@ Partial Class Bancos_IE Dim TipoMovtoAplicar = False For Each Dr As DataRow In ObjMov.DtResultados.FiltraParametros("CveConceptoContable IN (13,8,9,38)").Rows + Dim PorcentajeImpuesto As Decimal = Dr("PorcentajeImpuesto").ToString.ToDecimal() CveConceptoContableAplciar = Dr("CveConceptoContable").ToString.ToEntero TipoMovtoAplicar = Not CBool(Dr("TipoMovto").ToString) ImporteAplicar = (Dr("Importe").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() @@ -2735,7 +2736,7 @@ Partial Class Bancos_IE ImporteAplicarME = (Dr("ImporteME").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() IdCtaContableAplicar = Dr("IdCtaContable").ToString.ToEntero - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, PorcentajeImpuesto:=PorcentajeImpuesto) Then Select Case CveConceptoContableAplciar Case 13 CveConceptoContableAplciar = 61 @@ -2747,7 +2748,7 @@ Partial Class Bancos_IE CveConceptoContableAplciar = 39 End Select TipoMovtoAplicar = Not TipoMovtoAplicar - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, PorcentajeImpuesto:=PorcentajeImpuesto) Then MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" Exit Select End If @@ -3276,7 +3277,7 @@ Partial Class Bancos_IE ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1) Then Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) If Not Archivo.Exists Then - Archivo = New System.IO.FileInfo(String.Format("{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)) + Archivo = New System.IO.FileInfo(String.Format("{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)) End If ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(6) And UsuarioActual.CveEmpresa = 72 Then Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) @@ -4442,8 +4443,8 @@ Partial Class Bancos_IE #Region " CARGAR - COMPROBANTE " Protected Sub BtnConfirmaComprobante_Click(sender As Object, e As EventArgs) - Dim DirectorioGuardar = String.Format("{0}Empresas\{1}\IE", Request.PhysicalApplicationPath, UsuarioActual.CveEmpresa) - Dim ArchivoTemporal = String.Format("{0}Empresas\{1}\Temp\{2}", Request.PhysicalApplicationPath, UsuarioActual.CveEmpresa, Session("FileUpload").ToString) + Dim DirectorioGuardar = String.Format("{0}Empresas\{1}\IE", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) + Dim ArchivoTemporal = String.Format("{0}Empresas\{1}\Temp\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Session("FileUpload").ToString) If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ArchivoTemporal) Then Dim Extension As String = Path.GetExtension(ArchivoTemporal) diff --git a/Bancos/IE2.aspx.vb b/Bancos/IE2.aspx.vb index fabb39aa6..dd2087068 100644 --- a/Bancos/IE2.aspx.vb +++ b/Bancos/IE2.aspx.vb @@ -1598,8 +1598,8 @@ Partial Class Bancos_IE #Region " CARGAR - COMPROBANTE " Protected Sub BtnConfirmaComprobante_Click(sender As Object, e As EventArgs) - Dim DirectorioGuardar = String.Format("{0}Empresas\{1}\IE", Request.PhysicalApplicationPath, UsuarioActual.CveEmpresa) - Dim ArchivoTemporal = String.Format("{0}Empresas\{1}\Temp\{2}", Request.PhysicalApplicationPath, UsuarioActual.CveEmpresa, Session("FileUpload").ToString) + Dim DirectorioGuardar = String.Format("{0}Empresas\{1}\IE", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) + Dim ArchivoTemporal = String.Format("{0}Empresas\{1}\Temp\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Session("FileUpload").ToString) If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ArchivoTemporal) Then Dim Extension As String = Path.GetExtension(ArchivoTemporal) diff --git a/Bancos/PagoAcreedor.aspx.cs b/Bancos/PagoAcreedor.aspx.cs index 535b52b64..34d0a9b14 100644 --- a/Bancos/PagoAcreedor.aspx.cs +++ b/Bancos/PagoAcreedor.aspx.cs @@ -571,7 +571,7 @@ public partial class Bancos_PagoAcreedor : ClsPaginas if (!archivo.Exists) { - archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)); + archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)); } } else if (DdlTipoTransaccion.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72) @@ -845,7 +845,7 @@ public partial class Bancos_PagoAcreedor : ClsPaginas if (!archivo.Exists) { - archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)); + archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)); } } else if (DdlTipoTransanccionPrestamo.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72) diff --git a/Bancos/PagoDeudor.aspx.cs b/Bancos/PagoDeudor.aspx.cs index 0a066a52f..6e56741cc 100644 --- a/Bancos/PagoDeudor.aspx.cs +++ b/Bancos/PagoDeudor.aspx.cs @@ -506,7 +506,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas if (!archivo.Exists) { - archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)); + archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)); } } else if (DdlTipoTransaccionPrestamo.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72) @@ -908,7 +908,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas if (!archivo.Exists) { - archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)); + archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)); } } else if (DdlTipoTransaccion.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72) diff --git a/Bancos/PolizaCheque.aspx.vb b/Bancos/PolizaCheque.aspx.vb index 91ae90038..0a8276153 100644 --- a/Bancos/PolizaCheque.aspx.vb +++ b/Bancos/PolizaCheque.aspx.vb @@ -211,25 +211,25 @@ Partial Class Bancos_PolizaCheque End Sub Private Sub CargaCuenta() - DdlCuenta.Items.Clear() - - Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario) - - - - + DdlCuenta.Items.Clear() + + Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario) + + + + If DdlTipoTransaccion.SelectedValue.ToEntero = 3 Then dt = dt.FiltraParametros("CveTipoCuenta = 7") End If 'cuando es layout - If DdlTipoTransaccion.SelectedValue.ToEntero = 9 Then + If DdlTipoTransaccion.SelectedValue.ToEntero = 9 Then dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1)) dt = dt.FiltraParametros("UsaLayout = 1") - End If - - 'cuando es layout Por Grupos - If DdlTipoTransaccion.SelectedValue.ToEntero = 17 Then + End If + + 'cuando es layout Por Grupos + If DdlTipoTransaccion.SelectedValue.ToEntero = 17 Then dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1)) dt = dt.FiltraParametros("UsaLayoutGrupos = 1") End If @@ -1212,9 +1212,9 @@ Partial Class Bancos_PolizaCheque End If End If Return Retorno - End Function - - - + End Function + + + End Class diff --git a/Bancos/PrestamoPersonal.aspx.cs b/Bancos/PrestamoPersonal.aspx.cs index fc10b964d..45868524e 100644 --- a/Bancos/PrestamoPersonal.aspx.cs +++ b/Bancos/PrestamoPersonal.aspx.cs @@ -410,7 +410,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas if (!archivo.Exists) { - archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)); + archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)); } } else if (DdlTipoTransaccion.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72) @@ -670,7 +670,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas if (!archivo.Exists) { - archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)); + archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)); } } else if (DdlTipoTransanccionPrestamo.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72) diff --git a/Bancos/RepCobrado.aspx.vb b/Bancos/RepCobrado.aspx.vb index 05e1a0d61..29b9d94e8 100644 --- a/Bancos/RepCobrado.aspx.vb +++ b/Bancos/RepCobrado.aspx.vb @@ -134,7 +134,7 @@ Partial Class Ventas_RepRecuperacion If DdlCuentaBancaria.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Cuenta Bancaria: {0}", DdlCuentaBancaria.SelectedItem.Text) Dim RutaPDF As String - Dim Ruta As String = $"{AppDomain.CurrentDomain.BaseDirectory}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" RutaPDF = $"{Ruta}\Formatos\RepRecuperacion.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/RepRecuperacion.rdlc" diff --git a/Bancos/RepCobradoDetalle.aspx.vb b/Bancos/RepCobradoDetalle.aspx.vb index 90671a616..b37cec1e1 100644 --- a/Bancos/RepCobradoDetalle.aspx.vb +++ b/Bancos/RepCobradoDetalle.aspx.vb @@ -193,7 +193,7 @@ Partial Class Ventas_RepRecuperacionDetalle If DdlProveedorSucursal.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Proveedor Sucursal: {0}", DdlProveedorSucursal.SelectedItem.Text) Dim RutaPDF As String - Dim Ruta As String = $"{AppDomain.CurrentDomain.BaseDirectory}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" RutaPDF = $"{Ruta}\Formatos\RepRecuperacionDetalle.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/RepRecuperacionDetalle.rdlc" diff --git a/Bancos/Reportes.aspx.vb b/Bancos/Reportes.aspx.vb index 8ad3eeb40..1f22c766f 100644 --- a/Bancos/Reportes.aspx.vb +++ b/Bancos/Reportes.aspx.vb @@ -141,7 +141,7 @@ Partial Class Bancos_Reportes rv.LocalReport.DataSources.Clear() rv.LocalReport.DataSources.Add(rds) rv.LocalReport.DataSources.Add(rds2) - rv.LocalReport.ReportPath = AppDomain.CurrentDomain.BaseDirectory & "Bancos\Reportes\rptChequeMovimientos.rdlc" + rv.LocalReport.ReportPath = ModExtensiones.DirectorioBaseEmpresas & "Bancos\Reportes\rptChequeMovimientos.rdlc" rv.LocalReport.Refresh() Dim paramList As New List(Of ReportParameter) diff --git a/Bancos/ReportesOLD.aspx.vb b/Bancos/ReportesOLD.aspx.vb index afc90b056..aac1c48b9 100644 --- a/Bancos/ReportesOLD.aspx.vb +++ b/Bancos/ReportesOLD.aspx.vb @@ -64,7 +64,7 @@ Partial Class Bancos_Reportes rv.LocalReport.DataSources.Clear() rv.LocalReport.DataSources.Add(rds) rv.LocalReport.DataSources.Add(rds2) - rv.LocalReport.ReportPath = AppDomain.CurrentDomain.BaseDirectory & "Bancos\Reportes\rptChequeMovimientos.rdlc" + rv.LocalReport.ReportPath = ModExtensiones.DirectorioBaseEmpresas & "Bancos\Reportes\rptChequeMovimientos.rdlc" rv.LocalReport.Refresh() Dim paramList As New List(Of ReportParameter) diff --git a/Bin/APP_Code_CSharp.dll b/Bin/APP_Code_CSharp.dll index 1f9036671..133af1af3 100644 Binary files a/Bin/APP_Code_CSharp.dll and b/Bin/APP_Code_CSharp.dll differ diff --git a/Bin/APP_Code_CSharp.pdb b/Bin/APP_Code_CSharp.pdb index 3698a8127..54e2a37d6 100644 Binary files a/Bin/APP_Code_CSharp.pdb and b/Bin/APP_Code_CSharp.pdb differ diff --git a/CRM/Acercamiento.aspx.cs b/CRM/Acercamiento.aspx.cs index 9bd14d662..bc1ce9c1a 100644 --- a/CRM/Acercamiento.aspx.cs +++ b/CRM/Acercamiento.aspx.cs @@ -1407,7 +1407,7 @@ public partial class CRM_Acercamiento : ClsPaginas if ((CveArchivo > 0)) { string NombreNuevo = string.Format("{0}{1}", CveArchivo, FileExtension); - string DirectorioNuevo = string.Format("{0}\\Empresas\\{1}\\Acercamientos\\{2}\\Imagenes\\", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, CveAcercamiento); + string DirectorioNuevo = string.Format("{0}\\Empresas\\{1}\\Acercamientos\\{2}\\Imagenes\\", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CveAcercamiento); if (!Directory.Exists(DirectorioNuevo)) { Directory.CreateDirectory(DirectorioNuevo); diff --git a/CRM/CatEmpresasCRM.aspx b/CRM/CatEmpresasCRM.aspx index 7095cee60..c4391eec7 100644 --- a/CRM/CatEmpresasCRM.aspx +++ b/CRM/CatEmpresasCRM.aspx @@ -28,6 +28,11 @@
    + +
    + + +
    diff --git a/CRM/CatEmpresasCRM.aspx.cs b/CRM/CatEmpresasCRM.aspx.cs index ad32655d5..9f8de821c 100644 --- a/CRM/CatEmpresasCRM.aspx.cs +++ b/CRM/CatEmpresasCRM.aspx.cs @@ -29,6 +29,7 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas { if (!IsPostBack) { + CargaTipoProcesos(); CargaMediosCaptacion(); CargaDatos(); } @@ -60,12 +61,22 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa, 1)) { - DdlMedioCaptacion.DataSource = ObjCRM.DtResultados; + DdlMedioCaptacion.DataSource = ObjCRM.DtResultados.FiltraParametros(String.Format("CveTipoProceso = {0}",DdlTipoProceso.SelectedValue)); DdlMedioCaptacion.DataBind(); - DdlMedioCaptacion.Items.Insert(0, new ListItem("Todos ", "-1")); } ObjCRM.Dispose(); } + + protected void CargaTipoProcesos() + { + ClsCRM ObjCRM = new ClsCRM(); + + if (ObjCRM.GetTipoProceso(UsuarioActual.CveEmpresa)) + { + DdlTipoProceso.DataSource = ObjCRM.DtResultados; + } + DdlTipoProceso.DataBind(); + } #endregion #region "ACCIONES - GRIEDVIEW" @@ -106,4 +117,11 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas } } #endregion + + protected void DdlTipoProcesos_Change(Object sender, EventArgs e) + { + DdlMedioCaptacion.Items.Clear(); + CargaMediosCaptacion(); + UPFiltros.Update(); + } } \ No newline at end of file diff --git a/CRM/CatEtapasProceso.aspx b/CRM/CatEtapasProceso.aspx index 27ce1e6dd..8dc6acbfb 100644 --- a/CRM/CatEtapasProceso.aspx +++ b/CRM/CatEtapasProceso.aspx @@ -23,8 +23,8 @@ - - + + @@ -130,22 +130,24 @@ ") + 'Termino Cuerpo del correo + + Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(Asunto, Para, SBBody.ToString)) + Hilo.Start() + Alert("El correo se ha enviado correctamente a: " + TxtEmail.Text + ".", TipoMensaje.MsgInformacion) + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + + + Private Sub MandaCorreo(Asunto As String, Para As String, Body As String) + Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) + a.GuardaLog() + Dim Mail As New ClsSisMail() + Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) End Sub -#End Region +#End Region -#Region "VENTAS" +#Region " COTIZACIONES " - Public Function imprimirFacturaVenta(CveVenta As Integer) As Byte() - Dim ObjVentas As New ClsVentas - Dim Vta As Modelos.Factura = Nothing + Protected Sub BtnVerMasCot_Click(sender As Object, e As EventArgs) + If BtnVerMasCot.Text = "Ver Más" Then + CargaCotizaciones(-1) + BtnVerMasCot.Text = "Ver Menos" + Else + CargaCotizaciones(21) + BtnVerMasCot.Text = "Ver Más" + End If + End Sub + Private Function CargaCotizaciones(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1) As Boolean + Dim Retorno As Boolean = False + Dim ObjClientes As New ClsClientes() + If ObjClientes.GetCotizaciones(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then + If ObjClientes.DtResultados.Rows.Count > 0 Then + 'Carga Generales + LtlCantidadCotizaciones.Text = ObjClientes.DtResultados.Rows(0)("CountTotal").ToString.FormatoNumero(2) + LtlFactorCotVentas.Text = If(LtlCantidad.Text.ToEntero > 0, (LtlCantidadCotizaciones.Text.ToEntero / LtlCantidad.Text.ToEntero).FormatoNumero, "0.00") + 'Carga Grid + GvCot.DataSource = ObjClientes.DtResultados + DtCotizaciones = ObjClientes.DtResultados + + If UsuarioActual.Empresa.UsaOS Then + GvCot.Columns(9).Visible = True + Else + GvCot.Columns(9).Visible = True + End If + + + Else + LtlCantidadCotizaciones.Text = "0" + LtlFactorCotVentas.Text = "0.00" + GvCot.DataSource = Nothing + DtCotizaciones = Nothing + End If + Else + GvCot.DataSource = Nothing + DtCotizaciones = Nothing + End If + ObjClientes.Dispose() + GvCot.DataBind() + Return Retorno + End Function + Protected Sub GVCotizaciones_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCot.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim HLFacturar As HtmlAnchor = DirectCast(e.Row.FindControl("HLFacturarCot"), HtmlAnchor) + + + 'CABECERA + If e.Row.RowIndex = 0 Then + e.Row.BackColor = Drawing.Color.LightGray + DirectCast(e.Row.FindControl("HLSendMail2"), HtmlAnchor).Visible = False + e.Row.FindControl("HlOS").Visible = False + HLFacturar.Visible = False + End If + + e.Row.FCLiteral("LtlCotizacion").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio")) + e.Row.FCLiteral("LtlFolioVenta").Text = String.Format("{1}", e.Row.DBCampo("CveVentaPadre"), e.Row.DBCampo("FolioVenta")) + DirectCast(e.Row.FindControl("HLSendMail2"), HtmlAnchor).HRef = String.Format("javascript:$get('HdnTipoDocto2').value='Cot';$get('HdnCveVenta2').value='{0}';$get('HdnFolioVenta2').value='{1}';$get('TxtParaMail2').value='{2}';$get('HdnSerieFolio2').value='{2}';$get('HdnSubProyecto2').value='{2}'; $('#ModalDivMail2').modal();", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("Correo"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("SubProyecto")) + + + + 'FACTURAR COTIZACION + If e.Row.DBCampo("FolioVenta") <> "" Then + HLFacturar.Visible = False + Else + HLFacturar.HRef = $"/Ventas/Ventas.aspx?CveCotizacion={e.Row.DBCampo("CveVenta")}" + End If + End If + End Sub +#End Region - Dim TmpDTImpuestos = New DataTable - TmpDTImpuestos.Columns.Add("ImpuestoLocal", GetType(String)) - TmpDTImpuestos.Columns.Add("Importe", GetType(Double)) - TmpDTImpuestos.Columns.Add("Orden", GetType(Integer)) +#Region "D I R E C C I O N E N V I O " + Public Sub Edit_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + CveDireccionEnvio = GvRow.DataKey("CveDireccionEnvio").ToEntero + TxtEnvioDireccion.Text = GvRow.DataKey("EnvioDireccion") + TxtEnvioNoExt.Text = GvRow.DataKey("EnvioNoExt") + TxtEnvioNoInt.Text = GvRow.DataKey("EnvioNoInt") + TxtEnvioColonia.Text = GvRow.DataKey("EnvioColonia") + TxtEnvioCiudad.Text = GvRow.DataKey("EnvioCiudad") + TxtEnvioEstado.Text = GvRow.DataKey("EnvioEstado") + TxtEnvioContacto.Text = GvRow.DataKey("EnvioContacto") + 'TxtDepartamento.Text = GvRow.DataKey("EnvioDepartamento") + TxtEnvioCP.Text = GvRow.DataKey("EnvioCP") + TxtEnvioTel.Text = GvRow.DataKey("EnvioTel") + ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString = "True", True, False) + If GvRow.DataKey("CveClienteSucursal").ToEntero > 0 Then DdlClienteSucursalEnvio.SelectedValueExist(GvRow.DataKey("CveClienteSucursal")) Else DdlClienteSucursalEnvio.SelectedValueExist("-1") + UpAddDireccion.Update() + RegistraScript("$('#divAddDireccionEnvio').modal();") + End Sub + Private Sub BtnAgregarDireccion_Click(sender As Object, e As EventArgs) Handles BtnAgregarDireccion.Click + Dim ObjClientes As New ClsClientes + Dim TieneError = False + Dim Estatus = If(ChkEstatus.Checked, 1, 0) + + If CveDireccionEnvio < 0 Then + CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(CveCliente, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, TxtEnvioColonia.Text.Trim, TxtEnvioCiudad.Text.Trim, TxtEnvioEstado.Text.Trim, TxtEnvioCP.Text.ToEntero, TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, Estatus, CveClienteSucursal:=DdlClienteSucursalEnvio.SelectedValue.ToEntero, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")) + + If CveDireccionEnvio < 0 Then + TieneError = True + End If + Else + + If Not ObjClientes.DireccionEnvioUpdate(CveCliente, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, TxtEnvioColonia.Text.Trim, TxtEnvioCiudad.Text.Trim, TxtEnvioEstado.Text.Trim, TxtEnvioCP.Text.ToEntero, TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, Estatus, CveDireccionEnvio, CveClienteSucursal:=DdlClienteSucursalEnvio.SelectedValue.ToEntero, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")) Then + TieneError = True + End If + + End If + + If TieneError Then + Alert("Ocurrio un error al agregar/actualizar la dirección de envío", TipoMensaje.MsgError) + Else + RegistraScript("$('#divAddDireccionEnvio').modal('hide');") + CveDireccionEnvio = -1 + CargaDireccionesEnvio() + End If + End Sub + Private Sub BtnAgregarDireccionModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarDireccionModal.Click + TxtEnvioDireccion.Text = "" + TxtEnvioNoExt.Text = "" + TxtEnvioNoInt.Text = "" + TxtEnvioColonia.Text = "" + TxtEnvioCiudad.Text = "" + TxtEnvioEstado.Text = "" + TxtEnvioContacto.Text = "" + 'TxtDepartamento.Text = "" + TxtEnvioCP.Text = "" + TxtEnvioTel.Text = "" + DdlClienteSucursalEnvio.SelectedValue = "-1" + UpAddDireccion.Update() + RegistraScript("$('#divAddDireccionEnvio').modal();") + End Sub + Private Sub GvDireccionesEnvio_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvDireccionesEnvio.RowDeleting + Dim ObjClientes As New ClsClientes + Dim TieneError = False + + Dim CveDireccionEnvio As Integer = GvDireccionesEnvio.Rows(e.RowIndex).DataKey("CveDireccionEnvio").ToEntero + + If Not ObjClientes.DireccionEnvioRemove(CveDireccionEnvio) Then + TieneError = True + End If + + If Not TieneError Then + GvDireccionesEnvio.EditIndex = -1 + Alert("Se eliminó correctamente la dirección de envío.", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrió un error al eliminar la dirección de envío.", TipoMensaje.MsgAdvertencia) + End If + + CargaDireccionesEnvio() + End Sub - Dim TmpDTImpuestosIVAIEPS = New DataTable - TmpDTImpuestosIVAIEPS.Columns.Add("Impuesto", GetType(String)) - TmpDTImpuestosIVAIEPS.Columns.Add("tasa", GetType(String)) - TmpDTImpuestosIVAIEPS.Columns.Add("Importe", GetType(Double)) - TmpDTImpuestosIVAIEPS.Columns.Add("Orden", GetType(Integer)) +#End Region - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - Dim dtVentas As DataTable = ObjVentas.DtResultados +#Region " IMPORTAR SALDOS " - ' se rellenan los campos de la factura - Vta = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.Factura) + Private Sub HLImportarSaldos_Click(sender As Object, e As EventArgs) Handles HLImportarSaldos.Click + CargaClientesImportarSaldos() + RegistraScript(String.Format("$('#{0}').modal();", "DivImportarSaldos")) + End Sub + + Private Sub CargaClientesImportarSaldos() + DdlClienteImportarSaldos.setEsWebService(True) '(UsuarioActual.Empresa.Funcionalidad(105) = "1") + 'DdlClienteImportarSaldos.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) + 'DdlClienteImportarSaldos.DataBind() + UpImportarSaldos.Update() + 'DdlClienteImportarSaldos.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Sub + Protected Sub BtnConsultarSaldoCliente_Click(sender As Object, e As EventArgs) + ConsultarAnticiposSaldosClientes() + End Sub + Private Sub ConsultarAnticiposSaldosClientes() + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetAnticiposNCIxCCliente(DdlClienteImportarSaldos.SelectedValue.ToEntero) Then + GvImportarSaldos.DataSource = ObjMovtos.DtResultados.FiltraParametros("Saldo > 0 AND Saldo > 0 AND CveIE > 0") + Else + GvImportarSaldos.DataSource = Nothing + End If + ObjMovtos.Dispose() + + TxtSaldoImportar.Text = "" + + GvImportarSaldos.DataBind() + UpImportarSaldos.Update() + End Sub + Protected Sub BtnGuardarTransferencias_Click(sender As Object, e As EventArgs) + Dim EsValida = False + + For Each Gvr As GridViewRow In GvImportarSaldos.Rows + If Gvr.FCCheckBox("Chk").Checked AndAlso Gvr.FCTextBox("TxtImporte").Text.ToDouble > 0 Then + EsValida = True + End If + Next + + If Not EsValida Then + Alert("El importe a importar de saldos debe ser mayor a cero. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + Dim TieneError = False + + + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Clientes/ImportarSaldos", 53, TxtCantidad.Text.Trim.ToDouble, TxtCantidad.Text.Trim.ToDouble, 1, TxtFechaImportarSaldos.Text.ToDate, "Traspaso de saldos de anticipos", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim IVA As Decimal = 0 + Dim Importe As Decimal = 0 + Dim ImporteAplicar As Decimal = 0 + If CvePrePoliza > 0 Then + For Each Gvr As GridViewRow In GvImportarSaldos.Rows + If Gvr.FCCheckBox("Chk").Checked AndAlso Gvr.FCTextBox("TxtImporte").Text.ToDouble > 0 Then + + Importe = Gvr.FCTextBox("TxtImporte").Text.ToDecimal + IVA = Importe / Gvr.DataKey("Original").ToString.ToDecimal * Gvr.DataKey("IVA").ToString.ToDecimal 'TOMA EN CUENTA EL IVA - CONCEPTO DIFERENTE + ImporteAplicar = -(Importe - IVA) + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, "Traspaso de saldos de anticipos", 92, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=Gvr.DataKey("CveCliente").ToString.ToEntero, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=ImporteAplicar) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, "Traspaso de saldos de anticipos", 66, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=CveCliente, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=ImporteAplicar) Then + TieneError = True + End If + Else + TieneError = True + End If + + If Not TieneError Then + If IVA > 0 Then + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -IVA, "Traspaso de saldos de anticipos.IVA", 61, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=Gvr.DataKey("CveCliente").ToString.ToEntero, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=-IVA) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, "Traspaso de saldos de anticipos. IVA", 61, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=CveCliente, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=IVA) Then + TieneError = True + End If + Else + TieneError = True + End If + End If + End If + + + End If + Next + Else + TieneError = True + End If + + + If Not TieneError Then + ObjConta.Commit() + Alert($"La importación de saldos se hizo correctamente.", TipoMensaje.MsgInformacion) + TxtSaldoImportar.Text = "" + ConsultarAnticiposSaldosClientes() + Else + ObjConta.RollBack() + Alert("Ocurrió un error al importar los saldos. Por favor vuelva a intentar.", TipoMensaje.MsgError) + End If + + ObjConta.Dispose() + End Sub + + Protected Sub GvImportarSaldos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvImportarSaldos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("ChkSaldo(this,{0},{1});", e.Row.FCTextBox("TxtImporte").ClientID, e.Row.DBCampo("Saldo"))) + e.Row.FCTextBox("TxtImporte").Attributes.Add("onKeyUp", String.Format("CambiaSaldo({0},this,{1});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"))) + End If + End Sub +#End Region - Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString - 'se rellena la sucursal - 'Vta.Subproyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SucursalModel) - Vta.SubProyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SubProyectoModel) - Vta.Cliente = New Modelos.ClienteModel - Vta.Cliente.Nombre = dtVentas(0)("ClienteNombre").ToString - Vta.Cliente.Telefono = dtVentas(0)("Telefono").ToString - Vta.Cliente.Direccion = dtVentas(0)("ClienteDireccion").ToString - Vta.Cliente.CP = dtVentas(0)("CPCliente").ToString - Vta.Cliente.Ciudad = dtVentas(0)("ClienteCiudad").ToString - Vta.Cliente.Localidad = dtVentas(0)("ClienteLocalidad").ToString - Vta.Cliente.Estado = dtVentas(0)("ClienteEstado").ToString - Vta.Cliente.Pais = dtVentas(0)("ClientePais").ToString - Vta.Cliente.RFC = dtVentas(0)("ClienteRFC").ToString - Vta.Cliente.Colonia = dtVentas(0)("ColoniaCliente").ToString - Vta.AtencionA = dtVentas(0)("AtencionA").ToString - Vta.Cliente.NoExt = dtVentas(0)("ClienteNoExt").ToString - Vta.Cliente.NoInt = dtVentas(0)("ClienteNoInt").ToString - Vta.Cliente.Codigo = dtVentas(0)("ClienteCodigo").ToString - Vta.Cliente.Mail = dtVentas(0)("Mail").ToString - Vta.RefDocto = dtVentas(0)("Ref").ToString - Vta.CveVenta = dtVentas(0)("CveVenta").ToString.ToEntero - Vta.Version = dtVentas(0)("Version").ToString +#Region "Cuentas/Equipos" + Public Sub BtnAgregarCtaEquipo_Click(sender As Object, e As EventArgs) + HdnModalidad.Value = "I" + DivCicloComercial.Visible = False + TxtIdentificador.Text = "" + TxtNoSerie.Text = "" + DdlTipoCuentaDetalle.SelectedIndex = 0 + ChkAnticipo.Checked = False + PnlCicloComercial.Visible = False + CargaCuentasCaracteristicas() + UpBodyAgregarCuenta.Update() + UpDatos.Update() + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarCuenta")) + End Sub + Private Sub BtnGuardarCuenta_Click(sender As Object, e As EventArgs) Handles BtnGuardarCuenta.Click + Dim objCuentasEquipos As New ClsGenerales() + Dim TieneError = False + objCuentasEquipos.IniciaTransacSQL() + + If HdnModalidad.Value = "I" Then + If Not objCuentasEquipos.AddCuentaEquipo(CveCliente, DdlTipoCuentaDetalle.SelectedValue.ToEntero, TxtIdentificador.Text.Trim, TxtNoSerie.Text.Trim, DdlClienteSucursal.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + TieneError = True + End If + + If Not GuardaCaracteristicas(HdnModalidad.Value.ToString, objCuentasEquipos.CveCuentaEquipo, objCuentasEquipos) Then + TieneError = True + End If + + ElseIf HdnModalidad.Value = "U" Then + + If Not objCuentasEquipos.UpdateCuentaEquipo(TxtIdentificador.Text, TxtNoSerie.Text, True, DdlClienteSucursal.SelectedValue.ToEntero, CveCuentaEquipo) Then + TieneError = True + End If + + If Not GuardaCaracteristicas(HdnModalidad.Value.ToString, CveCuentaEquipo, objCuentasEquipos) Then + TieneError = True + End If + + End If + + If Not TieneError Then + objCuentasEquipos.Commit() + CargaCuentasEquipos() + TxtIdentificador.Text = "" + TxtNoSerie.Text = "" + DdlTipoCuentaDetalle.SelectedIndex = 0 + ChkAnticipo.Checked = False + Alert("Se agregó/Actualizó correctamente la Cuenta/Equipo.", TipoMensaje.MsgInformacion) + UpBodyAgregarCuenta.Update() + Else + Alert("Ocurrió un erro al Agregar/Actualizar la Cuenta/Equipo.", TipoMensaje.MsgInformacion) + objCuentasEquipos.RollBack() + End If + + objCuentasEquipos.Dispose() + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarCuenta")) + UpDatos.Update() + End Sub + Private Sub ChkCicloComercial_CheckedChanged(sender As Object, e As EventArgs) Handles ChkCicloComercial.CheckedChanged + If ChkCicloComercial.Checked = True Then + PnlCicloComercial.Visible = True + + DdlPS.Items.Clear() + DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + DdlPS.DataBind() + DdlPS.Items.Insert(0, New ListItem("Seleccione", "-1")) + + Else + PnlCicloComercial.Visible = False + End If + End Sub + Private Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) Handles BtnAgregarPS.Click + Dim Objeto As New ClsGenerales + If Objeto.AddCuentaEquipoPS(DdlPS.SelectedValue.ToEntero, CveCuentaEquipo) Then + Alert("Se ha agregado correctamente.", TipoMensaje.MsgInformacion) + CargaGridPS() + End If + Objeto.Dispose() + End Sub + Private Sub CargaGridPS() + Dim Objeto As New ClsGenerales() + If Objeto.GetCuentaEquipoPS(CveCuentaEquipo) Then + GvPS.DataSource = Objeto.DtResultados + GvPS.DataBind() + Objeto.Dispose() + End If + UpDatos.Update() + + End Sub + Public Sub imgE_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim Objeto As New ClsGenerales() + + HdnModalidad.Value = "U" + CveCuentaEquipo = GvRow.DataKey("CveCuentaEquipo").ToString.ToEntero + TxtIdentificador.Text = GvRow.DataKey("CuentaEquipo") + TxtNoSerie.Text = GvRow.DataKey("NoSerie") + DdlTipoCuentaDetalle.SelectedValueExist(GvRow.DataKey("CveTipoCuentaEquipo")) + BtnGuardarCuenta.Text = "Guardar" + DivCicloComercial.Visible = True + + If Objeto.GetCuentaEquipoPS(CveCuentaEquipo) Then + If Objeto.DtResultados.Rows.Count > 0 Then + GvPS.DataSource = Objeto.DtResultados + GvPS.DataBind() + ChkCicloComercial.Checked = True + PnlCicloComercial.Visible = True + DdlPS.Items.Clear() + DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + DdlPS.DataBind() + DdlPS.Items.Insert(0, New ListItem("Seleccione", "-1")) + Else + ChkCicloComercial.Checked = False + PnlCicloComercial.Visible = False + End If + End If + + If Objeto.GetCaracteristicasValores(-1, -1, -1, -1, CveCuentaEquipo, -1, 6, UsuarioActual.CveEmpresa) Then + GvCuentasCaracteristicas.DataSource = Objeto.DtResultados + Else + GvCuentasCaracteristicas.DataSource = Nothing + End If + GvCuentasCaracteristicas.DataBind() + GvCuentasCaracteristicas.Visible = True + GvAddCuentaCaracteristica.Visible = False + + UpDatos.Update() + UpBodyAgregarCuenta.Update() + UpAgregarCuenta.Update() + Objeto.Dispose() + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarCuenta")) + End Sub + Protected Sub GvCuentasEquipos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvCuentasEquipos.RowDeleting + Dim Objeto As New ClsGenerales + Dim TieneError = False + If Objeto.RemoveCuentaEquipo(GvCuentasEquipos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then + Alert("La cuenta Equipo se eliminó correctamente.", TipoMensaje.MsgInformacion) + Else + TieneError = True + Alert("Error al eliminar la cuenta/equipo.", TipoMensaje.MsgError) + End If + Objeto.Dispose() + UpDatos.Update() + CargaCuentasEquipos() + + + End Sub + Public Sub GvPS_Delete(sender As Object, e As EventArgs) + Dim Objeto As New ClsGenerales + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim CveCtaEq As Integer = GvRow.DataKey("CveCuentaEquipo").ToString.ToEntero + Dim CvePS As Integer = GvRow.DataKey("CvePS").ToString.ToEntero + + If Objeto.RemoveCuentaEquipoPS(CvePS, CveCtaEq) Then + Alert("El PS se eliminó correctamente.", TipoMensaje.MsgInformacion) + Else + Alert("Error al eliminar el PS", TipoMensaje.MsgError) + End If + + CargaGridPS() + UpDatos.Update() + Objeto.Dispose() + End Sub + Private Sub CargaCuentasCaracteristicas() + Dim ObjCaracteristicas As New ClsGenerales + + + If ObjCaracteristicas.GetCaracteristicas(-1, 6, UsuarioActual.CveEmpresa) Then + GvAddCuentaCaracteristica.DataSource = ObjCaracteristicas.DtResultados + Else + GvAddCuentaCaracteristica.DataSource = Nothing + End If + GvAddCuentaCaracteristica.DataBind() + GvAddCuentaCaracteristica.Visible = True + GvCuentasCaracteristicas.Visible = False + + ObjCaracteristicas.Dispose() + End Sub + Private Sub GvCuentasCaracteristicas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCuentasCaracteristicas.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim CveCaracteristicaTipo As Integer = e.Row.DataKey("CveCaracteristicaTipo").ToEntero + Dim dtTemp As New DataTable + Dim objCaracteristicas As New ClsGenerales + + Dim CveCaracteristica As Integer = e.Row.DataKey("CveCaracteristica").ToEntero + Dim CveCaracteristicaValor As Integer = e.Row.DataKey("CveCaracteristicaValor").ToEntero + Dim CveCaracteristicaOpcion As Integer = e.Row.DataKey("CveCaracteristicaOpcion").ToEntero + Dim CaracteristicaValor As String = e.Row.DataKey("CaracteristicaValor") + Dim Logitud As Integer = e.Row.DataKey("Longitud").ToString.ToEntero + + Dim DdlCarcateristicaOpcion As DropDownList = e.Row.FCDropDownList("DdlCarcateristicaOpcion") + Dim TxtCuentaValor As TextBox = e.Row.FCTextBox("TxtCuentaValor") + Dim RdlCarcateristicaOpcion As RadioButtonList = e.Row.FCRadioButtonList("RdlCarcateristicaOpcion") + Dim chkCaracteristicaValor As CheckBox = e.Row.FCCheckBox("chkCaracteristicaValor") + + Dim Requerido As Integer + If e.Row.DataKey("Requerido").ToString.ToUpper = "TRUE" Then + Requerido = 1 + Else + Requerido = 0 + End If + + TxtCuentaValor.Visible = False + Dim RFVCuentaValor1 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("RFVCuentaValor1") + RFVCuentaValor1.Enabled = False + + DdlCarcateristicaOpcion.Visible = False + Dim rfvDdlCarcateristicaOpcion1 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("rfvDdlCarcateristicaOpcion1") + rfvDdlCarcateristicaOpcion1.Enabled = False + + RdlCarcateristicaOpcion.Visible = False + Dim rfvRdlCarcateristicaOpcion = e.Row.FCRequiredFieldValidator("rfvRdlCarcateristicaOpcion") + rfvRdlCarcateristicaOpcion.Enabled = False + + Dim CalendarioCaractersiticas As AjaxControlToolkit.CalendarExtender = e.Row.FCCalendarExtender("CalendarioCaractersiticas") + CalendarioCaractersiticas.Enabled = False + + Dim _cvFechaF As CompareValidator = e.Row.FCCompareValidator("cvFechaF") + _cvFechaF.Enabled = False + + chkCaracteristicaValor.Visible = False + + If objCaracteristicas.GetCaracteriscasOpciones(-1, UsuarioActual.Empresa.CveEmpresa) Then + dtTemp = objCaracteristicas.DtResultados + End If + + If CaracteristicaValor.Length > 0 Then + TxtCuentaValor.Text = CaracteristicaValor + End If + + Select Case CveCaracteristicaTipo + Case 0 + 'txt + TxtCuentaValor.Visible = True + TxtCuentaValor.MaxLength = Logitud + If Requerido = 1 Then + RFVCuentaValor1.Enabled = True + End If + Exit Select + Case 1 + DdlCarcateristicaOpcion.Visible = True + dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) + DdlCarcateristicaOpcion.DataSource = dtTemp + DdlCarcateristicaOpcion.DataBind() + DdlCarcateristicaOpcion.Items.Insert(0, New ListItem("-", "-1")) + + If CveCaracteristicaValor <> -1 Then + DdlCarcateristicaOpcion.SelectedValueExist(CveCaracteristicaOpcion) + End If + + If Requerido = 1 Then + rfvDdlCarcateristicaOpcion1.Enabled = True + End If + Exit Select + Case 2 + 'radio + RdlCarcateristicaOpcion.Visible = True + dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) + RdlCarcateristicaOpcion.DataSource = dtTemp + RdlCarcateristicaOpcion.DataBind() + + If CveCaracteristicaValor <> -1 Then + RdlCarcateristicaOpcion.SelectedValuesIfExist(CveCaracteristicaOpcion.ToString) + End If + + If Requerido = 1 Then + rfvRdlCarcateristicaOpcion.Enabled = True + End If + Exit Select + Case 3 + 'Fecha txt Fecha + TxtCuentaValor.Visible = True + TxtCuentaValor.Width = 120 + cvFechaF.Enabled = True + CalendarioCaractersiticas.Enabled = True + RegistraScript(" $('#" & TxtCuentaValor.ClientID & "').mask('00/00/0000'); ") + If Requerido = 1 Then + RFVCuentaValor1.Enabled = True + End If + Exit Select + Case 4 + 'Multiline + TxtCuentaValor.Visible = True + TxtCuentaValor.MaxLength = Logitud + If Requerido = 1 Then + RFVCuentaValor1.Enabled = True + End If + Exit Select + Case 5 + 'CheckBox + chkCaracteristicaValor.Visible = True + If CaracteristicaValor = "1" Then + chkCaracteristicaValor.Checked = True + Else + chkCaracteristicaValor.Checked = False + End If + + Exit Select + Case 6 + TxtCuentaValor.Visible = True + TxtCuentaValor.TextMode = TextBoxMode.Number + + If Requerido = 1 Then + RFVCuentaValor1.Enabled = True + End If + Exit Select + End Select + + objCaracteristicas.Dispose() + End If + End Sub + Private Sub GvAddCuentaCaracteristica_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAddCuentaCaracteristica.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim CveCaracteristicaTipo As Integer = e.Row.DataKey("CveCaracteristicaTipo").ToEntero + Dim dtTemp As New DataTable + Dim objCaracteristicas As New ClsGenerales + + Dim CveCaracteristica As Integer = e.Row.DataKey("CveCaracteristica").ToEntero + Dim Logitud As Integer = e.Row.DataKey("Longitud").ToString.ToEntero + + Dim DdlCarcateristicaOpcion As DropDownList = e.Row.FCDropDownList("DdlCarcateristicaOpcion") + Dim TxtCuentaValor As TextBox = e.Row.FCTextBox("TxtCuentaValor") + Dim RdlCarcateristicaOpcion2 As RadioButtonList = e.Row.FCRadioButtonList("RdlCarcateristicaOpcion2") + Dim chkCaracteristicaValor2 As CheckBox = e.Row.FCCheckBox("chkCaracteristicaValor2") + + If objCaracteristicas.GetCaracteriscasOpciones(-1, UsuarioActual.Empresa.CveEmpresa) Then + dtTemp = objCaracteristicas.DtResultados + End If + + Dim Requerido As Integer + If e.Row.DataKey("Requerido").ToString.ToUpper = "TRUE" Then + Requerido = 1 + Else + Requerido = 0 + End If + + TxtCuentaValor.Visible = False + Dim RFVCuentaValor2 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("RFVCuentaValor2") + RFVCuentaValor2.Enabled = False + + DdlCarcateristicaOpcion.Visible = False + Dim rfvDdlCarcateristicaOpcion2 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("rfvDdlCarcateristicaOpcion2") + rfvDdlCarcateristicaOpcion2.Enabled = False + + RdlCarcateristicaOpcion2.Visible = False + Dim rfvRdlCarcateristicaOpcion = e.Row.FCRequiredFieldValidator("rfvRdlCarcateristicaOpcion2") + rfvRdlCarcateristicaOpcion.Enabled = False + + Dim cvFechaF As CompareValidator = e.Row.FCCompareValidator("cvFechaF2") + cvFechaF.Enabled = False + + Dim CalendarioCaractersiticas As AjaxControlToolkit.CalendarExtender = e.Row.FCCalendarExtender("CalendarioCaractersiticas1") + CalendarioCaractersiticas.Enabled = False + + chkCaracteristicaValor2.Visible = False + + Select Case CveCaracteristicaTipo + Case 0 + TxtCuentaValor.Visible = True + Exit Select + Case 1 + DdlCarcateristicaOpcion.Visible = True + dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) + DdlCarcateristicaOpcion.DataSource = dtTemp + DdlCarcateristicaOpcion.DataBind() + DdlCarcateristicaOpcion.Items.Insert(0, New ListItem("-", "-1")) + + If Requerido = 1 Then + rfvDdlCarcateristicaOpcion2.Enabled = True + End If + + Exit Select + Case 2 + 'radio + RdlCarcateristicaOpcion2.Visible = True + dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) + RdlCarcateristicaOpcion2.DataSource = dtTemp + RdlCarcateristicaOpcion2.DataBind() + + If Requerido = 1 Then + rfvRdlCarcateristicaOpcion.Enabled = True + End If + Exit Select + Case 3 + 'Fecha txt Fecha + TxtCuentaValor.Visible = True + TxtCuentaValor.Width = 120 + cvFechaF.Enabled = True + CalendarioCaractersiticas.Enabled = True + RegistraScript(" $('#" & TxtCuentaValor.ClientID & "').mask('00/00/0000'); ") + + If Requerido = 1 Then + RFVCuentaValor2.Enabled = True + End If + Exit Select + Case 4 + 'Multiline + TxtCuentaValor.Visible = True + TxtCuentaValor.MaxLength = Logitud + + If Requerido = 1 Then + RFVCuentaValor2.Enabled = True + End If + Exit Select + Case 5 + 'CheckBox + chkCaracteristicaValor2.Visible = True + Exit Select + Case 6 + TxtCuentaValor.Visible = True + TxtCuentaValor.TextMode = TextBoxMode.Number + + If Requerido = 1 Then + RFVCuentaValor2.Enabled = True + End If + Exit Select + End Select + objCaracteristicas.Dispose() + End If + End Sub + Private Function GuardaCaracteristicas(Modalidad As String, CveCuentaEquipo As Integer, ByRef ObjCarac As ClsGenerales) As Boolean + Dim Retorno = False + + If Modalidad.ToString = "I" Then + For Each gvr As GridViewRow In GvAddCuentaCaracteristica.Rows + Dim CveCaracteristica As Integer = gvr.DataKey("CveCaracteristica").ToEntero + Dim CveCaracteristicaTipo As Integer = gvr.DataKey("CveCaracteristicaTipo").ToEntero + + Dim _DdlCarcateristicaOpcion As DropDownList = gvr.FCDropDownList("DdlCarcateristicaOpcion") + Dim _TxtCaracteristicaOpcion As TextBox = gvr.FCTextBox("TxtCuentaValor") + Dim _RdlCarcateristicaOpcion As RadioButtonList = gvr.FCRadioButtonList("RdlCarcateristicaOpcion2") + Dim _chkCaracteristicaValor As CheckBox = gvr.FCCheckBox("chkCaracteristicaValor2") + + Dim CveCaracteristicaOpcion As Integer = -1 + Dim CaracteristicaValor As String = "" + Dim CaracteristicaValorDate As Date = Now + Dim CaracteristicaValorInt As Integer = -1 + + Dim AgregaCaracteristica As Boolean = False + + Select Case CveCaracteristicaTipo + Case 0 + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text + + If CaracteristicaValor.Trim.Length > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Exit Select + Case 1 + 'drop + CveCaracteristicaOpcion = _DdlCarcateristicaOpcion.SelectedValue.ToEntero + + If CveCaracteristicaOpcion > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Exit Select + Case 2 + 'radio + CveCaracteristicaOpcion = _RdlCarcateristicaOpcion.SelectedValue.ToEntero + + If CveCaracteristicaOpcion > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Exit Select + Case 3 + 'Fecha txt Fecha + If _TxtCaracteristicaOpcion.Text.Trim.Length > 0 Then + CaracteristicaValorDate = _TxtCaracteristicaOpcion.Text.Trim.ToDate + CaracteristicaValor = CaracteristicaValorDate.ToString("dd/MM/yyyy") + + If CaracteristicaValor.Trim.ToDate.ToString("dd/MM/yyyy").ToString.Length > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Else + AgregaCaracteristica = False + End If + Case 4 + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text + + If CaracteristicaValor.Trim.Length > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Exit Select + Case 5 + 'CheckBox + If _chkCaracteristicaValor.Checked Then + CaracteristicaValor = "1" + Else + CaracteristicaValor = "0" + End If + AgregaCaracteristica = True + Exit Select + Case 6 + 'txt numerico + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text.ToEntero.ToString + + AgregaCaracteristica = True + Exit Select + End Select + + If AgregaCaracteristica Then + If ObjCarac.AddUpdateCaracteristicasValores(CveCaracteristica, CveCaracteristicaOpcion, CaracteristicaValor, UsuarioActual.CveUsuario, CveCuentaEquipo:=CveCuentaEquipo) Then + Retorno = True + Else + Exit For + End If + End If + Next + ElseIf Modalidad.ToString = "U" Then + For Each gvr As GridViewRow In GvCuentasCaracteristicas.Rows + Dim _CaracteristicaValor As Integer = gvr.DataKey("CaracteristicaValor").ToEntero + Dim _CveCaracteristica As Integer = gvr.DataKey("CveCaracteristica").ToEntero + Dim _CveCaracteristicaValor As Integer = gvr.DataKey("CveCaracteristicaValor").ToEntero + Dim _CveCaracteristicaTipo As Integer = gvr.DataKey("CveCaracteristicaTipo").ToEntero + + Dim _DdlCarcateristicaOpcion As DropDownList = gvr.FCDropDownList("DdlCarcateristicaOpcion") + Dim _TxtCaracteristicaOpcion As TextBox = gvr.FCTextBox("TxtCuentaValor") + Dim _RdlCarcateristicaOpcion As RadioButtonList = gvr.FCRadioButtonList("RdlCarcateristicaOpcion") + Dim _chkCaracteristicaValor As CheckBox = gvr.FCCheckBox("chkCaracteristicaValor") + + Dim CveCaracteristicaOpcion As Integer = -1 + Dim CaracteristicaValor As String = "" + Dim CaracteristicaValorDate As Date = Now + Dim CaracteristicaValorInt As Integer = -1 + + Select Case _CveCaracteristicaTipo + Case 0 + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text + Exit Select + Case 1 + 'drop + CveCaracteristicaOpcion = _DdlCarcateristicaOpcion.SelectedValue.ToEntero + Exit Select + Case 2 + 'radio + CveCaracteristicaOpcion = _RdlCarcateristicaOpcion.SelectedValue.ToEntero + Exit Select + Case 3 + 'Fecha txt Fecha + If _TxtCaracteristicaOpcion.Text.Trim.Length > 0 Then + CaracteristicaValorDate = _TxtCaracteristicaOpcion.Text.Trim.ToDate + CaracteristicaValor = CaracteristicaValorDate.ToString("dd/MM/yyyy") + Exit Select + End If + Case 4 + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text + Exit Select + Case 5 + 'CheckBox + If _chkCaracteristicaValor.Checked Then + CaracteristicaValor = "1" + Else + CaracteristicaValor = "0" + End If + Exit Select + Case 6 + 'txt numerico + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text.ToEntero.ToString + Exit Select + End Select + + If ObjCarac.AddUpdateCaracteristicasValores(_CveCaracteristica, CveCaracteristicaOpcion, CaracteristicaValor, UsuarioActual.CveUsuario, CveCaracteristicaValor:=_CveCaracteristicaValor, CveCuentaEquipo:=CveCuentaEquipo) Then + Retorno = True + Else + Exit For + End If + Next + End If + + Return Retorno + End Function +#End Region - Vta.NumeroContrato = dtVentas(0)("NumeroContrato").ToString - Vta.DescripcionContrato = dtVentas(0)("DescripcionContrato").ToString - Vta.NumeroDescripcionContrato = If($"{dtVentas(0)("NumeroContrato").ToString} - {dtVentas(0)("NumeroLicitacion").ToString}" = " - ", "", $"{dtVentas(0)("NumeroContrato").ToString} {If(dtVentas(0)("NumeroLicitacion").ToString = "", "", $" - Licitación: {dtVentas(0)("NumeroLicitacion").ToString}")}") +#Region "GPS" + Protected Sub btnCargaArrayDisp_Click(sender As Object, e As EventArgs) Handles btnCargaArrayDisp.Click + If hdnArrayDispositivo.Value.Length > 0 Then + CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) + End If + End Sub + Protected Sub DdlEstatusDispositivos_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) + End Sub + Private Sub CargaDispositivos(Optional Estatus As Integer = 1) + Dim ObjGPS As New ClsGPS + If ObjGPS.DispositivosGet(-1, Estatus, CveCliente) Then + GvDatos.DataSource = ObjGPS.DtResultados + Else + GvDatos.DataSource = Nothing + End If + ObjGPS.Dispose() + GvDatos.DataBind() + UpDispositivos.Update() + End Sub + Private Sub CargaGlobalDispositos() + Dim ObjGPS As New ClsGPS + + If ObjGPS.DispositivosGet(-1, -1, -1, -1) Then + GlobalDTDispositivos(-1) = ObjGPS.DtResultados + End If + + If ObjGPS.DispositivosUsuariosGet(-1, -1, -1, -1, -1) Then + GlobalDTDispositivosUsuarios(-1, -1) = ObjGPS.DtResultados + End If + + ObjGPS.Dispose() + End Sub + Protected Sub GvDispositivos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.VerticalAlign = VerticalAlign.Middle + If e.Row.DBCampo("Estatus").ToString.ToEntero = 1 Then + e.Row.FCLabel("LblEstatus").Text = "Activo" + e.Row.FCLabel("LblEstatus").CssClass = "label label-success" + Else + e.Row.FCLabel("LblEstatus").Text = "Inactivo" + e.Row.FCLabel("LblEstatus").CssClass = "label label-danger" + End If + e.Row.FCLinkButton("imgE").Attributes.Add("onclick", $"javascript:AbrirVentana('/GPS/WizardDispositivos.aspx?CveDispositivo={e.Row.DBCampo("CveDispositivo").ToString}&CveCliente={CveCliente}&EsPopup=1', 801, 701);") + End If + End Sub + + Protected Sub GvDispositivos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting + Dim GPS As New ClsGPS + Dim CveDispositivo As Integer = GvDatos.Rows(e.RowIndex).DataKey("CveDispositivo").ToEntero + If GPS.DispositivosDelete(CveDispositivo) Then + Alert("El Dispositivo se eliminó correctamente", TipoMensaje.MsgInformacion) + End If + GPS.Dispose() + CargaDispositivos() + CargaGlobalDispositos() + UpDispositivos.Update() + End Sub + Private Sub CargaEmpresasUsuario(CveEmpresa As Integer) + Dim Dt As DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario) + + If Dt IsNot Nothing Then + If Dt.Rows.Count > 0 Then + DdlEmpresaDispositivo.DataSource = Dt.FiltraParametros("CvePlataforma = 1 OR (CvePlataforma = 3 AND CveCliente IS NULL)", "Empresa") + + If DdlEmpresaDispositivo.SelectedValue.ToEntero() <= 0 Then + DdlEmpresaDispositivo.SelectedValueExist(CveEmpresa) + End If + + DdlClienteDispositivo.DataSource = Dt.FiltraParametros($"CvePlataforma = 3 AND CveEmpresa = {CveEmpresa}", "Empresa") + + DdlEmpresaDispositivo.DataBind() + DdlClienteDispositivo.DataBind() + + DdlClienteDispositivo.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + End If + + End Sub + Private Sub CargaClienteDispositivos(CveEmpresa As Integer) + Dim Dt As DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario) + + If Dt IsNot Nothing AndAlso Dt.Rows.Count > 0 Then + DdlClienteDispositivo.DataSource = Dt.FiltraParametros($"CvePlataforma = 3 AND CveEmpresa = {CveEmpresa}", "Empresa") + DdlClienteDispositivo.DataBind() + + DdlClienteDispositivo.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + End Sub + Protected Sub DdlEmpresaDispositivo_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaClienteDispositivos(DdlEmpresaDispositivo.SelectedValue.ToEntero()) + End Sub + + + Protected Sub ImgMoverDispositivo_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Me.NombreDispositivo = GvRow.DataKey("Display") + HTituloDispostivo.InnerText = $"Mover Dispositivo: {NombreDispositivo}" + + UpMoverDispositivo.Update() + RegistraScript($"CargaModalMoverDispositivo({GvRow.DataKey("CveDispositivo")});") + + End Sub - Vta.PedidoContrato = If(dtVentas(0)("PedidoContrato").ToString = "", Vta.NumeroDescripcionContrato, $"{dtVentas(0)("PedidoContrato").ToString} {If(Vta.NumeroDescripcionContrato = "", "", $" / {Vta.NumeroDescripcionContrato}") }") - 'Vta.PedidoContrato = dtVentas(0)("PedidoContrato").ToString +#End Region - Vta.ClienteSucursal = New Modelos.SucursalModel - Vta.ClienteSucursal.Direccion = dtVentas(0)("SucClienteDireccion").ToString - Vta.ClienteSucursal.NoExt = dtVentas(0)("SucClienteNoExt").ToString - Vta.ClienteSucursal.NoInt = dtVentas(0)("SucClienteNoInt").ToString - Vta.ClienteSucursal.Colonia = dtVentas(0)("SucClienteColonia").ToString - Vta.ClienteSucursal.CP = dtVentas(0)("SucClienteCP").ToString - Vta.ClienteSucursal.Municipio = dtVentas(0)("SucClienteCiudad").ToString - Vta.ClienteSucursal.Estado = dtVentas(0)("SucClienteEstado").ToString - Vta.ClienteSucursal.Pais = dtVentas(0)("SucClientePais").ToString - Vta.ClienteSucursal.Localidad = dtVentas(0)("SucClienteLocalidad").ToString - Vta.ClienteSucursal.CorreoSucursal = dtVentas(0)("SucClienteCorreo").ToString - Vta.ClienteSucursal.TelefonoSucursal = dtVentas(0)("SucClienteTelefono").ToString - Vta.ClienteSucursal.Sucursal = dtVentas(0)("SucursalCliente").ToString - Vta.ClienteSucursal.ImprimeNombreSucursal = dtVentas(0)("ImprimeNombreSucursal").ToString +#Region "Sucursales" + Public Sub CreaDTSucursales() + + If Not CveCliente > 0 Then + + TempDTSucursales = New DataTable + TempDTSucursales.Columns.Add("CveClienteSucursal", Type.GetType("System.Int32")) + TempDTSucursales.Columns.Add("SucursalCliente", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CiudadSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("ColoniaSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CPSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("DireccionSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("LocalidadSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("EstadoSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("PaisSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("NumExtSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("NumIntSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("TelefonoSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CorreoSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CorreoCotiziacionSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("ContactoSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("NumCuenta", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CveVendedorSucursal", Type.GetType("System.Int32")) + TempDTSucursales.Columns.Add("CveUsuario", Type.GetType("System.Int32")) + TempDTSucursales.Columns.Add("CveMetodoPago", Type.GetType("System.Int32")) + TempDTSucursales.Columns.Add("FechaIng", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("Usuario", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("LT", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("LG", Type.GetType("System.String")) + TempDTSucursales.Columns.Add() + + End If + End Sub + + Private Sub AddSucursalTemp() + Dim RowSucursal As DataRow = TempDTSucursales.NewRow() + RowSucursal("CveClienteSucursal") = 1 + RowSucursal("SucursalCliente") = TxtNombreSucursal.Text.Trim + RowSucursal("CiudadSucursal") = TxtCiudadSucursal.Text.Trim + RowSucursal("ColoniaSucursal") = TxtColoniaSucursal.Text.Trim + RowSucursal("CPSucursal") = TxtCPSucursal.Text.Trim + RowSucursal("DireccionSucursal") = TxtDireccionSucursal.Text.Trim + RowSucursal("LocalidadSucursal") = TxtLocalidadSucursal.Text.Trim + RowSucursal("EstadoSucursal") = TxtEstadoSucursal.Text.Trim + RowSucursal("PaisSucursal") = TxtPaisSucursal.Text.Trim + RowSucursal("NumExtSucursal") = TxtNumExtSucursal.Text.Trim + RowSucursal("NumIntSucursal") = TxtNumIntSucursal.Text.Trim + RowSucursal("TelefonoSucursal") = TxtTelefonoSucursal.Text.Trim + RowSucursal("CorreoSucursal") = TxtCorreoSucursal.Text.Trim + RowSucursal("CorreoCotiziacionSucursal") = TxtCorreoSucursalCotizacion.Text.Trim + RowSucursal("ContactoSucursal") = TxtContactoSucursal.Text.Trim + RowSucursal("NumCuenta") = TxtNumeroCuenta.Text + RowSucursal("CveVendedorSucursal") = DdlVendedorSucursal.SelectedValue.ToEntero + RowSucursal("CveMetodoPago") = DdlMetodoPagoSucursal.SelectedValue.ToEntero + RowSucursal("CveUsuario") = UsuarioActual.CveUsuario + RowSucursal("FechaIng") = Now.ToShortDateString + RowSucursal("Usuario") = UsuarioActual.Usuario + + RowSucursal("CveUsoCFDI") = DdlSucursalUsoCFDI.SelectedValue.ToEntero + RowSucursal("CveFormaPago33") = DdlSucursalFormaPago33.SelectedValue.ToEntero + RowSucursal("CveMetodoPago33") = DdlSucursalMetodoPago33.SelectedValue.ToEntero + + RowSucursal("LT") = If(txtLt.Text.ToDouble <> 0, txtLt.Text, "0") + RowSucursal("LG") = If(txtLg.Text.ToDouble <> 0, txtLg.Text, "0") + + TempDTSucursales.Rows.Add(RowSucursal) + + GVSucursales.DataSource = TempDTSucursales + GVSucursales.DataBind() + UpDatos.Update() + End Sub + + Private Sub BtnSendMail2_Click(sender As Object, e As EventArgs) Handles BtnSendMail2.Click + Try + If HdnCveVenta2.Value <> "-1" AndAlso HdnFolioVenta2.Value <> "-1" Then + + Dim ObjMail As New ClsSisMail() + Dim Ruta As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" + + Dim Cuerpo As String = TxtBody2.Text + Dim Asunto As String = "" + Dim TipoComprobante = "" + + If HdnTipoDocto2.Value.ToString = "Ing" Then TipoComprobante = "Factura" + If HdnTipoDocto2.Value.ToString = "Egs" Then TipoComprobante = "Nota de Crédito" + If HdnTipoDocto2.Value.ToString = "Dev" Then TipoComprobante = "Nota de Devolución" + If HdnTipoDocto2.Value.ToString = "Rem" Then TipoComprobante = "Remisión" + If HdnTipoDocto2.Value.ToString = "Cot" Then TipoComprobante = "Cotización" + If HdnTipoDocto2.Value.ToString = "Ant" Then TipoComprobante = "Anticipo" + + + Dim ObjVenta As New ClsVentas + Dim Dr As DataRow = Nothing + If ObjVenta.GetVenta(HdnCveVenta2.Value.ToEntero, UsuarioActual.CveEmpresa) Then + If ObjVenta.DtResultados.Rows.Count > 0 Then + Dr = ObjVenta.DtResultados.Rows(0) + End If + End If + ObjVenta.Dispose() + + If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then + Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta + Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa) + Cuerpo = Cuerpo.Replace("{""NombreCliente""}", LtlCliente.Text.Trim) + Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante) + Cuerpo = Cuerpo.Replace("{""SerieFolio""}", HdnSerieFolio2.Value.ToString) + If Dr IsNot Nothing Then + Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString.ToDate.ToShortDateString) + Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString.FormatoNumero) + Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString.ToDate.ToShortDateString) + End If + End If + + + If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then + Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta + Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante) + Asunto = Asunto.Replace("{""Sucursal""}", HdnSubProyecto2.Value.ToString) + Asunto = Asunto.Replace("{""SerieFolio""}", HdnSerieFolio2.Value.ToString) + End If + + If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto2.Value.Contiene("Ing", "Egs") Then + If File.Exists($"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf") AndAlso File.Exists($"{Ruta}XML\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.xml") Then + Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf" + Dim XML As String = $"{Ruta}XML\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.xml" + + + Dim ResultadoMail As Integer = 0 + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = XML}) + + + + 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail2.Text.Trim, Asunto, Cuerpo, TxtCC2.Text.Trim, LSRutasMail) Then + ResultadoMail = 1 + TxtCC2.Text = "" + TxtBody2.Text = "" + RegistraScript("$('#ModalDivMail2').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + CargaHistorial() + 'UpnHistorial.Update() + Else + Alert("Ocurrió un error al enviar el correo", TipoMensaje.MsgError) + ResultadoMail = 3 + End If + + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta2.Value.ToEntero) + ObjVentas.Dispose() + Else + Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) + End If + ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" AndAlso HdnTipoDocto2.Value.Contiene("Ing", "Egs") Then + If File.Exists(Ruta & "PDF\" & HdnFolioVenta2.Value & ".pdf") Then + Dim PDF As String = Ruta & "PDF\" & HdnFolioVenta2.Value & ".pdf" + + Dim ResultadoMail As Integer = 0 + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + + 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail2.Text.Trim, Asunto, Cuerpo, TxtCC2.Text.Trim, LSRutasMail) Then + ResultadoMail = 1 + TxtCC2.Text = "" + TxtBody2.Text = "" + RegistraScript("$('#ModalDivMail2').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + CargaHistorial() + UpnHistorial.Update() + Else + ResultadoMail = 3 + End If + + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta2.Value.ToEntero) + ObjVentas.Dispose() + Else + Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) + End If + ElseIf HdnTipoDocto2.Value = "Cot" Then + If File.Exists($"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf") Then + Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf" + + Dim ResultadoMail As Integer = 0 + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + + 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail2.Text.Trim, Asunto, Cuerpo, TxtCC2.Text.Trim, LSRutasMail) Then + ResultadoMail = 1 + TxtCC2.Text = "" + TxtBody2.Text = "" + RegistraScript("$('#ModalDivMail2').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + CargaHistorial() + UpnHistorial.Update() + Else + ResultadoMail = 3 + End If + + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta2.Value.ToEntero) + ObjVentas.Dispose() + Else + Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) + End If + End If + + 'End If + 'ObjEmprea.Dispose() + Else + Alert("No se seleccionó ninguna factura para envíar.", TipoMensaje.MsgAdvertencia) + End If + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(3, HdnCveVenta2.Value.ToEntero) + ObjVentas.Dispose() + End Try + End Sub + + Protected Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then + Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows(0) + If Dr IsNot Nothing Then + If Dr("CvePrecioLista").ToString.ToEntero > 0 Then + DdlPrecioLista.SelectedValueExist(Dr("CvePrecioLista").ToString) + End If + End If + End If + End Sub - Vta.EnviarA = New Modelos.EnviarAModel - Vta.EnviarA.CveDireccionEnvio = dtVentas(0)("CveDireccionEnvio").ToString.ToEntero - Vta.EnviarA.EnvioDireccion = dtVentas(0)("EnvioDireccion").ToString - Vta.EnviarA.EnvioColonia = dtVentas(0)("EnvioColonia").ToString - Vta.EnviarA.EnvioCiudad = dtVentas(0)("EnvioCiudad").ToString - Vta.EnviarA.EnvioEstado = dtVentas(0)("EnvioEstado").ToString - Vta.EnviarA.EnvioCP = dtVentas(0)("EnvioCP").ToString +#End Region - Vta.EnviarA.EnvioNoExt = dtVentas(0)("EnvioNoExt").ToString - Vta.EnviarA.EnvioNoInt = dtVentas(0)("EnvioNoInt").ToString - Vta.EnviarA.EnvioContacto = dtVentas(0)("EnvioContacto").ToString - 'Vta.EnviarA.EnvioPedidoContrato = dtVentas(0)("EnvioPedidoContrato").ToString +#Region "G P S" - 'INE COMPLEMENTO - If dtVentas(0)("TipoComite").ToString <> "" Then - Dim INE As New Modelos.ComplementoINE - INE.INETipoComite = dtVentas(0)("TipoComite").ToString - INE.INETipoProceso = dtVentas(0)("TipoProceso").ToString - INE.INEIdContabilidad = dtVentas(0)("IdContabilidad").ToString.ToEntero - Vta.ComplementoINE = INE + + + Private Sub EnviaCorreoGPS(Liga As String, LigaActivar As String) + + Try + Dim Para = TxtEmail.Text.Trim + Dim Asunto = "ACTIVACIÓN DEL PORTAL GPS" + Dim SBBody As New StringBuilder + 'Linia de estilos + SBBody.Append("") + 'incio Cuerpo del correo + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("ALTA DE CUENTA") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.AppendFormat(" Estimado {0}:
    ", TxtNombre.Text.ToUpper) + SBBody.AppendFormat("El presente correo es para informarle que se le han asignado los siguientes datos para el acceso al Portal GPS de: {0}

    ", UsuarioActual.Empresa.Empresa) + SBBody.Append("
    ") + SBBody.Append("
    Datos de usuario
    ") + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Dirección de Acceso
    ") + SBBody.AppendFormat("", Liga) + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Clave
    ") + SBBody.AppendFormat("
    {0}
    ", CveCliente) + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Usuario
    ") + SBBody.AppendFormat("
    {0}
    ", "Admin") + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Haga click para activar su cuenta
    ") + SBBody.AppendFormat("", LigaActivar) + SBBody.Append("
    ") + + + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("Para Activar su cuenta debera cambiar su contraseña.

    ") + SBBody.Append("
    ") + SBBody.Append("Nota Favor de NO responder este correo. ") + SBBody.Append("


    ") + SBBody.AppendFormat("", UrlSitio) + SBBody.Append("
    ") + SBBody.Append("
    ") + 'Termino Cuerpo del correo + + Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(Asunto, Para, SBBody.ToString)) + Hilo.Start() + Alert("El correo de activación se ha enviado correctamente a: " + TxtEmail.Text + ".", TipoMensaje.MsgInformacion) + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + + Private Sub BtnRegistrarCliente_Click(sender As Object, e As EventArgs) Handles BtnRegistrarCliente.Click + Dim ObjClientes As New ClsClientes + + If ObjClientes.RegistrarCliente(CveCliente) Then + RegistraScript("location.reload();") + End If + + ObjClientes.Dispose() + End Sub + + +#End Region + +#Region "C O N T R A T O S" + Private Sub CargaDatosContrato() + If CveCliente <= 0 Then + Exit Sub + End If + + Dim ObjContratos As New ClsContratos + If ObjContratos.GetReporteContratosAvancesCP(UsuarioActual.CveEmpresa, CveCliente, -1, -1, -1, -1, 1) Then + GvDatosAvance.DataSource = ObjContratos.DtResultados + Else + Alert("Ocurrió un Error al obtener el Reporte de Avances. Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + If ObjContratos.GetReporteContratosAvancesCP(UsuarioActual.CveEmpresa, CveCliente, -1, -1, -1, -1, -2) Then + GvContratosClienteInactivos.DataSource = ObjContratos.DtResultados + Else + Alert("Ocurrió un Error al obtener el Reporte de Avances Inactivos. Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + ObjContratos.Dispose() + GvDatosAvance.DataBind() + UpContratosInactivos.DataBind() + + + If GvDatosAvance.Rows.Count > 0 Or GvContratosClienteInactivos.Rows.Count > 0 Then + TabContratos.Visible = True + End If + End Sub + + Private Sub GvDatosAvance_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAvance.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Then + e.Row.Cells(0).Text = "Total:" + e.Row.CssClass = "Totales white" + End If + End If + End Sub + + Private Sub GvContratosClienteInactivos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvContratosClienteInactivos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Then + e.Row.Cells(0).Text = "Total:" + e.Row.CssClass = "Totales white" + End If + End If + End Sub + +#End Region + +#Region "M E T O D O S " + Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipo.SelectedIndexChanged + If DTHistorialVentas IsNot Nothing AndAlso RblTipo.SelectedValue <> "-1" Then + + Dim tmp As DataTable = DTHistorialVentas.FiltraParametros($"TipoDocto = '{RblTipo.SelectedValue}'") + If tmp.Rows.Count > 0 Then + Dim Totales As DataRow = tmp.NewRow + Totales("SubTotal") = tmp.SUM("SubTotal") + Totales("Total") = tmp.SUM("Total") + Totales("Descuento") = tmp.SUM("Descuento") + Totales("Amortizacion") = tmp.SUM("Amortizacion") + Totales("MAX_Total") = tmp.MAX("MAX_Total") + Totales("AVG_Total") = tmp.AVG("AVG_Total") + Totales("MIN_Total") = tmp.MIN("MIN_Total") + Totales("CountTotal") = tmp.COUNT("CountTotal") + tmp.Rows.InsertAt(Totales, 0) End If - - - Dim DR As DataRow = TmpDTImpuestos.NewRow() - If dtVentas(0)("SubTotal").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Subtotal" : DR("Importe") = dtVentas(0)("SubTotal").ToString.ToDouble : DR("Orden") = 10 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("Descuento").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = dtVentas(0)("Descuento").ToString.ToDouble : DR("Orden") = 20 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("Amortizacion").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = dtVentas(0)("Amortizacion").ToString.ToDouble : DR("Orden") = 30 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("SubTotal").ToString.ToDouble <> (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) Then DR("ImpuestoLocal") = "SubTotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) : DR("Orden") = 40 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("IVA").ToString.ToDouble >= 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 50 : TmpDTImpuestos.Rows.Add(DR) - - 'solo para eclipse, que muesre un subtotal debajo de IVA - If UsuarioActual.CveEmpresa = 15 Then DR = TmpDTImpuestos.NewRow() : DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) + dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 51 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("RetIVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = dtVentas(0)("RetIVA").ToString.ToDouble : DR("Orden") = 60 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("RetISR").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = dtVentas(0)("RetISR").ToString.ToDouble : DR("Orden") = 70 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - - If dtVentas(0)("IEPS").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "IEPS" : DR("Importe") = dtVentas(0)("IEPS").ToString.ToDouble : DR("Orden") = 80 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - - If dtVentas(0)("Total").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = dtVentas(0)("Total").ToString.ToDouble : DR("Orden") = 100 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - - If ObjVentas.GetVentaDetalle(CveVenta) Then 'Obtenemos el Detalle de la Oorden de Compra - Vta.DtDetalle = ObjVentas.DtResultados - End If - - If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then - - Dim dtImpuesto As DataTable = ObjVentas.DtResultados - If dtImpuesto.Rows.Count > 0 Then - For Each Row As DataRow In dtImpuesto.Rows - Dim Orden = 80 - If Row("Importe").ToString.ToDouble <> 0 Then - DR("ImpuestoLocal") = Row("ImpuestoLocal").ToString - DR("Importe") = Row("Importe").ToString.ToDouble - DR("Orden") = Orden - TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - Orden = Orden + 1 - End If - Next - End If - Vta.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC") - - End If - - 'TmpDT DESGLOSE DE IMPUESTOS 3.3 - For Each dr1 As DataRow In Vta.DtDetalle.Rows - Dim DrIVA As DataRow = Nothing - Dim DrIEPS As DataRow = Nothing - - Try - DrIVA = TmpDTImpuestosIVAIEPS.Select("Impuesto = 'IVA'")(0) - Catch ex As Exception - DrIVA = Nothing - End Try - - If DrIVA IsNot Nothing Then - DrIVA("Importe") = DrIVA("Importe").ToString.ToDouble + dr1("ImporteIVA").ToString.ToDouble - TmpDTImpuestosIVAIEPS.AcceptChanges() - Else - Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() - If dr1("PorcentajeIVA").ToString.ToDouble >= 0 Then - DR2("Impuesto") = "IVA" : DR2("tasa") = "16 %" : DR2("Importe") = dr1("ImporteIVA").ToString.ToDouble : DR2("Orden") = "1" - TmpDTImpuestosIVAIEPS.Rows.Add(DR2) - TmpDTImpuestosIVAIEPS.AcceptChanges() - End If - End If - - Try - DrIEPS = TmpDTImpuestosIVAIEPS.Select($"Impuesto = 'IEPS' AND tasa = '{dr1("PorcentajeIEPS").ToString.ToDouble * 100} %'")(0) - Catch ex As Exception - DrIEPS = Nothing - End Try - - If DrIEPS IsNot Nothing Then - DrIEPS("Importe") = DrIEPS("Importe").ToString.ToDouble + dr1("ImporteIEPS").ToString.ToDouble - TmpDTImpuestosIVAIEPS.AcceptChanges() - Else - Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() - If dr1("PorcentajeIEPS").ToString.ToDouble > 0 Then - DR2("Impuesto") = "IEPS" : DR2("tasa") = String.Format("{0} {1}", dr1("PorcentajeIEPS").ToString.ToDouble * 100, "%") : DR2("Importe") = dr1("ImporteIEPS").ToString.ToDouble : DR2("Orden") = If(dr1("PorcentajeIEPS").ToString = "0.03", "2", If(dr1("PorcentajeIEPS").ToString = "0.06", "3", If(dr1("PorcentajeIEPS").ToString = "0.07", "4", If(dr1("PorcentajeIEPS").ToString = "0.09", "5", "")))) - TmpDTImpuestosIVAIEPS.Rows.Add(DR2) - TmpDTImpuestosIVAIEPS.AcceptChanges() - End If - End If - - Next - Vta.DtDesgloseImpuestos = TmpDTImpuestosIVAIEPS.FiltraParametros("", Orderby:="Orden ASC") - - If ObjVentas.GetVentasFirmas(CveVenta) Then - Vta.DtFirmas = ObjVentas.DtResultados - End If - - If UsuarioActual.CveEmpresa.Contiene(119) Then - If dtVentas(0)("TipoDocto").ToString.Contiene("Ing", "Ant", "Rem") Then - 'carga as notas de credito vinculadas - If ObjVentas.GetVentasAntNC(CveVenta, -1) Then - Vta.DtDocumentosRelacionados = ObjVentas.DtResultados - - End If - End If - - If dtVentas(0)("TipoDocto").ToString.Contiene("Egs", "Dev", "Ant") Then - If ObjVentas.GetVentasAntNC(-1, CveVenta) Then - Vta.DtDocumentosRelacionados = ObjVentas.DtResultados - End If - End If - End If - - - 'CFDI RELACIONADO - If dtVentas(0)("CveTipoRelacion").ToString.ToEntero > 0 Then - Vta.Timbre.Comprobante.TipoComprobante = If(Vta.TipoDocto.Contiene("Ing", "Ant"), "I", If(Vta.TipoDocto.Contiene("Egs", "Dev"), "E", "")) - If Vta.Timbre.Comprobante.TipoComprobante = "E" Then - If Vta.TipoDocto.Contiene("Egs") Then - Vta.Timbre.CFDIRelacionados.TipoRelacion = "01" - Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" - End If - If Vta.TipoDocto.Contiene("Dev") Then - Vta.Timbre.CFDIRelacionados.TipoRelacion = "03" - Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" - End If - Vta.Timbre.CFDIRelacionados.UUID.Add(dtVentas(0)("FolioFiscalPadre").ToString) - End If - ' cuando es refacturacoin es cfdirelacionado, con relacion 04 - If Vta.Timbre.Comprobante.TipoComprobante = "I" AndAlso (dtVentas(0)("Total").ToString.ToDouble = dtVentas(0)("TotalPadre").ToString.ToDouble) Then - Vta.Timbre.CFDIRelacionados.TipoRelacion = "04" - Vta.Timbre.CFDIRelacionados.UUID.Add(dtVentas(0)("FolioFiscalPadre").ToString) - Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Refacturación de Ingreso" - End If - End If - + GVHistorial.DataSource = tmp + ElseIf DTHistorialVentas IsNot Nothing AndAlso RblTipo.SelectedValue = "-1" Then + GVHistorial.DataSource = DTHistorialVentas End If - ObjVentas.Dispose() + GVHistorial.DataBind() + End Sub + Private Sub DdlSucursalCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSucursalCliente.SelectedIndexChanged + CargaCotizaciones(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + CargaHistorial(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + CargaCxC(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + CargaAnticipos(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + CargaBancos(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + + UpDatos.Update() + End Sub + Protected Sub LbDesactivaUsuario_Click(sender As Object, e As EventArgs) Handles LbDesactivaPortal.Click + 'Alert("Se Van a desativar todos o eliminar todos, junto con el Admin?") + Dim ObjUsuario As New ClsSisUsuarios + Dim ErrorUsuario As Boolean = False + + ObjUsuario.IniciaTransacSQL() + + For Each Dr As DataRow In DirectCast(ViewState("DTUsuariosCliente"), DataTable).Rows + 'se desactiva el usuario y se restablece la contraseña + If Not ObjUsuario.UpdateUsuarioPortal(Dr("Usuario").ToString, Dr("Nombre").ToString, Dr("Correo").ToString, False, ContraseñaPredeterminadaEncriptada, Dr("CveCliente").ToString.ToEntero, Dr("CveProveedor").ToString.ToEntero, Dr("CveUsuario").ToString.ToEntero, UsuarioActual.CveUsuario) Then + ErrorUsuario = True + End If + Next + + If ErrorUsuario Then + ObjUsuario.RollBack() + Else + LblUsuarioActivo.Text = "No" + HdnCveUsuarioPortalActivado.Value = "0" + trEnviarActivacion.Visible = True + trDesactivarUsuario.Visible = False + + 'DivPermisosPortal.Visible = False + + ObjUsuario.GetUsuariosPortal(-1, CveCliente, -1) + + ViewState("DTUsuariosCliente") = ObjUsuario.DtResultados + GvUsuariosPortal.DataSource = ViewState("DTUsuariosCliente") + GvUsuariosPortal.DataBind() + 'divUsuariosPortal.Visible = False + + ObjUsuario.Commit() + End If + + ObjUsuario.Dispose() + + If UsuarioActual.Empresa.CvePlataforma = 1 Then + CargaUsuariosPortalCliente() + End If + + UpGvUsuarios.Update() + UPPUsuarios.Update() + + End Sub + Private Sub AbonaaCuenta() + + 'si usa bancos, se va abrir el popupie para la recepci[on del pago + Dim MsgError As String = "" + + Dim ObjMov As New ClsContabilidad + ObjMov.IniciaTransacSQL() + Dim CvePrePoliza As Integer = ObjMov.AddPrePolizas("Cli", 2, TxtCantidad.Text.Trim.ToDouble, TxtCantidad.Text.Trim.ToDouble, 1, TxtFechaPago.Text.ToDate, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If CvePrePoliza > 0 Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtCantidad.Text.ToDecimal, TxtReferencia.Text, 2, TxtReferencia.Text, Now, 0, -1, -1, CveVenta:=HdnCveVentaAbono.Value.ToEntero, CveCliente:=CveCliente) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtCantidad.Text.ToDecimal, TxtReferencia.Text, 4, TxtReferencia.Text, Now, 0, -1, -1, CveVenta:=HdnCveVentaAbono.Value.ToEntero, CveCliente:=CveCliente) Then + + 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 + Else + MsgError = "No se pudo insertar la póliza" + End If + + If MsgError = "" Then + Alert("El Documento se guardó correctamente.", TipoMensaje.MsgInformacion, "window.opener.location.href = window.opener.location.href; window.close();") + ObjMov.Commit() + + UpDatos.Update() + + Else + ObjMov.RollBack() + End If + ObjMov.Dispose() + + + + End Sub + Private Sub ChecaPermiteCredito() + ' DivParametros.Disabled = Not ChkPermiteCredito.Checked + 'For Each Control As Control In UpParametros.Controls + ' Control.Visible = ChkPermiteCredito.Checked + 'Next + + DivPortal.Visible = UsuarioActual.TienePermisoProceso(162) + + TxtLimiteCredito.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtPlazoCobranza.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtPlazoCobranzaRemision.Enabled = UsuarioActual.TienePermisoProceso(162) + + DdlTipoPago.Enabled = UsuarioActual.TienePermisoProceso(162) + DdlResponsable.Enabled = UsuarioActual.TienePermisoProceso(162) + + ChkLunes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkMartes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkMiercoles.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkJueves.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkViernes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkSabado.Enabled = UsuarioActual.TienePermisoProceso(162) + + ChkRevLunes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevMartes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevMiercoles.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevJueves.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevViernes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevSabado.Enabled = UsuarioActual.TienePermisoProceso(162) + + TxtDiasEspecifico.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtDocumentacion.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtCobranzaContacto.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtCobranzaTelefono.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtCobranzaExt.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtCobranzaCorreo.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtHorario.Enabled = UsuarioActual.TienePermisoProceso(162) + + TxtPortalFacturacion.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtObsDiasRevision.Enabled = UsuarioActual.TienePermisoProceso(162) + + UpParametros.Update() + End Sub + Private Function NombreCuenta(Id As Integer) As String + Dim Retorno As String = "" + + If UsuarioActual.Empresa.ServerContPAQi = "" Then Return "" + Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) + If ObjContabilidad.GetCuentas(Id, "-1", -1) Then + Retorno = ObjContabilidad.DtResultados.FiltroPrimeroValor("CtaCodigo") + End If + + Return Retorno + End Function + Private Sub SetValues() + ViewState("Orden") = "" + ViewState("OrdenUsuarios") = "" + TxtFechaPago.Text = Now.ToShortDateString + txtFechaI.Text = Now.ToShortDateString + txtFechaF.Text = Now.ToShortDateString + TxtFechaImportarSaldos.Text = Now.ToShortDateString + TxtFechaIUsados.Text = Now.FirstDayOfMonth.ToShortDateString + TxtFechaFUsados.Text = Now.LastDayOfMonth.ToShortDateString + CobranzaTelefono = "" + CodigoCliente = "" + + End Sub + + Protected Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click + If TxtExcel.getfiles().Archivos.Count > 0 Then + Dim file As Archivo = TxtExcel.getfiles().Archivos(0) + Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch + Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") + CargarArchivo(Directorio, file.filename, Tipo) + Else + Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError) + End If + End Sub + Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String) + Dim dt As New DataTable + Dim Conexion As Odbc.OdbcConnection = Nothing + Dim ErrorArchivo = False + Try + Select Case Tipo + Case "CSV" + Conexion = New Odbc.OdbcConnection("Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=" + Ruta + ";Extensions=asc,csv,tab,txt;") + Conexion.Open() + Dim cmd = Conexion.CreateCommand() + cmd.CommandType = CommandType.Text + cmd.CommandText = $"SELECT * FROM [{FileName}]" + Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) + DataAdapter.Fill(dt) + Case "EXCEL" + Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") + Conexion.Open() + Dim cmd = Conexion.CreateCommand() + cmd.CommandType = CommandType.Text + cmd.CommandText = "SELECT * FROM [Hoja1$]" + Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) + DataAdapter.Fill(dt) + Case Else + Alert("El archivo no tiene el formato correcto", TipoMensaje.MsgError) + Exit Sub + End Select + Catch ex As Exception + ErrorArchivo = True + OnError("Ocurrio un error al leer el archivo
    " & ex.Message, ex) + End Try + Conexion.Close() + If Not ErrorArchivo Then + If Not dt.Columns(0).ColumnName = "SerieFolio" Then + Alert("El nombre de la primera columna debe ser 'SerieFolio'.Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(1).ColumnName = "Fecha" Then + Alert("El nombre de la segunda columna debe ser 'Fecha'.Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(2).ColumnName = "Importe" Then + Alert("El nombre de la tercera columna debe ser 'Importe'.Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(3).ColumnName = "Saldo" Then + Alert("El nombre de la cuarta columna debe ser 'Saldo'.Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + Dim XmlStream As New System.IO.MemoryStream + dt.TableName = "Datos" + Dim ObjClientes As New ClsClientes + Dim writer As New System.IO.StringWriter + dt.WriteXml(writer) + If ObjClientes.GetVentasConciliacion(CveCliente, DataTableToXml(writer)) Then + ObjClientes.DtResultados.ExportToExcel("Resultados") + End If + ObjClientes.Dispose() + End If + End Sub + Private Function DataTableToXml(ByVal stream As System.IO.TextWriter) As String + Return stream.ToString() + End Function + Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click + Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\FormatoClientes.csv" + Dim Archivo As New FileInfo(Directorio) + If Archivo.Exists Then + Response.Clear() + Response.ClearHeaders() + Response.ClearContent() + Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name) + Response.AddHeader("Content-Length", Archivo.Length.ToString()) + Response.ContentType = "text/plain" + Response.Flush() + Response.TransmitFile(Archivo.FullName) + Response.End() + End If + End Sub + Private Sub EnviaCorreo2(Liga As String, LigaActivar As String) + + Try + Dim Para = TxtCorreoUsuarioPortal.Text.Trim + Dim Asunto = "ACTIVACIÓN DEL PORTAL DE CLIENTE" + Dim SBBody As New StringBuilder + 'Linia de estilos + SBBody.Append("") + 'incio Cuerpo del correo + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("ALTA DE CUENTA") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.AppendFormat(" Estimado {0}:
    ", TxtNombreUsuarioPortal.Text.ToUpper) + SBBody.AppendFormat("El presente correo es para informarle que se le han asignado los siguientes datos para el acceso al Portal del Cliente de: {0}

    ", UsuarioActual.Empresa.Empresa) + SBBody.Append("
    ") + SBBody.Append("
    Datos de usuario
    ") + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Dirección de Acceso
    ") + SBBody.AppendFormat("", Liga) + SBBody.Append("
    ") + + 'SBBody.Append("
    ") + 'SBBody.Append("
    Clave
    ") + 'SBBody.AppendFormat("
    {0}
    ", CveCliente) + 'SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Usuario
    ") + SBBody.AppendFormat("
    {0}
    ", TxtCorreoUsuarioPortal.Text) + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Contraseña Predeterminada
    ") + SBBody.AppendFormat("
    {0}
    ", ContraseñaPredeterminada) + SBBody.Append("
    ") + + + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Haga click para activar su cuenta
    ") + SBBody.AppendFormat("", LigaActivar) + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("Para Activar su cuenta debera cambiar su contraseña.

    ") + SBBody.Append("
    ") + SBBody.Append("Nota Favor de NO responder este correo. ") + SBBody.Append("


    ") + + SBBody.AppendFormat("", UrlSitio) + SBBody.Append("
    ") + SBBody.Append("
    ") + 'Termino Cuerpo del correo + + Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo2(Asunto, Para, SBBody.ToString)) + Hilo.Start() + Alert("El correo se ha enviado correctamente a: " + TxtCorreoUsuarioPortal.Text + ".", TipoMensaje.MsgInformacion) + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + Private Sub MandaCorreo2(Asunto As String, Para As String, Body As String) + Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) + a.GuardaLog() + Dim Mail As New ClsSisMail() + Dim Envio As Boolean = Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) + + End Sub + Protected Sub BtnCobranzaSMS_Click(sender As Object, e As EventArgs) + Dim Telefono = CobranzaTelefono + If Telefono.Length <> 10 Then + Alert("El telefono de cobranza no tiene el formato correcto y es necesario.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim DtCxC As DataTable + Dim FI = If(TxtFechaInicioCxP.Text = "" Or TxtFechaInicioCxP.Text = "__/__/____", "-1", TxtFechaInicioCxP.Text) + Dim FF = If(TxtFechaFinCxP.Text = "" Or TxtFechaFinCxP.Text = "__/__/____", "-1", TxtFechaFinCxP.Text) + Dim StrSaldo As String = "" + + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1) Then + DtCxC = If(DdlTipoCuentasCxC.SelectedValue = "-1", If(DdlTipoDocto.SelectedValue = "-1", ObjMovtos.DtResultados, ObjMovtos.DtResultados.FiltraParametros($"TipoDocto = '{DdlTipoDocto.SelectedValue}'")), + If(DdlTipoDocto.SelectedValue = "-1", ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' ", "Moneda, OrdenVencimiento ,FechaVencimiento"), ObjMovtos.DtResultados.FiltraParametros($"Tipo = 'Act' AND TipoDocto = '{DdlTipoDocto.SelectedValue}'", "Moneda, OrdenVencimiento ,FechaVencimiento"))) + + Dim Pesos As Double = DtCxC.SUM("Saldo", "CveMoneda = 1 and CveVenta > 0") + Dim Dolares As Double = DtCxC.SUM("Saldo", "CveMoneda = 2 and CveVenta > 0") + If Pesos > 0 Then StrSaldo = $" $ {Pesos.FormatoNumero} pesos" + If Dolares > 0 Then StrSaldo = $"{StrSaldo} ${Dolares.FormatoNumero} dólares" + ObjMovtos.Dispose() + Else + DtCxC = Nothing + ObjMovtos.Dispose() + Exit Sub + End If + + If StrSaldo.Length > 0 Then + Dim Mensaje = "" + Select Case UsuarioActual.CveEmpresa + Case 4 + Mensaje = $"Cliente de VSH Seguridad su saldo pendiente es de $ {StrSaldo} fecha limite 25/{Now.ToString("MM/yyyy")} llamar al 6622106400 #REFERENCIA {CodigoCliente} " + End Select + + Dim ObjSMS As New ClsTecnoMovil + Dim ObjEventos As New ClsOIEventos + If ObjSMS.EnviarMensajeWS(Telefono, Mensaje) Then + If ObjEventos.AddEventoBitacora($"Estado de cuenta enviado al cliente via SMS. Telefono: {Telefono} Mensaje: {Mensaje}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) Then + Alert("El mensaje se envió correctamente", TipoMensaje.MsgInformacion) + Else + Alert("El mensaje se envió correctamente. Pero no se pudo guardar historial", TipoMensaje.MsgAdvertencia) + End If + End If + ObjEventos.Dispose() + CargaEventoBitacora() + UPEventoBitacora.Update() + Else + Alert("No hay saldo pendiente del cliente. Por lo cual no se envió el mensaje.", TipoMensaje.MsgInformacion) + End If + + + End Sub - Return PdfFactura(Vta) +#End Region + +#Region "IMPRIMIR GVHistorial" + + + Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs) + Dim retorno As Byte() = Nothing + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + + 'OBTENEMOS LOS DATOS + 'Dim DTHistorial As DataTable + 'If ObjClientes.GetHistorialVentas(UsuarioActual.CveCliente, TopRegistros) Then + ' DTHistorial = ObjClientes.DtResultados + 'Else + ' DTHistorial = Nothing + 'End If + + If DTHistorialVentas.Rows.Count > 0 Then + Dim dr As DataRow = DTHistorialVentas.Rows(0) + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion)) + params.Add(New ReportParameter("TelefonoEmpresa", UsuarioActual.Empresa.Telefono)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + + ImprimirPDF("Empresas/Grales/Formatos/ClienteHistorial.rdlc", DTHistorialVentas, params, "Reporte de Historial", "Excel") + Else + Alert("Ocurrió un error.", TipoMensaje.MsgAdvertencia) + End If + + End Sub + + + Protected Sub BtnPDFHistorial_Click(sender As Object, e As EventArgs) + Dim retorno As Byte() = ImprimirReporteHistorial() + If retorno IsNot Nothing Then + ImprimirbytesPDF(retorno, "Reporte de Historial", Descarga:=True) + End If + End Sub + + Protected Function ImprimirReporteHistorial() As Byte() + Dim retorno As Byte() = Nothing + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim ObjClientes As New ClsClientes() + + 'OBTENEMOS LOS DATOS + 'Dim DTHistorial As DataTable + 'If ObjClientes.GetHistorialVentas(UsuarioActual.CveCliente, TopRegistros) Then + ' DTHistorial = ObjClientes.DtResultados + 'Else + ' DTHistorial = Nothing + 'End If + + If DTHistorialVentas.Rows.Count > 0 Then + Dim dr As DataRow = DTHistorialVentas.Rows(0) + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion)) + params.Add(New ReportParameter("TelefonoEmpresa", UsuarioActual.Empresa.Telefono)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + + retorno = StreamPDF("Empresas/Grales/Formatos/ClienteHistorial.rdlc", DTHistorialVentas, params, "Reporte de Historial") + Else + Alert("Ocurrió un error.", TipoMensaje.MsgAdvertencia) + End If + ObjClientes.Dispose() + + Return retorno End Function -#End Region -#Region "COMERCIO EXTERIOR" - Public Sub CargaCombosComercioExterior() - - DdlTipoOperacion.Items.Clear() - DdlTipoOperacion.DataSource = GlobalDTTipoOperacion() - DdlTipoOperacion.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlTipoOperacion.DataBind() - - DdlIncoterm.Items.Clear() - DdlIncoterm.DataSource = GlobalDTIncoterm() - DdlIncoterm.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlIncoterm.DataBind() - - DdlClavePedimento.Items.Clear() - DdlClavePedimento.DataSource = GlobalDTClavePedimento() - DdlClavePedimento.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlClavePedimento.DataBind() - - DdlMotivoTraslado.Items.Clear() - DdlMotivoTraslado.DataSource = GlobalDTSATMotivoTraslado() - DdlMotivoTraslado.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlMotivoTraslado.DataBind() - - CargaPais() - CargaEstado() - CargaMunicipio() - CargaColonia() +#End Region +#Region "C O B R A N Z A" + Public Sub Visitas_Click(sender As Object, e As EventArgs) + RegistraScript(String.Format("$('#{0}').modal();", "DivVisitas")) End Sub +#End Region - Private Sub CargaPais() - DdlPais.Items.Clear() - DdlPais.DataSource = GlobalDTPais() - DdlPais.DataBind() - DdlPais.SelectedValueExist("151") +#Region "Usuarios" + Protected Sub GvUsuarios_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvUsuarios.RowDeleting + Dim CveUsuario As Integer = GvUsuarios.Rows(e.RowIndex).DataKey("CveUsuario").ToEntero + Dim ObjUsuarios As New ClsSisUsuarios + If ObjUsuarios.DeleteClienteUsuario(CveUsuario, CveCliente) Then + Alert("El Usuario se eliminó correctamente", TipoMensaje.MsgInformacion) + End If + ObjUsuarios.Dispose() + CargaGlobal() + CargaUsuarios() + UpDispositivos.Update() + End Sub + + Public Sub CargaGlobal() + Dim ObjUsuarios As New ClsSisUsuarios + If ObjUsuarios.GetUsuariosEmpresas(-1) Then + Application("GlobalDTUsuarios") = ObjUsuarios.DtResultados + End If + ObjUsuarios.Dispose() + End Sub + + Protected Sub GvUsuarios_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvUsuarios.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.FCLinkButton("imgE").Attributes.Add("onclick", $"javascript:AbrirVentana('/Sistemas/PopUpAddUsuario.aspx?CveUsuario={e.Row.DBCampo("CveUsuario").ToString}&CveCliente={CveCliente}', 801, 701);") + If UsuarioActual.Empresa.CvePlataforma = 1 Then + e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Center + e.Row.Cells(5).Visible = False + End If + End If + If e.Row.RowType = DataControlRowType.Header Then + If UsuarioActual.Empresa.CvePlataforma = 1 Then + e.Row.Cells(5).Visible = False + End If + End If + End Sub +#End Region + + +#Region "C U E N T A S - B A N C A R I A S" + + Private Sub CargaCuentasBancarias() + Dim ObjCuentasBancos As New ClsGenerales + ViewState("OrdenCuentasBancos") = "" + DTCuentasBancos = New DataTable + TempDTCuentasBancos = New DataTable + + If ObjCuentasBancos.GetCuentasDepositos(CveCliente:=CveCliente) Then + DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados) + Else + Alert("No se pudieron cargar las cuentas bancarias. Por favor intente nuevamente.", TipoMensaje.MsgAdvertencia) + End If + + If CveCliente < 0 Then + TempDTCuentasBancos = DTCuentasBancos.Clone + + End If + + ObjCuentasBancos.Dispose() + CargaPSGridCuentasBancos() + + RecargaGlobalCuentasBancarias() + CargaMonedas() + End Sub + Protected Sub LbAgregarCuentaBanco_Click(sender As Object, e As EventArgs) + Dim EsBancomer = False + + If TxtNombreBanco.Text.ToUpper.Contains("BBVA") Or TxtNombreBanco.Text.ToUpper.Contains("BANCOMER") Or (TxtCLABE.Text.Length = 18 AndAlso TxtCLABE.Text.Substring(0, 3) = "012") Then + EsBancomer = True + End If + + + If TxtNumeroCuenta2.Text.Trim.Length = 0 AndAlso TxtCLABE.Text.Trim.Length = 0 AndAlso TxtSWIFT.Text.Trim.Length = 0 AndAlso TxtConvenioCIE.Text.Trim.Length = 0 Then + Alert("Debe especificar al menos un numero de cuenta.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18 + If TxtCLABE.Text.Trim.Length <> 0 AndAlso TxtCLABE.Text.Trim.Length <> 18 Then + Alert("La CLABE debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'RESTRICCIONES - GLUYAS + If UsuarioActual.CveEmpresa = 66 Then + + 'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER + If TxtCLABE.Text.Trim.Length <> 18 And TxtCLABE.Text.Trim.Length = 0 And Not EsBancomer And TxtSWIFT.Text.Trim.Length = 0 Then + Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10 + If TxtNumeroCuenta2.Text.Trim.Length <> 0 AndAlso TxtNumeroCuenta2.Text.Trim.Length <> 10 AndAlso EsBancomer Then + Alert("El número de cuenta debe tener una longitud de 10 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'SI CIE TIENE ALGO REFERENCIA OBLIGATORIA + If TxtConvenioCIE2.Text.Trim.Length <> 0 And TxtReferencia2.Text.Trim.Length < 3 Then + Alert("Cuando se ingresa Convenio CIE se debe especificar una referencia. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA" + If EsBancomer AndAlso Not (TxtNumeroCuenta2.Text.Trim.Length = 10 Or TxtConvenioCIE2.Text.Trim.Length <> 0) Then + Alert("Para cuentas BBVA BANCOMER es obligatorio el Número de Cuenta o CIE.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Else + + 'SI CIE TIENE ALGO DEBE TENER UNA LOGITUD MINIMA DE 5 + If TxtConvenioCIE2.Text.Trim.Length <> 0 And TxtConvenioCIE2.Text.Trim.Length < 5 Then + Alert("El Convenio CIE debe tener una longitud de al menos 5 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + End If + Dim Estatus As Boolean + If ChkEstatus2.Checked = True Then Estatus = True Else Estatus = False + + AgregarCuentaBanco(TxtNombreBanco.Text.Trim, TxtNumeroSucursal.Text.Trim, TxtCLABE.Text.Trim, TxtSWIFT.Text.Trim, TxtPlaza.Text.Trim, TxtNumeroCuenta2.Text.Trim, TxtConvenioCIE2.Text.Trim, TxtReferencia2.Text.Trim, "", DdlMoneda.SelectedValue.ToEntero, DdlMoneda.SelectedItem.Text, Estatus) + End Sub + Private Sub AgregarCuentaBanco(NombreBanco As String, NumeroSucursal As String, CLABE As String, SWIFT As String, Plaza As String, NumeroCuenta As String, ConvenioCIE As String, Referencia As String, RefCrediProveedor As String, CveMoneda As Integer, Moneda As String, Estatus As Boolean) + Dim ObjCuentasBancos As New ClsGenerales + If Modalidad = "A" Then + + If CveCliente > 0 Then + + If ObjCuentasBancos.AddCuentasDepositos(NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, RefCrediProveedor, UsuarioActual.CveUsuario, CveMoneda, CveCliente:=CveCliente) Then + DTCuentasBancos.Clear() + DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente))) + Alert("Cuenta Bancaria agregada con éxito.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) + Else + Alert("Error al registrar la cuenta bancaria. Por favor intente nuevamente", TipoMensaje.MsgError) + End If + + Else + Dim Row As DataRow + Row = TempDTCuentasBancos.NewRow + + Row("BancoNombre") = NombreBanco + Row("Sucursal") = NumeroSucursal + Row("CLABE") = CLABE + Row("SWIFT") = SWIFT + Row("Plaza") = Plaza + Row("Cuenta") = NumeroCuenta + Row("CIE") = ConvenioCIE + Row("Referencia") = Referencia + Row("RefCrediProveedor") = RefCrediProveedor + Row("CveMoneda") = CveMoneda + Row("Moneda") = Moneda + Row("EstatusPagoElectronico") = 0 + Row("Estatus") = "True" + TempDTCuentasBancos.Rows.Add(Row) + Alert("Cuenta Bancaria agregada con éxito.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) + + End If + + Else + + + If CveCliente > 0 Then + + If ObjCuentasBancos.UpdateCuentasDepositos(GvBancosCuentas.DataKeys(CveCuentaBancaria)("CveCuentaDeposito").ToString.ToEntero, NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, "", False, Estatus, CveMoneda) Then + DTCuentasBancos.Clear() + DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente))) + Alert("Cuenta actualizada con éxito.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) + Else + Alert("Error al actualizar la cuenta bancaria. Por favor intente nuevamente.", TipoMensaje.MsgError) + End If + + Else + + Dim index = CveCuentaBancaria + Dim Row As DataRow = TempDTCuentasBancos.Rows(index) + Row("BancoNombre") = NombreBanco + Row("Sucursal") = NumeroSucursal + Row("CLABE") = CLABE + Row("SWIFT") = SWIFT + Row("Plaza") = Plaza + Row("Cuenta") = NumeroCuenta + Row("CIE") = ConvenioCIE + Row("Referencia") = Referencia + Row("CveMoneda") = CveMoneda + Row("Moneda") = Moneda + Row("Estatus") = Estatus + TempDTCuentasBancos.AcceptChanges() + Alert("Cuenta actualizada con éxito.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) + End If + + End If + ObjCuentasBancos.Dispose() + LimpiaCuentasBancarias() + CargaPSGridCuentasBancos() + RecargaGlobalCuentasBancarias() + End Sub + Private Sub LimpiaCuentasBancarias() + TxtNombreBanco.Text = "" + TxtNumeroSucursal.Text = "" + TxtCLABE.Text = "" + TxtSWIFT.Text = "" + TxtPlaza.Text = "" + TxtNumeroCuenta2.Text = "" + TxtConvenioCIE2.Text = "" + TxtReferencia2.Text = "" End Sub - Private Sub CargaEstado() - DdlEstado.Items.Clear() - If DdlPais.SelectedValue.ToEntero > 0 Then - DdlEstado.DataSource = GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString) - End If - DdlEstado.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlEstado.DataBind() +#Region "GRIDVIEW - CUENTAS BANCARIAS" + Protected Sub GvBancosCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBancosCuentas.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If CveCliente < 0 Then + For index = 1 To TempDTCuentasBancos.Rows.Count + TempDTCuentasBancos.Rows(index - 1)("CveCuentaDeposito") = index + Next + TempDTCuentasBancos.AcceptChanges() + End If + + + If e.Row.DBCampo("Estatus") = "True" Then + e.Row.FCLabel("LlbEstatusTexto").Text = "Activo" + Else + e.Row.FCLabel("LlbEstatusTexto").Text = "Inactivo" + End If + + End If + End Sub + + + Public Sub Delete_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ObjCuentasBancos As New ClsGenerales + + If CveCliente > 0 Then + If ObjCuentasBancos.RemoveCuentasDepositos(GvRow.DataKey("CveCuentaDeposito").ToEntero) Then + DTCuentasBancos.Clear() + DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente))) + + Alert("Cuenta Bancaria borrada con éxito.", TipoMensaje.MsgInformacion) + Else + Alert("No se pudo borrar la Cuenta Bancaria. Por favor intente nuevamente.", TipoMensaje.MsgError) + End If + Else + Dim index = GvRow.RowIndex + TempDTCuentasBancos.Rows.RemoveAt(index) + Alert("Cuenta Bancaria borrada con éxito.", TipoMensaje.MsgInformacion) + End If + + 'If ObjCuentasBancos.GetCuentasDepositos Then + ' GlobalDTProveedoresCuentas(CveCliente, True) = ObjCuentasBancos.DtResultados + 'End If + + CargaPSGridCuentasBancos() + ObjCuentasBancos.Dispose() + RecargaGlobalCuentasBancarias() + End Sub + Private Sub RecargaGlobalCuentasBancarias(Optional ByVal CveCuenta As Integer = -1) + If CveCliente > 0 Then + Dim ObjCuentasBancos As New ClsGenerales + + If ObjCuentasBancos.GetCuentasDepositos() Then + GlobalDTProveedoresCuentas(-1, True) = ObjCuentasBancos.DtResultados + End If + ObjCuentasBancos.Dispose() + End If End Sub - Private Sub CargaMunicipio() - DdlMunicipio.Items.Clear() - If DdlEstado.SelectedValue.ToEntero > 0 Then - DdlMunicipio.DataSource = GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString) - End If - DdlMunicipio.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlMunicipio.DataBind() +#End Region + + Private Sub CargaPSGridCuentasBancos() + If CveCliente > 0 Then + GvBancosCuentas.DataSource = DTCuentasBancos + Else + GvBancosCuentas.DataSource = TempDTCuentasBancos + End If + + GvBancosCuentas.DataBind() + UpCuentasBancos.Update() + End Sub + + + Private Sub CargaMonedas() + DdlMoneda.DataSource = GlobalDTMonedas + DdlMoneda.DataBind() + DdlMoneda.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Sub + + + + + Private Sub LnkCuentasBancarias_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancarias.Click + Modalidad = "A" + TxtNombreBanco.Text = "" + LbAgregarCuentaBanco.Text = "Agregar" + TxtNumeroSucursal.Text = "" + TxtNumeroCuenta2.Text = "" + TxtCLABE.Text = "" + TxtSWIFT.Text = "" + TxtPlaza.Text = "" + TxtConvenioCIE2.Text = "" + TxtReferencia2.Text = "" + DdlMoneda.SelectedIndex = 0 + ChkEstatus2.Checked = True + divestatus.Visible = False + UpAddBancos.Update() + RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddCuentasBancarias")) + End Sub + + Public Sub Edit_Click2(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + TxtNombreBanco.Text = GvRow.DataKey("BancoNombre") + Modalidad = "U" + LbAgregarCuentaBanco.Text = "Actualizar" + CveCuentaBancaria = GvRow.RowIndex + TxtNumeroSucursal.Text = GvRow.DataKey("Sucursal") + TxtNumeroCuenta2.Text = GvRow.DataKey("Cuenta") + TxtCLABE.Text = GvRow.DataKey("CLABE") + TxtSWIFT.Text = GvRow.DataKey("SWIFT") + TxtPlaza.Text = GvRow.DataKey("Plaza") + TxtConvenioCIE2.Text = GvRow.DataKey("CIE") + TxtReferencia2.Text = GvRow.DataKey("Referencia") + DdlMoneda.SelectedValueExist(GvRow.DataKey("CveMoneda")) + ChkEstatus2.Checked = CBool(GvRow.DataKey("Estatus")) + divestatus.Visible = True + UpAddBancos.Update() + RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddCuentasBancarias")) End Sub - - Private Sub CargaColonia() - DdlColonia.Items.Clear() - If DdlMunicipio.SelectedValue.ToEntero > 0 Then - DdlColonia.DataSource = GlobalDTColonia(GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString).FiltraParametros($"CveMunicipio = {DdlMunicipio.SelectedValue.ToEntero}")(0)("ClaveSATMunicipio").ToString) - End If - DdlColonia.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlColonia.DataBind() - End Sub - - Protected Sub DdlPais_SelectedIndexChanged(sender As Object, e As EventArgs) - 'si contiene MX, USA o CANADA carga ddls, si no carga txt - CargaEstado() - - If DdlPais.SelectedValue.Contiene("151", "66", "40") Then - DdlEstado.Visible = True - DdlMunicipio.Visible = True - DdlColonia.Visible = True - - TxtComExtEstado.Visible = False - TxtComExtMunicipio.Visible = False - TxtComExtColonia.Visible = False - - TxtComExtEstado.Text = "" - TxtComExtMunicipio.Text = "" - TxtComExtColonia.Text = "" - - If DdlPais.SelectedValue.Contiene("66", "40") Then - DdlMunicipio.Visible = False - DdlColonia.Visible = False - - DdlMunicipio.SelectedValue = "-1" - DdlColonia.SelectedValue = "-1" - - TxtComExtMunicipio.Visible = True - TxtComExtColonia.Visible = True - End If - - Else - 'Limpia los DDLs - CargaMunicipio() - CargaColonia() - - DdlEstado.Visible = False - DdlMunicipio.Visible = False - DdlColonia.Visible = False - - TxtComExtEstado.Visible = True - TxtComExtMunicipio.Visible = True - TxtComExtColonia.Visible = True - End If - End Sub - Protected Sub DdlEstado_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaMunicipio() - CargaColonia() - End Sub - Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaColonia() - End Sub - -#End Region - -#Region "D O C U M E N T A C I O N " - - Private Sub CargaDocumentacionCliente() - Dim objRH As New ClsEdocumentacion() - - If objRH.DocumentacionElectronicaGet(-1, If(CveCliente = -1, 0, CveCliente), -1, UsuarioActual.Empresa.CveEmpresa, -1, Modulo:=2) Then - DTDocumentacion = objRH.DtResultados - GvDocumentosCliente.DataSource = objRH.DtResultados - End If - objRH.Dispose() - 'If DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ").Rows.Count > 0 Then - ' GvDocumentosCliente.DataSource = DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ") - 'Else - ' GvDocumentosCliente.DataSource = Nothing - 'End If - GvDocumentosCliente.DataBind() - - UPGvDocumentosCliente.Update() - 'UpGvDocumentosFirma2.Update() - End Sub - Public Sub UploadModal_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - Dim chkEstatus As CheckBox - CveDocumentacionElectronica = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero - CveDocumentacion = GvRow.DataKey("CveDocumentacion").ToString.ToEntero - Documentacion = GvRow.DataKey("Documentacion") - AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString - - chkEstatus = GvRow.FCCheckBox("chkEstatus") - - - - ObservacionDocumentacion = GvRow.FCTextBox("TxtObservaciones").Text.Trim.ToUpper - FechaLimite = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - - AdjuntoDocumentacion = GvRow.DataKey("Adjunto") - - LtlTitulofirmaContrato.Text = "Subir " & Documentacion - - UpTituloFirma.Update() - - RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal({ backdrop: 'static', keyboard: false});") - End Sub - Private Sub GuardarDocumentosClientes(Optional _CveDocumentacionExcluir As Integer = -1) - - Dim hasError As Boolean = True - Dim objDocumentos As New ClsEdocumentacion - - For Each dRow As GridViewRow In GvDocumentosCliente.Rows - - Dim _CveDocumentacion As Integer = dRow.DataKey("CveDocumentacion").ToString.ToEntero - Dim _Adjunto As String = dRow.DataKey("Adjunto") - 'Dim _Documentacion As String = dRow.DataKey("Documentacion") - Dim _CveDocumentacionElectronica As Integer = dRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero - Dim _txtObservaciones As TextBox = dRow.FCTextBox("TxtObservaciones") - Dim _TxtFechaLimite As TextBox = dRow.FCTextBox("TxtFechaLimite") - Dim _TxtFechaVigencia As TextBox = dRow.FCTextBox("TxtFechaVigencia") - Dim chkEstatus As CheckBox = dRow.FCCheckBox("chkEstatus") - Dim _estatus As Integer - - _estatus = If(dRow.FCCheckBox("chkEstatus").Checked, 1, 0) - - Dim _FechaVigencia As Date - Dim _FechaLimite As Date - - Dim DiasLimite As Integer = dRow.DataKey("DiasLimite").ToString.ToEntero - Dim AplicaDiasLimite As Boolean = If(dRow.DataKey("AplicaDiasLimite").ToString = "1", True, False) - Dim AplicaFechaVencimiento As Boolean = If(dRow.DataKey("AplicaFechaVencimiento").ToString = "1", True, False) - - If _TxtFechaVigencia.Text.Length = 10 Then - _FechaVigencia = _TxtFechaVigencia.Text.ToDate - Else - _FechaVigencia = Nothing - End If - - If Not AplicaDiasLimite Then - _FechaLimite = MinFecha - Else - _FechaLimite = _TxtFechaLimite.Text.ToDate - End If - - If Not AplicaFechaVencimiento Then - _FechaVigencia = MinFecha - End If - - - If Not _CveDocumentacionExcluir = _CveDocumentacion Then - Try - If _CveDocumentacionElectronica = -1 Then - - If objDocumentos.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) > 0 Then - Else - hasError = True - Exit For - End If - - Else - If objDocumentos.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) Then - Else - hasError = True - Exit For - End If - End If - - - hasError = False - Catch ex As Exception - hasError = True - Exit For - End Try - End If - Next - - 'refrescar grid datos investigacion - CargaDocumentacionCliente() - End Sub - - Protected Sub chkEstatus_CheckedChanged(sender As Object, e As EventArgs) - GuardarDocumentosClientes() - End Sub - - Protected Sub TxtObservaciones_TextChanged(sender As Object, e As EventArgs) - GuardarDocumentosClientes() - End Sub - Protected Sub BtnModalFirmaContratoDocumentoUpload_Click(sender As Object, e As EventArgs) Handles BtnModalFirmaContratoDocumentoUpload.Click - - Dim FileExtension As String = "-1" - Dim Filesgral As List(Of Archivo) = TxtFileFirmaContrato.getfiles().Archivos - Dim Filename As String = "" - - - For Each fileItem As Archivo In Filesgral - Try - - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - Dim tempArray() As String - tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) - - Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "\" & Documentacion & "." & FileExtension - Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\" & AdjuntoDocumentacion - - If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\") Then - System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\") - End If - - If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then - File.Delete(rutaAdjuntoAnterior) - End If - - If System.IO.File.Exists(rutaDestino) Then - System.IO.File.Delete(rutaDestino) - End If - - System.IO.File.Move(fileItem.FileUrl, rutaDestino) - - Dim objRH As New ClsEdocumentacion - - - If CveDocumentacionElectronica = -1 Then - If objRH.DocumentacionElectronicaAdd(CveDocumentacion, -1, CveCliente, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) > 0 Then - - End If - Else - If objRH.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, CveCliente, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) Then - - End If - End If - - objRH.Dispose() - - GuardarDocumentosClientes(CveDocumentacion) - CargaDocumentacionCliente() - - - TxtFileFirmaContrato.Text = "" - UpModalFirmaContratoDocumento.Update() - - Catch ex As Exception - OnError("Error al cargar archivo", ex) - End Try - - Next - RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal('hide')", "hidemodal7") - - End Sub - - Public Sub Update_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim activo As Boolean = False - - Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero - Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero - Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString - Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - - Dim obserbaciones As String = DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text - 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) - Dim chkCompleto As CheckBox = DirectCast(GvRow.FindControl("chkEstatus"), CheckBox) - - If chkCompleto.Checked Then - Estatus = 1 - Else - Estatus = 0 - End If - - Dim ObjEdoc As New ClsEdocumentacion - - If Not _CveDocumentacionElectronica = -1 Then - If ObjEdoc.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) Then - Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) - End If - Else - If ObjEdoc.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) > 0 Then - Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) - End If - End If - - CargaDocumentacionCliente() - ObjEdoc.Dispose() - - End Sub - - - Public Sub Update_ClickDocumentacionRemove(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim activo As Boolean = False - - Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero - Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero - Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString - Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - Dim obserbaciones As String = DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text - 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) - Dim chkCompleto As CheckBox = DirectCast(GvRow.FindControl("chkEstatus"), CheckBox) - - Dim UrlArchivo = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "/" & _Adjunto - - If File.Exists(UrlArchivo) Then - Try - File.Delete(UrlArchivo) - Catch ex As Exception - End Try - - End If - - Dim ObjEdoc As New ClsEdocumentacion - - If Not _CveDocumentacionElectronica = -1 Then - - If ObjEdoc.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, 0, "", "", UsuarioActual.CveUsuario, _fechaLimite) Then - Alert("Documento Eliminado Correctamente.", TipoMensaje.MsgInformacion) - End If - - End If - - CargaDocumentacionCliente() - ObjEdoc.Dispose() - - End Sub - Public Sub DownLoad_ClickDocumentacion(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim Adjunto As String = GvRow.DataKey("Adjunto") - linkDescargaPagare = AppDomain.CurrentDomain.BaseDirectory & String.Format("Empresas\{0}\DocElectronica\Clientes\{1}\{2}", UsuarioActual.CveEmpresa, CveCliente, Adjunto) - TxtDireccionAval.Text = "" - TxtAval.Text = "" - RegistraScript("$('#ModalDivPagare').modal('show')") - - End Sub - - Protected Sub ImprimirPagare(sender As Object, e As EventArgs) Handles BtnAgregarPagare.Click - Dim memoryStreamDoc As New System.IO.MemoryStream - Dim objGemBoxDocument As New clsGemBoxDocument(linkDescargaPagare) - Dim Tags As New List(Of TagsDocumentos) - Dim ObjClientes As New ClsClientes - - Dim monto As String = "" - Dim razonSocial As String = "" - Dim direccion As String = "" - Dim ciudad As String = "" - Dim Telefono As String = "" - Dim mesArray = New String() {"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"} - Dim hoy As DateTime = DateTime.Now - Dim fechaConFormato As String = String.Format("{0} de {1} del {2}", hoy.Day, mesArray(hoy.Month), hoy.Year) - - If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then - monto = ObjClientes.DtResultados.FiltroPrimeroValor("LimiteCredito").ToDouble.ToString("N") - razonSocial = ObjClientes.DtResultados.FiltroPrimeroValor("NombreComercial") - direccion = ObjClientes.DtResultados.FiltroPrimeroValor("Direccion") - ciudad = ObjClientes.DtResultados.FiltroPrimeroValor("Ciudad") - Telefono = ObjClientes.DtResultados.FiltroPrimeroValor("Telefono") - End If - - Tags.Add(New TagsDocumentos("{Monto}", monto)) - Tags.Add(New TagsDocumentos("{Fecha}", fechaConFormato)) - Tags.Add(New TagsDocumentos("{FechaConFormato}", fechaConFormato)) - Tags.Add(New TagsDocumentos("{CantidadLetra}", monto.ToDouble.Texto2Letras(1))) - Tags.Add(New TagsDocumentos("{RazonSocial}", razonSocial)) - Tags.Add(New TagsDocumentos("{Direccion}", direccion)) - Tags.Add(New TagsDocumentos("{Ciudad}", ciudad)) - Tags.Add(New TagsDocumentos("{Telefono}", Telefono)) - Tags.Add(New TagsDocumentos("{RazonSocialAval}", TxtAval.Text)) - Tags.Add(New TagsDocumentos("{DireccionAval}", TxtDireccionAval.Text)) - Tags.Add(New TagsDocumentos("{CiudadAval}", UsuarioActual.Empresa.Ciudad)) - Tags.Add(New TagsDocumentos("{TelefonoAval}", UsuarioActual.Empresa.Telefono)) - - If Not ObjClientes.AddClientePagare(CveCliente, UsuarioActual.CveEmpresa, TxtAval.Text, TxtDireccionAval.Text) Then - Alert("no se pudo registrar el pagare") - Exit Sub - End If - - 'objGemBoxDocument.AgregarImagen(RutaLogo, 61.0, 53.0) - RegistraScript("$('#ModalDivPagare').modal('hide')") - Alert("Pagaré registrado con exito") - - objGemBoxDocument.SustituirTags(Tags) - objGemBoxDocument.GuardarStream() - Dim memoryStream As New System.IO.MemoryStream(objGemBoxDocument.GetBytesDocumento()) - objGemBoxDocument.Dispose() - ObjClientes.Dispose() - Response.Clear() - Response.ContentType = "application/text" - Response.AddHeader("content-disposition", "attachment;filename=pagare.docx") - Response.Buffer = True - memoryStream.WriteTo(Response.OutputStream) - Response.End() - - End Sub - - Protected Sub GvDocumentosFirma_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentosCliente.RowDataBound - - - If e.Row.RowType = DataControlRowType.DataRow Then - - Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString - Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato") - 'Dim ImgDownLoad As Literal = e.Row.FCLiteral("ImgDownLoad") - Dim LnkDownLoadDoc As LinkButton = e.Row.FCLinkButton("LnkDownLoadDoc") - Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired") - Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite") - Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False) - Dim chkEstatus As CheckBox = e.Row.FCCheckBox("chkEstatus") - Dim documentacionFormato As String = e.Row.DBCampo("DocumentacionFormato").ToString - Dim Documentacion As String = e.Row.DBCampo("Documentacion").ToString - Dim _CveDocumentacion As Integer = e.Row.DBCampo("CveDocumentacion").ToString.ToEntero - Dim separado As Char() = ".".ToString.ToCharArray - Dim array() As String = Adjunto.Split(separado) - Dim extencion As String = "" - Dim existeAdjunto As Boolean = False - Dim TxtFechaVigencia As TextBox = e.Row.FCTextBox("TxtFechaVigencia") - - Dim imgCalendario As LinkButton = e.Row.FCLinkButton("imgCalendario") - - - - - - - ' FechaVigencia - - Dim DiasLimite As Integer = e.Row.DataKey("DiasLimite").ToString.ToEntero - Dim AplicaDiasLimite As Boolean = If(e.Row.DataKey("AplicaDiasLimite").ToString = "1", True, False) - Dim AplicaFechaVencimiento As Boolean = If(e.Row.DataKey("AplicaFechaVencimiento").ToString = "1", True, False) - - txtFechaLimite.Visible = If(AplicaDiasLimite, True, False) - TxtFechaVigencia.Visible = If(AplicaFechaVencimiento, True, False) - imgCalendario.Visible = If(AplicaFechaVencimiento, True, False) - - - 'Dim scripMascara = " $('#" & TxtFechaVigencia.ClientID & "').mask('00/00/0000');" - ' RegistraScript(scripMascara) - - If TxtFechaVigencia.Text.Length = 10 Then - TxtFechaVigencia.Text = TxtFechaVigencia.Text.ToDate.ToString("dd/MM/yyyy") - End If - - If array.Length > 0 Then - extencion = array(array.Length - 1) - End If - - If e.Row.DBCampo("Estatus").ToString.ToEntero = 1 Then - chkEstatus.Checked = True - Else - chkEstatus.Checked = False - End If - - If documentacionFormato = "" Then - 'ImgDownLoadFormato.Visible = False - LnkDownLoadDoc.Visible = False - Else - Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/Formatos/" & CveDocumentacion & "" & documentacionFormato - LnkDownLoadDoc.Visible = True - End If - - txtFechaLimite.Text = e.Row.DBCampo("FechaLimite").ToString.ToDate.ToString("dd/MM/yyyy") - - If Adjunto.Trim.Length > 0 Then - - Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "\DocElectronica\Clientes\" & CveCliente & "/" & Adjunto - Dim linkDescargaArchivo = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "/" & Adjunto - - If File.Exists(linkDescargaArchivo) Then - - LnkDownLoadDoc.Visible = True - ScriptManager.GetCurrent(Me).RegisterPostBackControl(LnkDownLoadDoc) - 'If extencion.Length > 0 Then - ' ImgDownLoad.Text = String.Format(" ", linkDescarga, CveCliente & Documentacion & "." & extencion) - 'Else - ' ImgDownLoad.Text = String.Format(" ", linkDescarga, CveCliente & Documentacion) - 'End If - Else - LnkDownLoadDoc.Visible = False - End If - Else - LnkDownLoadDoc.Visible = False - End If - - If requerido Then - ImgRequired.Text = " " - Else - ' ImgRequired.Text = " " - End If - - If UsuarioActual.TienePermisoProceso(248) And e.Row.DBCampo("Estatus").ToString.ToEntero = 1 And LnkDownLoadDoc.Visible Then - e.Row.FCLinkButton("LnkGvDocumentosEliminar").Visible = True - End If - - End If - - End Sub - Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - Dim CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero - Dim DocumentacionFormato As String = CveDocumentacion & "_" & GvRow.DataKey("DocumentacionFormato") - - DescarFormato(DocumentacionFormato) - - End Sub - Public Sub DescarFormato(documento As String) - - Dim PathRoot As String = Server.MapPath("/") - Dim PathSource As String - Dim pathDesti As String - - PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & documento - pathDesti = PathRoot & "Temp\" & CveCliente & documento - - If File.Exists(pathDesti) Then - File.Delete(pathDesti) - End If - - File.Copy(PathSource, pathDesti) - - Dim objDoc As New clsGemBoxDocument(pathDesti) - Dim objRH As New ClsRH - Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString & " del " & Now.Year.ToString() - - - objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(-1, UsuarioActual.CveEmpresa)) ' Pendiente - objRH.Dispose() - - - - objDoc.Guardar(pathDesti) - - Dim fileinfo As New FileInfo(pathDesti) - - Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) - baseUrl = baseUrl & "/temp/" & fileinfo.Name - - RegistraDescargaJavaScript(baseUrl) - - End Sub - - - - 'Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) - ' Dim ListaTagsDocumentost = New List(Of TagsDocumentos) - - ' If CvePersonal <> -1 Then - ' Dim objRH As New ClsRH - - - - ' If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{RFC}", objRH.DtResultados(0)("RFC").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", Cliente)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString)) - - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString.ToDecimal.ToString("###,###,###.00"))) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString)) - - - ' 'If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then - - ' ' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text)) - ' 'End If - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString)) - - - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaIngreso}", objRH.DtResultados(0)("FechaIngreso").ToString.ToDate.ToShortDateString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString.ToDate.ToShortDateString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CUIP}", "")) - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Denominacion}", "")) - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaNacimiento}", objRH.DtResultados(0)("FechaNacimiento").ToString.ToDate.ToString("dd/MM/yyyy"))) - - - ' Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year - - ' Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy") - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual)) - ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF)) - ' End If - - - ' objRH.Dispose() - ' End If - - ' Return ListaTagsDocumentost - 'End Function - - - - - - - - ''Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) - '' Dim ListaTagsDocumentost = New List(Of TagsDocumentos) - - '' If CvePersonal <> -1 Then - '' Dim objRH As New ClsRH - - - - '' If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then - - '' If Not IsDBNull(objRH.DtResultados(0)("Nombres")) Then - '' ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString)) - '' End If - - '' If Not objRH.DtResultados(0)("APaterno") Is Nothing Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString)) - '' End If - - '' If Not objRH.DtResultados(0)("AMaterno") Is Nothing Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString)) - '' End If - - '' If Not objRH.DtResultados(0)("NombreCompleto") Is Nothing Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", objRH.DtResultados(0)("NombreCompleto").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("Estatura")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("Peso")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("LugarNacimiento")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("Edad")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("NombreTelEmergencia")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("TipoSangre")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("Vivienda")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("ViviendaDueno")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CreditoInfonavit")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("RentaMensual")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString.ToDecimal.ToString("###,###,###.00"))) - - '' If Not IsDBNull(objRH.DtResultados(0)("TransportePublico")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormente")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("ParientesEmpresa")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelito")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelitoObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Direccion")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Calle")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Colonia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Telefono")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Celular")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Correo")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then - - '' ' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("NumeroSS")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Licencia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CartillaMilitar")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CURP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("AutorizaAntidoping")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Observaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CredencialElector")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CredencialElector}", objRH.DtResultados(0)("CredencialElector").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Sucursal")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Sucursal}", objRH.DtResultados(0)("Sucursal").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Puesto")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString)) - - '' 'If Not IsDBNull(objRH.DtResultados(0)("InformacionFidedigno")) Then chkFidedigna4.Checked = objRH.DtResultados(0)("InformacionFidedigno") - '' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("InformacionFidedigno").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("FechaNacimiento")) Then - '' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("FechaNacimiento").ToString.ToDate.ToString("dd/MM/yyyy"))) - '' End If - - - '' Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year - '' Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy") - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual)) - '' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF)) - - - '' objRH.Dispose() - '' End If - - '' Return ListaTagsDocumentost - ''End Function - Private Sub RegistraDescargaJavaScript(baseUrl As String) - - RegistraScript("Download('" & baseUrl & "')") - - End Sub - -#End Region - -#Region "D O C U M E N T O S V E N T A S" - - Private Sub CargaDocumentosVenta(tCveCliente As Integer) - Dim objInv As New ClsEdocumentacion - - If objInv.DocumentacionElectronicaGet(-1, tCveCliente, -1, UsuarioActual.CveEmpresa, 14) Then - GvDocsVentas.DataSource = objInv.DtResultados - If objInv.DtResultados.Rows.Count > 0 Then BtnGuardarDocumentacion.Visible = True - Else - GvDocsVentas.DataSource = Nothing - End If - - objInv.Dispose() - GvDocsVentas.DataBind() - UpDocumentacion.Update() - - End Sub - - Private Sub BtnGuardarDocumentación_Click(sender As Object, e As EventArgs) Handles BtnGuardarDocumentacion.Click - Dim objDoc As New ClsEdocumentacion() - objDoc.IniciaTransacSQL() - Dim HuboError As Boolean = False - - If CveCliente <= 0 Then - For Each gvr As GridViewRow In GvDocsVentas.Rows - If gvr.FCCheckBox("ChkDoc").Checked Then - - If objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text) <= 0 Then HuboError = True - - End If - - Next - - Else - For Each gvr As GridViewRow In GvDocsVentas.Rows - 'sino está registrada y se selecciona, se va a insertar - If gvr.DataKey("CveDocumentacionElectronica").ToEntero <= 0 AndAlso gvr.FCCheckBox("ChkDoc").Checked Then - If objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text) <= 0 Then HuboError = True - Else - ', Observacion2:=gvr.FCTextBox("TxtObs2").Text - If Not objDoc.DocumentacionElectronicaUpdate(gvr.DataKey("CveDocumentacionElectronica").ToEntero, gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, gvr.DataKey("FechaLimite").ToDate, Observacion2:=gvr.FCTextBox("TxtObs2").Text) Then HuboError = True - End If - - 'si ya estaba registrada y no se selecciona, se va a insertar - If gvr.DataKey("CveDocumentacionElectronica").ToEntero > 0 AndAlso Not gvr.FCCheckBox("ChkDoc").Checked Then - If Not objDoc.DocumentacionElectronicaRemove(gvr.DataKey("CveDocumentacionElectronica").ToEntero, -1) Then HuboError = True - End If - - Next - - End If - - - If Not HuboError Then - Alert("Documentación guardada", TipoMensaje.MsgInformacion) - objDoc.Commit() - Else - objDoc.RollBack() - End If - objDoc.Dispose() - - End Sub - - Public Sub Upload_ClickDocumentacion(sender As Object, e As EventArgs) - RegistraScript("$('#ModalCXCDocumento').modal({ backdrop: 'static', keyboard: false});") - End Sub - - Protected Sub BtnModalCXCDocumentoClienteUpload_Click(sender As Object, e As EventArgs) Handles BtnModalCXCDocumentoClienteUpload.Click - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacion").ToEntero - Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToEntero - Dim _Obserbaciones As String = GvRow.FCTextBox("TxtObservaciones").Text.Trim - Dim _FechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - - SubirComprobante(_CveDocumentacionElectronica, _CveDocumentacion, _Obserbaciones, _FechaLimite) - 'CargaDocs() - - End Sub - - Private Function SubirComprobante(_CveDocumentacionElecronica As Integer, _CveDocumentacion As Integer, _Obserbaciones As String, _FechaLimite As Date) As Boolean - - Dim Respuesta As Boolean = False - Dim RutaDirectorio As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, "Clientes\") - - Dim filesgral As List(Of Archivo) = TxtCXCDocumentoCliente.getfiles().Archivos - Dim filemove As String = "" - Dim Comprobante As String = "" - Dim ShortFileName As String = "" - - - If filesgral.Count > 0 Then - - Dim RutaArchivo As String - - For Each fileItem As Archivo In filesgral - - Dim edoc As New ClsEdocumentacion - - Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - filemove = fileItem.FileUrl - RutaArchivo = String.Format("{0}{1}_{2}", RutaDirectorio, CveCliente, _CveDocumentacion) - RutaArchivo = String.Format("{0}.{1}", RutaArchivo, fileItem.Extencion) - - Try - If Not Directory.Exists(RutaDirectorio) Then - Directory.CreateDirectory(RutaDirectorio) - End If - - If File.Exists(RutaArchivo) Then - File.Delete(RutaArchivo) - End If - - File.Move(filemove, RutaArchivo) - Respuesta = True - ShortFileName = System.IO.Path.GetFileName(RutaArchivo) - - If edoc.DocumentacionElectronicaUpdate(_CveDocumentacionElecronica, _CveDocumentacion, -1, CveCliente, -1, 1, _Obserbaciones, ShortFileName, UsuarioActual.CveEmpresa, _FechaLimite) Then - - - End If - - Catch ex As Exception - - OnError("Error al intentar guardar archivo ", ex) - Respuesta = False - RutaArchivo = "-1" - End Try - Anexo.Text = "" - - edoc.Dispose() - Next - Else - Respuesta = True - End If - - - - UpModalCXCClienteDocumento.Update() - Return Respuesta - +#End Region + +#Region "C L I E N T E S P A G O S R E A L I Z A D O S I M P R I M I R P D F/Excel" + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click + GenerarPDF("Excel") + End Sub + Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosPDF.Click + GenerarPDF() + End Sub + Private Sub GenerarPDF(Optional Formato As String = "PDF") + Dim params As New List(Of ReportParameter) + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = 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("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + ImprimirPDF("Empresas\Grales\Formatos\RepClientesPagosBancos.rdlc", DTCobrosRealizados, params, "RepClientesPagosBancos_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato) + + + End Sub +#End Region + +#Region "VENTAS" + + Public Function imprimirFacturaVenta(CveVenta As Integer) As Byte() + Dim ObjVentas As New ClsVentas + Dim Vta As Modelos.Factura = Nothing + + Dim TmpDTImpuestos = New DataTable + TmpDTImpuestos.Columns.Add("ImpuestoLocal", GetType(String)) + TmpDTImpuestos.Columns.Add("Importe", GetType(Double)) + TmpDTImpuestos.Columns.Add("Orden", GetType(Integer)) + + Dim TmpDTImpuestosIVAIEPS = New DataTable + TmpDTImpuestosIVAIEPS.Columns.Add("Impuesto", GetType(String)) + TmpDTImpuestosIVAIEPS.Columns.Add("tasa", GetType(String)) + TmpDTImpuestosIVAIEPS.Columns.Add("Importe", GetType(Double)) + TmpDTImpuestosIVAIEPS.Columns.Add("Orden", GetType(Integer)) + + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + Dim dtVentas As DataTable = ObjVentas.DtResultados + + ' se rellenan los campos de la factura + Vta = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.Factura) + + Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString + 'se rellena la sucursal + 'Vta.Subproyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SucursalModel) + Vta.SubProyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SubProyectoModel) + Vta.Cliente = New Modelos.ClienteModel + Vta.Cliente.Nombre = dtVentas(0)("ClienteNombre").ToString + Vta.Cliente.Telefono = dtVentas(0)("Telefono").ToString + Vta.Cliente.Direccion = dtVentas(0)("ClienteDireccion").ToString + Vta.Cliente.CP = dtVentas(0)("CPCliente").ToString + Vta.Cliente.Ciudad = dtVentas(0)("ClienteCiudad").ToString + Vta.Cliente.Localidad = dtVentas(0)("ClienteLocalidad").ToString + Vta.Cliente.Estado = dtVentas(0)("ClienteEstado").ToString + Vta.Cliente.Pais = dtVentas(0)("ClientePais").ToString + Vta.Cliente.RFC = dtVentas(0)("ClienteRFC").ToString + Vta.Cliente.Colonia = dtVentas(0)("ColoniaCliente").ToString + Vta.AtencionA = dtVentas(0)("AtencionA").ToString + Vta.Cliente.NoExt = dtVentas(0)("ClienteNoExt").ToString + Vta.Cliente.NoInt = dtVentas(0)("ClienteNoInt").ToString + Vta.Cliente.Codigo = dtVentas(0)("ClienteCodigo").ToString + Vta.Cliente.Mail = dtVentas(0)("Mail").ToString + Vta.RefDocto = dtVentas(0)("Ref").ToString + Vta.CveVenta = dtVentas(0)("CveVenta").ToString.ToEntero + Vta.Version = dtVentas(0)("Version").ToString + + Vta.NumeroContrato = dtVentas(0)("NumeroContrato").ToString + Vta.DescripcionContrato = dtVentas(0)("DescripcionContrato").ToString + Vta.NumeroDescripcionContrato = If($"{dtVentas(0)("NumeroContrato").ToString} - {dtVentas(0)("NumeroLicitacion").ToString}" = " - ", "", $"{dtVentas(0)("NumeroContrato").ToString} {If(dtVentas(0)("NumeroLicitacion").ToString = "", "", $" - Licitación: {dtVentas(0)("NumeroLicitacion").ToString}")}") + + Vta.PedidoContrato = If(dtVentas(0)("PedidoContrato").ToString = "", Vta.NumeroDescripcionContrato, $"{dtVentas(0)("PedidoContrato").ToString} {If(Vta.NumeroDescripcionContrato = "", "", $" / {Vta.NumeroDescripcionContrato}") }") + 'Vta.PedidoContrato = dtVentas(0)("PedidoContrato").ToString + + Vta.ClienteSucursal = New Modelos.SucursalModel + Vta.ClienteSucursal.Direccion = dtVentas(0)("SucClienteDireccion").ToString + Vta.ClienteSucursal.NoExt = dtVentas(0)("SucClienteNoExt").ToString + Vta.ClienteSucursal.NoInt = dtVentas(0)("SucClienteNoInt").ToString + Vta.ClienteSucursal.Colonia = dtVentas(0)("SucClienteColonia").ToString + Vta.ClienteSucursal.CP = dtVentas(0)("SucClienteCP").ToString + Vta.ClienteSucursal.Municipio = dtVentas(0)("SucClienteCiudad").ToString + Vta.ClienteSucursal.Estado = dtVentas(0)("SucClienteEstado").ToString + Vta.ClienteSucursal.Pais = dtVentas(0)("SucClientePais").ToString + Vta.ClienteSucursal.Localidad = dtVentas(0)("SucClienteLocalidad").ToString + Vta.ClienteSucursal.CorreoSucursal = dtVentas(0)("SucClienteCorreo").ToString + Vta.ClienteSucursal.TelefonoSucursal = dtVentas(0)("SucClienteTelefono").ToString + Vta.ClienteSucursal.Sucursal = dtVentas(0)("SucursalCliente").ToString + Vta.ClienteSucursal.ImprimeNombreSucursal = dtVentas(0)("ImprimeNombreSucursal").ToString + + Vta.EnviarA = New Modelos.EnviarAModel + Vta.EnviarA.CveDireccionEnvio = dtVentas(0)("CveDireccionEnvio").ToString.ToEntero + Vta.EnviarA.EnvioDireccion = dtVentas(0)("EnvioDireccion").ToString + Vta.EnviarA.EnvioColonia = dtVentas(0)("EnvioColonia").ToString + Vta.EnviarA.EnvioCiudad = dtVentas(0)("EnvioCiudad").ToString + Vta.EnviarA.EnvioEstado = dtVentas(0)("EnvioEstado").ToString + Vta.EnviarA.EnvioCP = dtVentas(0)("EnvioCP").ToString + + Vta.EnviarA.EnvioNoExt = dtVentas(0)("EnvioNoExt").ToString + Vta.EnviarA.EnvioNoInt = dtVentas(0)("EnvioNoInt").ToString + Vta.EnviarA.EnvioContacto = dtVentas(0)("EnvioContacto").ToString + 'Vta.EnviarA.EnvioPedidoContrato = dtVentas(0)("EnvioPedidoContrato").ToString + + 'INE COMPLEMENTO + If dtVentas(0)("TipoComite").ToString <> "" Then + Dim INE As New Modelos.ComplementoINE + INE.INETipoComite = dtVentas(0)("TipoComite").ToString + INE.INETipoProceso = dtVentas(0)("TipoProceso").ToString + INE.INEIdContabilidad = dtVentas(0)("IdContabilidad").ToString.ToEntero + Vta.ComplementoINE = INE + End If + + + Dim DR As DataRow = TmpDTImpuestos.NewRow() + If dtVentas(0)("SubTotal").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Subtotal" : DR("Importe") = dtVentas(0)("SubTotal").ToString.ToDouble : DR("Orden") = 10 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("Descuento").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = dtVentas(0)("Descuento").ToString.ToDouble : DR("Orden") = 20 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("Amortizacion").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = dtVentas(0)("Amortizacion").ToString.ToDouble : DR("Orden") = 30 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("SubTotal").ToString.ToDouble <> (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) Then DR("ImpuestoLocal") = "SubTotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) : DR("Orden") = 40 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("IVA").ToString.ToDouble >= 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 50 : TmpDTImpuestos.Rows.Add(DR) + + 'solo para eclipse, que muesre un subtotal debajo de IVA + If UsuarioActual.CveEmpresa = 15 Then DR = TmpDTImpuestos.NewRow() : DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) + dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 51 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("RetIVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = dtVentas(0)("RetIVA").ToString.ToDouble : DR("Orden") = 60 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("RetISR").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = dtVentas(0)("RetISR").ToString.ToDouble : DR("Orden") = 70 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + + If dtVentas(0)("IEPS").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "IEPS" : DR("Importe") = dtVentas(0)("IEPS").ToString.ToDouble : DR("Orden") = 80 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + + If dtVentas(0)("Total").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = dtVentas(0)("Total").ToString.ToDouble : DR("Orden") = 100 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + + If ObjVentas.GetVentaDetalle(CveVenta) Then 'Obtenemos el Detalle de la Oorden de Compra + Vta.DtDetalle = ObjVentas.DtResultados + End If + + If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then + + Dim dtImpuesto As DataTable = ObjVentas.DtResultados + If dtImpuesto.Rows.Count > 0 Then + For Each Row As DataRow In dtImpuesto.Rows + Dim Orden = 80 + If Row("Importe").ToString.ToDouble <> 0 Then + DR("ImpuestoLocal") = Row("ImpuestoLocal").ToString + DR("Importe") = Row("Importe").ToString.ToDouble + DR("Orden") = Orden + TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + Orden = Orden + 1 + End If + Next + End If + Vta.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC") + + End If + + 'TmpDT DESGLOSE DE IMPUESTOS 3.3 + For Each dr1 As DataRow In Vta.DtDetalle.Rows + Dim DrIVA As DataRow = Nothing + Dim DrIEPS As DataRow = Nothing + + Try + DrIVA = TmpDTImpuestosIVAIEPS.Select("Impuesto = 'IVA'")(0) + Catch ex As Exception + DrIVA = Nothing + End Try + + If DrIVA IsNot Nothing Then + DrIVA("Importe") = DrIVA("Importe").ToString.ToDouble + dr1("ImporteIVA").ToString.ToDouble + TmpDTImpuestosIVAIEPS.AcceptChanges() + Else + Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() + If dr1("PorcentajeIVA").ToString.ToDouble >= 0 Then + DR2("Impuesto") = "IVA" : DR2("tasa") = "16 %" : DR2("Importe") = dr1("ImporteIVA").ToString.ToDouble : DR2("Orden") = "1" + TmpDTImpuestosIVAIEPS.Rows.Add(DR2) + TmpDTImpuestosIVAIEPS.AcceptChanges() + End If + End If + + Try + DrIEPS = TmpDTImpuestosIVAIEPS.Select($"Impuesto = 'IEPS' AND tasa = '{dr1("PorcentajeIEPS").ToString.ToDouble * 100} %'")(0) + Catch ex As Exception + DrIEPS = Nothing + End Try + + If DrIEPS IsNot Nothing Then + DrIEPS("Importe") = DrIEPS("Importe").ToString.ToDouble + dr1("ImporteIEPS").ToString.ToDouble + TmpDTImpuestosIVAIEPS.AcceptChanges() + Else + Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() + If dr1("PorcentajeIEPS").ToString.ToDouble > 0 Then + DR2("Impuesto") = "IEPS" : DR2("tasa") = String.Format("{0} {1}", dr1("PorcentajeIEPS").ToString.ToDouble * 100, "%") : DR2("Importe") = dr1("ImporteIEPS").ToString.ToDouble : DR2("Orden") = If(dr1("PorcentajeIEPS").ToString = "0.03", "2", If(dr1("PorcentajeIEPS").ToString = "0.06", "3", If(dr1("PorcentajeIEPS").ToString = "0.07", "4", If(dr1("PorcentajeIEPS").ToString = "0.09", "5", "")))) + TmpDTImpuestosIVAIEPS.Rows.Add(DR2) + TmpDTImpuestosIVAIEPS.AcceptChanges() + End If + End If + + Next + Vta.DtDesgloseImpuestos = TmpDTImpuestosIVAIEPS.FiltraParametros("", Orderby:="Orden ASC") + + If ObjVentas.GetVentasFirmas(CveVenta) Then + Vta.DtFirmas = ObjVentas.DtResultados + End If + + If UsuarioActual.CveEmpresa.Contiene(119) Then + If dtVentas(0)("TipoDocto").ToString.Contiene("Ing", "Ant", "Rem") Then + 'carga as notas de credito vinculadas + If ObjVentas.GetVentasAntNC(CveVenta, -1) Then + Vta.DtDocumentosRelacionados = ObjVentas.DtResultados + + End If + End If + + If dtVentas(0)("TipoDocto").ToString.Contiene("Egs", "Dev", "Ant") Then + If ObjVentas.GetVentasAntNC(-1, CveVenta) Then + Vta.DtDocumentosRelacionados = ObjVentas.DtResultados + End If + End If + End If + + + 'CFDI RELACIONADO + If dtVentas(0)("CveTipoRelacion").ToString.ToEntero > 0 Then + Vta.Timbre.Comprobante.TipoComprobante = If(Vta.TipoDocto.Contiene("Ing", "Ant"), "I", If(Vta.TipoDocto.Contiene("Egs", "Dev"), "E", "")) + If Vta.Timbre.Comprobante.TipoComprobante = "E" Then + If Vta.TipoDocto.Contiene("Egs") Then + Vta.Timbre.CFDIRelacionados.TipoRelacion = "01" + Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" + End If + If Vta.TipoDocto.Contiene("Dev") Then + Vta.Timbre.CFDIRelacionados.TipoRelacion = "03" + Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" + End If + Vta.Timbre.CFDIRelacionados.UUID.Add(dtVentas(0)("FolioFiscalPadre").ToString) + End If + ' cuando es refacturacoin es cfdirelacionado, con relacion 04 + If Vta.Timbre.Comprobante.TipoComprobante = "I" AndAlso (dtVentas(0)("Total").ToString.ToDouble = dtVentas(0)("TotalPadre").ToString.ToDouble) Then + Vta.Timbre.CFDIRelacionados.TipoRelacion = "04" + Vta.Timbre.CFDIRelacionados.UUID.Add(dtVentas(0)("FolioFiscalPadre").ToString) + Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Refacturación de Ingreso" + End If + End If + + End If + ObjVentas.Dispose() + + Return PdfFactura(Vta) End Function - Public Sub Update_ClickDocumentacion(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim activo As Boolean = False - - Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToEntero - Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString - Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - - Dim observaciones As String = GvRow.FCTextBox("TxtObservaciones").Text ' DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text - 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) - Dim chkCompleto As CheckBox = GvRow.FCCheckBox("chkEstatus") - Dim _Estatus As Integer - If chkCompleto.Checked Then _Estatus = 1 Else _Estatus = 0 - - - Dim objRH As New ClsEdocumentacion - - If Not GvRow.DataKey("CveDocumentacionElectronica").ToEntero = -1 Then - If objRH.DocumentacionElectronicaUpdate(GvRow.DataKey("CveDocumentacionElectronica").ToEntero, _CveDocumentacion, -1, CveCliente, -1, _Estatus, observaciones, _Adjunto, UsuarioActual.CveUsuario, GvRow.FCTextBox("TxtFechaLimite").Text.ToDate) Then - Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) - End If - Else - If objRH.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, _Estatus, observaciones, _Adjunto, UsuarioActual.CveUsuario, GvRow.FCTextBox("TxtFechaLimite").Text.ToDate) > 0 Then - Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) - End If - End If - - objRH.Dispose() - - End Sub - - -#End Region - -#Region "PERSONA FISICA" - Protected Sub LnkPersonaFisica_Click(sender As Object, e As EventArgs) - RegistraScript("$('#DivModalPersonaFisica').modal();") - End Sub - Protected Sub LnkActualizarPersonaFisica_Click(sender As Object, e As EventArgs) - Dim ObjCliente As New ClsClientes - - If ObjCliente.UpdateClientePersonaFisica(CveCliente, TxtApellidoPaternoPF.Text, TxtApellidoMaternoPF.Text, TxtNombrePF.Text) Then - Alert("El Cliente se ha actualizado correctamente.", TipoMensaje.MsgInformacion) - - TxtNombre.Text = $"{TxtNombrePF.Text} {TxtApellidoPaternoPF.Text} {TxtApellidoMaternoPF.Text}" - - TxtApellidoPaterno.Text = TxtApellidoPaternoPF.Text - TxtApellidoMaterno.Text = TxtApellidoMaternoPF.Text - TxtNombres.Text = TxtNombrePF.Text - - DivRazonSocial.Visible = False - DivPersonaFisica.Visible = True - - RegistraScript("$('#DivModalPersonaFisica').modal('hide');") - End If - - ObjCliente.Dispose() - UpDatos.Update() - End Sub -#End Region - -#Region "USUARIOS PLATAFORMA CLIENTE - 6 " - Protected Sub CargaUsuariosPortalCliente() - Dim objUsuario As ClsSisUsuarios = New ClsSisUsuarios - If objUsuario.GetUsuariosPortal(-1, CveCliente, -1) Then - GvUsuarios.DataSource = objUsuario.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa}") - GvUsuarios.DataBind() - End If - objUsuario.Dispose() - End Sub -#End Region - -#Region " DEVOLVER DINERO ANT/NC " - Private Sub InicializaDevolverDinero() - If UsuarioActual.TienePermisoProceso(247) Then - GVAnticipos.Columns(6).Visible = True - End If - End Sub -#End Region - -#Region "MODAL GRAFICA/PEDIDOS" - - Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) - If CargaDatatables() Then - RegistraScript("$('#DivModalGrafica').modal('show')") - CargaGrafica() - End If - End Sub - - Protected Sub LnkCancelar_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim ObjCliente As New ClsClientes - If ObjCliente.UpdateEstatusPedido(gvRow.DataKey("CveVenta").ToEntero, 17, -1, UsuarioActual.CveUsuario) Then - Alert("Cancelado correctamente.") - CargaPedido() - End If - ObjCliente.Dispose() - End Sub - - - Private Sub CargaPedido() - Dim ObjCliente As New ClsClientes - If ObjCliente.GetClienteVentasPedido(CveCliente, UsuarioActual.CveEmpresa) Then - GvPedidos.DataSource = ObjCliente.DtResultados - End If - ObjCliente.Dispose() - GvPedidos.DataBind() - UpPedido.Update() - End Sub - - Protected Sub LnkAutorizar_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim ObjCliente As New ClsClientes - ObjCliente.IniciaTransacSQL() - Dim ErrorTrans As Boolean = False - Dim CveU As Integer = 0 - Dim MsgAut As String = "" - - If ObjCliente.UpdateEstatusPedido(gvRow.DataKey("CveVenta").ToEntero, 16, gvRow.FCTextBox("TxtDiasCredito").Text.ToEntero, UsuarioActual.CveUsuario) Then - CveU = gvRow.DataKey("CveUsuario").ToEntero - MsgAut = String.Format(" Solicitud Autorizada {0} ", gvRow.DataKey("SerieFolio")) - 'If Not ObjCliente.UpdateFechaPedido(gvRow.DataKey("CveVenta").ToEntero, gvRow.FCTextBox("TxtDiasCredito").Text.ToEntero) Then - ' ErrorTrans = True - 'End If - Else - ErrorTrans = True - End If - If Not ErrorTrans Then - ObjCliente.Commit() - Alert("Autorizado correctamente.") - - If CveU > 0 Then ClsSisNotificaciones.SendNotificacionERP(CveU, MsgAut, MsgAut, 1) - - CargaPedido() - Else - ObjCliente.RollBack() - End If - ObjCliente.Dispose() - End Sub - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) - If CargaDatatables() Then - CargaGrafica() - End If - End Sub - - Private Function CargaDatatables() As Boolean - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClienteVencido(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then - DtVencido = ObjClientes.DtResultados - End If - - If ObjClientes.GetRotacionCartera(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then - DtRotacion = ObjClientes.DtResultados - End If - - If ObjClientes.GetClienteSaldoMensual(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then - DtSaldoMensual = ObjClientes.DtResultados - End If - - If ObjClientes.GetClienteComportamientoVentaMensual(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then - DtComportamientoVentas = ObjClientes.DtResultados - End If - - If ObjClientes.GetClienteVentasPedido(CveCliente, UsuarioActual.CveEmpresa) Then - GvPedidos.DataSource = ObjClientes.DtResultados - End If - - ObjClientes.Dispose() - GvPedidos.DataBind() - UpPedido.Update() - - Return True - End Function - - Private Sub CargaGrafica() - Dim FactVencida As Boolean = False - Dim Saldo As Double = 0 - Dim LimiteCredito As Double = 0 - If DtVencido.Rows.Count > 0 Then - Saldo = DtVencido.SUM("Saldo") - LimiteCredito = DtVencido.Rows(0)("LimiteCredito").ToString.ToDouble - LblVencido.Text = DtVencido.SUM("Total", "DiasVencidos > 0").FormatoNumero - LblPorVencer.Text = DtVencido.SUM("Total", "DiasVencidos <= 0").FormatoNumero - Else - LimiteCredito = TxtLimiteCredito.Text.ToDouble - LblVencido.Text = "0" - LblPorVencer.Text = "0" - End If - - Dim Dt As New DataTable() - Dt.Columns.Add("value") - For Each Dr As DataRow In DtVencido.Rows - Dim Row As DataRow = Nothing - Row = Dt.NewRow() - Row("value") = Dr("DiasVencidos").ToString - Dt.Rows.Add(Row) - If Dr("DiasVencidos").ToString.ToEntero > 0 And Dr("Saldo").ToString.ToDouble > 0 Then - FactVencida = True - End If - Next - - - Dim query = From s In Dt.AsEnumerable() Select New With {.date = "", .value = s("value").ToString()} - Dim json = Newtonsoft.Json.JsonConvert.SerializeObject(query) - RegistraScript($"CargaGraficaVencido({json})", "22") - - Dim Dt2 As New DataTable() - Dt2.Columns.Add("limite") - Dt2.Columns.Add("saldo") - Dim Row2 As DataRow = Nothing - Row2 = Dt2.NewRow() - LtlLimiteCreditoModal.Text = LimiteCredito.FormatoNumero - Row2("limite") = LimiteCredito - Saldo - Row2("saldo") = Saldo - Dt2.Rows.Add(Row2) - Dim query2 = From s In Dt2.AsEnumerable() Select New With {.year = "", .limite = s("limite").ToString(), .saldo = s("saldo").ToString()} - Dim json2 = Newtonsoft.Json.JsonConvert.SerializeObject(query2) - - RegistraScript($"CargaGraficaLimiteCredito({json2})", "33") - - If DtRotacion.Rows.Count > 0 Then - LblVentasModal.Text = DtRotacion.Rows(0)("Ventas").ToString.FormatoNumero - LblPagadoModal.Text = DtRotacion.Rows(0)("Pagado").ToString.FormatoNumero - LblRotacionModal.Text = DtRotacion.Rows(0)("Rotacion").ToString.FormatoNumero - LblDiasModal.Text = DtRotacion.Rows(0)("Dias").ToString.FormatoNumero - LblDiasCreditoModal.Text = DtRotacion.Rows(0)("DiasCredito").ToString.FormatoNumero - Else - LblVentasModal.Text = "0" - LblPagadoModal.Text = "0" - LblRotacionModal.Text = "0" - LblDiasModal.Text = "0" - LblDiasCreditoModal.Text = "0" - End If - - If FactVencida Or (Saldo > LimiteCredito) Then - LblEstatusModal.Text = "Vencido" - LblEstatusModal.ForeColor = Drawing.Color.Red - Else - LblEstatusModal.Text = "Al Corriente" - LblEstatusModal.ForeColor = Drawing.Color.Green - End If - - Dim Dt3 As New DataTable() - Dt3.Columns.Add("mes") - - Dim Dt4 As New DataTable() - Dt4.Columns.Add("balloonText") - Dt4.Columns.Add("bullet") - Dt4.Columns.Add("title") - Dt4.Columns.Add("valueField") - Dt4.Columns.Add("fillAlphas") - Dt4.Columns.Add("hidden") - - - Dim Cont As Integer = 1 - For Each Dr As DataRow In DtComportamientoVentas.Rows - Dt3.Columns.Add(Dr("Ano").ToString) - Dim Row4 As DataRow = Nothing - Row4 = Dt4.NewRow() - Row4("balloonText") = "Ventas [[category]]: [[value]]" - Row4("bullet") = "round" - Row4("title") = Dr("Ano").ToString - Row4("valueField") = Dr("Ano").ToString - Row4("fillAlphas") = 0 - Row4("hidden") = If(Cont > DtComportamientoVentas.Rows.Count - 3, False, True) - Dt4.Rows.Add(Row4) - Cont += 1 - Next - - Dim RowEnero As DataRow = Nothing - RowEnero = Dt3.NewRow() - Dim RowFebrero As DataRow = Nothing - RowFebrero = Dt3.NewRow() - Dim RowMarzo As DataRow = Nothing - RowMarzo = Dt3.NewRow() - Dim RowAbril As DataRow = Nothing - RowAbril = Dt3.NewRow() - Dim RowMayo As DataRow = Nothing - RowMayo = Dt3.NewRow() - Dim RowJunio As DataRow = Nothing - RowJunio = Dt3.NewRow() - Dim RowJulio As DataRow = Nothing - RowJulio = Dt3.NewRow() - Dim RowAgosto As DataRow = Nothing - RowAgosto = Dt3.NewRow() - Dim RowSeptiembre As DataRow = Nothing - RowSeptiembre = Dt3.NewRow() - Dim RowOctubre As DataRow = Nothing - RowOctubre = Dt3.NewRow() - Dim RowNoviembre As DataRow = Nothing - RowNoviembre = Dt3.NewRow() - Dim RowDiciembre As DataRow = Nothing - RowDiciembre = Dt3.NewRow() - For Each Dr As DataRow In DtComportamientoVentas.Rows - RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString - RowEnero("mes") = "Enero" - RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString - RowFebrero("mes") = "Febrero" - RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString - RowMarzo("mes") = "Marzo" - RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString - RowAbril("mes") = "Abril" - RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString - RowMayo("mes") = "Mayo" - RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString - RowJunio("mes") = "Junio" - RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString - RowJulio("mes") = "Julio" - RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString - RowAgosto("mes") = "Agosto" - RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString - RowSeptiembre("mes") = "Septiembre" - RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString - RowOctubre("mes") = "Octubre" - RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString - RowNoviembre("mes") = "Noviembre" - RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString - RowDiciembre("mes") = "Diciembre" - Next - Dt3.Rows.Add(RowEnero) - Dt3.Rows.Add(RowFebrero) - Dt3.Rows.Add(RowMarzo) - Dt3.Rows.Add(RowAbril) - Dt3.Rows.Add(RowMayo) - Dt3.Rows.Add(RowJunio) - Dt3.Rows.Add(RowJulio) - Dt3.Rows.Add(RowAgosto) - Dt3.Rows.Add(RowSeptiembre) - Dt3.Rows.Add(RowOctubre) - Dt3.Rows.Add(RowNoviembre) - Dt3.Rows.Add(RowDiciembre) - - RegistraScript($"CargaGraficaComportamientoVentas({Dt3.ToJson},{Dt4.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "44") - - Dim Dt5 As New DataTable() - Dt5.Columns.Add("mes") - - Dim Dt6 As New DataTable() - Dt6.Columns.Add("balloonText") - Dt6.Columns.Add("bullet") - Dt6.Columns.Add("title") - Dt6.Columns.Add("valueField") - Dt6.Columns.Add("fillAlphas") - Dt6.Columns.Add("hidden") - - Cont = 1 - For Each Dr As DataRow In DtSaldoMensual.Rows - Dt5.Columns.Add(Dr("Ano").ToString) - Dim Row6 As DataRow = Nothing - Row6 = Dt6.NewRow() - Row6("balloonText") = "Saldo [[category]]: [[value]]" - Row6("bullet") = "round" - Row6("title") = Dr("Ano").ToString - Row6("valueField") = Dr("Ano").ToString - Row6("fillAlphas") = 0 - Row6("hidden") = If(Cont > DtSaldoMensual.Rows.Count - 3, False, True) - Dt6.Rows.Add(Row6) - Cont += 1 - Next - RowEnero = Dt5.NewRow() - RowFebrero = Dt5.NewRow() - RowMarzo = Dt5.NewRow() - RowAbril = Dt5.NewRow() - RowMayo = Dt5.NewRow() - RowJunio = Dt5.NewRow() - RowJulio = Dt5.NewRow() - RowAgosto = Dt5.NewRow() - RowSeptiembre = Dt5.NewRow() - RowOctubre = Dt5.NewRow() - RowNoviembre = Dt5.NewRow() - RowDiciembre = Dt5.NewRow() - For Each Dr As DataRow In DtSaldoMensual.Rows - RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString - RowEnero("mes") = "Enero" - RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString - RowFebrero("mes") = "Febrero" - RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString - RowMarzo("mes") = "Marzo" - RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString - RowAbril("mes") = "Abril" - RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString - RowMayo("mes") = "Mayo" - RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString - RowJunio("mes") = "Junio" - RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString - RowJulio("mes") = "Julio" - RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString - RowAgosto("mes") = "Agosto" - RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString - RowSeptiembre("mes") = "Septiembre" - RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString - RowOctubre("mes") = "Octubre" - RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString - RowNoviembre("mes") = "Noviembre" - RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString - RowDiciembre("mes") = "Diciembre" - Next - Dt5.Rows.Add(RowEnero) - Dt5.Rows.Add(RowFebrero) - Dt5.Rows.Add(RowMarzo) - Dt5.Rows.Add(RowAbril) - Dt5.Rows.Add(RowMayo) - Dt5.Rows.Add(RowJunio) - Dt5.Rows.Add(RowJulio) - Dt5.Rows.Add(RowAgosto) - Dt5.Rows.Add(RowSeptiembre) - Dt5.Rows.Add(RowOctubre) - Dt5.Rows.Add(RowNoviembre) - Dt5.Rows.Add(RowDiciembre) - - - RegistraScript($"CargaGraficaCompratamientoSaldoMensual({Dt5.ToJson},{Dt6.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "55") - - UPModalProd.Update() - End Sub - - -#End Region - -#Region "TAB - COMPORTAMIENTO DE VENTAS" - - Private Sub CargaGrupo() - DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3")) - DdlGrupo.Items.Insert(1, New ListItem("Clasificacion", "4")) - DdlGrupo.Items.Insert(2, New ListItem("Productos-Servicios", "5")) - DdlGrupo.Items.Insert(3, New ListItem("Año", "6")) - DdlGrupo.Items.Insert(4, New ListItem("Mes", "7")) - DdlGrupo.Items.Insert(5, New ListItem("Año/Mes", "8")) - DdlGrupo.Items.Insert(6, New ListItem("Fecha", "9")) - DdlGrupo.Items.Insert(7, New ListItem("Cliente", "10")) - DdlGrupo.Items.Insert(8, New ListItem("Vendedor", "12")) - DdlGrupo.Items.Insert(9, New ListItem("Usuario", "13")) - DdlGrupo.Items.Insert(10, New ListItem("Estatus Fact.", "14")) - DdlGrupo.Items.Insert(11, New ListItem("Año Ejec.", "15")) - DdlGrupo.Items.Insert(12, New ListItem("Mes Ejec.", "16")) - DdlGrupo.Items.Insert(13, New ListItem("Año/Mes Ejec.", "17")) - DdlGrupo.Items.Insert(14, New ListItem("Fecha Ejec.", "18")) - DdlGrupo.Items.Insert(15, New ListItem("Cliente - PS", "20")) - DdlGrupo.DataBind() - DdlGrupo.SelectedValueExist("8") - End Sub - - Private Sub CargaTipoCentroCosto() - - If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then - DdlSubProyectoFiltro.Items.Clear() - DivProyecto.Visible = False - LblProyecto.Visible = False - LblSubProyecto.InnerText = "Sucursal:" - DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) - DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) - DdlSubProyectoFiltro.DataBind() - - DdlGrupo.Items.Insert(0, New ListItem("Sucursal", "2")) - DdlGrupo.Items.Insert(16, New ListItem("Sucursal Ejec.", "19")) - DdlGrupo.DataBind() - - ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then - DdlSubProyectoFiltro.Items.Clear() - DivProyecto.Visible = False - LblProyecto.Visible = False - LblSubProyecto.InnerText = "Proyecto:" - DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) - DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) - DdlSubProyectoFiltro.DataBind() - - DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "2")) - DdlGrupo.Items.Insert(16, New ListItem("Proyecto Ejec.", "19")) - DdlGrupo.DataBind() - ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 3 Then - DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) - DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) - DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) - DdlGrupo.DataBind() - ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then - LblProyecto.InnerText = "Sucursal:" - LblSubProyecto.InnerText = "Proyecto:" - - - DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) - DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) - DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) - DdlGrupo.DataBind() - - ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then - LblProyecto.InnerText = "Proyecto:" - LblSubProyecto.InnerText = "Sucursal:" - - DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) - DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) - DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) - DdlGrupo.DataBind() - End If - End Sub - - Private Sub CargaFiltros() - 'Cargo Proyectos - DdlProyecto.DataSource = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1) - DdlProyecto.DataBind() - - 'Cargo Clasificaciones - DdlClasificacionFilto.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) - DdlClasificacionFilto.DataBind() - - 'CargaSubProyectos - DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) - DdlSubProyectoFiltro.DataBind() - - 'Vendedor - DdlVendedorFiltro.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) - DdlVendedorFiltro.DataBind() - - 'CargaUsuarios - DdlUsuario.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - DdlUsuario.DataBind() - - 'Carga Productos - DdlPSFiltro.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") - - If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then - DdlPSFiltro.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionFilto.SelectedValue) - DdlPSFiltro.SelectedText = "" - DdlPSFiltro.SelectedValue = "-1" - Else - DdlPSFiltro.ddl.Items.Clear() - DdlPSFiltro.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionFilto.SelectedValue.ToEntero) - DdlPSFiltro.ddl.DataBind() - DdlPSFiltro.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) - End If - - CargaGrupo() - CargaTipoCentroCosto() - - End Sub - - Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged - CargaSubProyecto() - End Sub - - Private Sub CargaSubProyecto() - DdlSubProyectoFiltro.Items.Clear() - If DdlProyecto.SelectedValue <> "-1" Then - DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1, 1) - DdlSubProyectoFiltro.DataBind() - End If - DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) - End Sub - - Protected Sub DdlClasificacionFilto_SelectedIndexChanged(sender As Object, e As EventArgs) - If UsuarioActual.Empresa.Funcionalidad(105) = "" Then - DdlPSFiltro.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionFilto.SelectedValue.ToEntero) - DdlPSFiltro.DataBind() - DdlPSFiltro.ddl.Items.Insert(0, New ListItem("Todos", "-1")) - Else - DdlPSFiltro.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionFilto.SelectedValue) - DdlPSFiltro.SelectedText = "Todos" - DdlPSFiltro.SelectedValue = "-1" - End If - End Sub - - Protected Sub GvComportamientoVenta_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - - If DdlGrupo.SelectedValue.ToEntero = 20 Then - - If e.Row.DBCampo("PS").ToString = "" Then - e.Row.CssClass = "Totales" - End If - Else - If Not e.Row.DBCampo("CveVenta").ToEntero > 0 Then - e.Row.Cells(5).Text = e.Row.DBCampo("Gpo").ToString - e.Row.CssClass = "Totales" - - End If - End If - End If - End Sub - - Protected Sub BtnConsultarComportamiento_Click(sender As Object, e As EventArgs) - CargaGvComportamientoVenta() - End Sub - - Private Sub CargaGvComportamientoVenta() - Dim ObjVentas As New ClsVentas() - Dim FechaI, FechaF As Date - FechaI = If(IsDate(TxtFechaIFiltro.Text.Trim()), TxtFechaIFiltro.Text.ToDate, MinFecha) - FechaF = If(IsDate(TxtFechaFFiltro.Text.Trim()), TxtFechaFFiltro.Text.ToDate, MaxFecha) - - If ObjVentas.GetRepProductosServiciosDetalle(DdlProyecto.SelectedValue.ToEntero, DdlSubProyectoFiltro.SelectedValue.ToEntero, -1, DdlClasificacionFilto.SelectedValue.ToEntero, - DdlPSFiltro.SelectedValue.ToEntero, FechaI, FechaF, -1, MinFecha, MaxFecha, -1, - CveCliente, -1, DdlVendedorFiltro.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, -1, - UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoDocto:="Ing", GPO:=DdlGrupo.SelectedValue.ToEntero) Then - GvComportamientoVenta.DataSource = ObjVentas.DtResultados - Else - GvComportamientoVenta.DataSource = Nothing - End If - - ObjVentas.Dispose() - GvComportamientoVenta.DataBind() - UpDatosComportamientoVenta.Update() - End Sub - -#End Region - -#Region "DISPOSITIVOS" - - Protected Sub LnkMoverDispositivo_Click(sender As Object, e As EventArgs) - Dim CveDispositivo As Integer = HdnCveDispositivoMover.Value.ToEntero() - Dim CveCliente As Integer = DdlClienteDispositivo.SelectedValue.ToEntero() - - If CveDispositivo <= 0 Then - Alert("Se debe seleccionar un dispositivo.", TipoMensaje.MsgAdvertencia) - Return - End If - If CveCliente <= 0 Then - Alert("Se debe seleccionar un cliente.", TipoMensaje.MsgAdvertencia) - Return - End If - Dim TieneError As Boolean = False - Dim ObjGPS = New ClsGPS() - Dim ObjEventos As New ClsOIEventos(ObjGPS.IniciaTransacSQL()) - - If ObjGPS.UpdateClienteDispositivo(CveDispositivo, CveCliente) Then - TieneError = Not ObjEventos.AddEventoBitacora($"Se movió el dispositivo: {NombreDispositivo} de cliente. Valor Anterior:{UsuarioActual.Empresa.Empresa}, {LtlCliente.Text} Valor Actual:{DdlEmpresaDispositivo.SelectedItem.Text}, {DdlClienteDispositivo.SelectedItem.Text}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) - Else - TieneError = True - End If - - If TieneError Then - ObjGPS.RollBack() - Alert($"Ocurrió un error al mover el dispostivo.", TipoMensaje.MsgError) - Else - ObjGPS.Commit() - Alert($"El dispositivo '{NombreDispositivo}' se movió correctamente.") - End If - - ObjGPS.Dispose() - ObjEventos.Dispose() - - CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) - CargaEventoBitacora() - NombreDispositivo = "" - RegistraScript("$('#DivMoverDispositivo').modal('hide');") - End Sub - -#End Region - -#Region "CRM" - Protected Sub CargaDatosCRM() - Dim ObjCRM = New ClsCRM() - - If ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, CveEmpresaCRM) And ObjCRM.DtResultados.Rows.Count > 0 Then - TxtNombre.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa").ToString - TxtNombreComercial.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa").ToString - TxtRFC.Text = ObjCRM.DtResultados.FiltroPrimeroValor("RFC").ToString - - TxtEmail.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo").ToString - TxtEmailCotizacion.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo").ToString - - DdlVendedor.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveVendedorAsignado").ToString) - DdlSubProyecto.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToString) - Else - Alert("La empresa CRM solicitada no existe, porfavor verifique", TipoMensaje.MsgAdvertencia) - CveEmpresaCRM = -1 - End If - ObjCRM.Dispose() - End Sub - - Protected Sub VerificaVinculacion() - Dim ObjCRM = New ClsCRM() - - If ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, -1) And ObjCRM.DtResultados.Rows.Count > 0 Then - If ObjCRM.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente)).Rows.Count > 0 Then - LiLnkUnificarCRM.Visible = False - Else - LiLnkUnificarCRM.Visible = True - End If - End If - ObjCRM.Dispose() - End Sub - - Protected Function VincularEmpresaCRM() As Boolean - Dim Ok As Boolean = False - Dim ObjCRM = New ClsCRM() - Dim ObjBitacora = New ClsOIEventos(ObjCRM.IniciaTransacSQL()) - If (CveCliente > 0) Then - - Dim CveEmpresaCRMVincular As Integer = If(CveEmpresaCRM > 0, CveEmpresaCRM, If(CveEmpresaCRMUnificar > 0, CveEmpresaCRMUnificar, -1)) - - If ObjCRM.UpdateEmpresCRM("-2", "-2", -2, CveEmpresaCRMVincular, -2, UsuarioActual.CveUsuario, CveCliente, -1, "-1") Then - If CveEmpresaCRM > 0 Then - ObjBitacora.AddEventoBitacora(String.Format("Se Creó el Cliente: {0} a partir de la Empresa CRM", TxtNombre.Text), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM:=CveEmpresaCRM) - End If - If CveEmpresaCRMUnificar > 0 Then - ObjBitacora.AddEventoBitacora(String.Format("Se Unificó el Cliente: {0} con la Empresa CRM", TxtNombre.Text), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM:=CveEmpresaCRMUnificar) - End If - Ok = True - End If - End If - - If (Ok) Then - ObjCRM.Commit() - Else - ObjCRM.RollBack() - End If - ObjCRM.Dispose() - ObjBitacora.Dispose() - - Return Ok - End Function - - Protected Sub CargaModalEmpresasCRM() - Dim ObjCRM = New ClsCRM() - - If (ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa) And ObjCRM.DtResultados.Rows.Count > 0) Then - DtEmpresasCRM = ObjCRM.DtResultados.FiltraParametros(String.Format("CveCliente IS NULL")) - GvEmpresasCRM.DataSource = DtEmpresasCRM - End If - ObjCRM.Dispose() - GvEmpresasCRM.DataBind() - UpEmpresasCRM.Update() - End Sub - - Protected Sub LnkUnificarCRM_Click(sender As Object, e As EventArgs) - CveEmpresaCRMUnificar = -1 - CargaModalEmpresasCRM() - RegistraScript("$('#DivModalUnificarCRM').modal();") - End Sub - - Protected Sub BtnUnificarCRM_Click(sender As Object, e As EventArgs) - For Each row As GridViewRow In GvEmpresasCRM.Rows - Dim chkSeleccionado As RadioButton = CType(row.FindControl("RBSeleccion"), RadioButton) - If chkSeleccionado.Checked Then - CveEmpresaCRMUnificar = row.DataKey("CveEmpresaCRM").ToEntero - End If - Next - - If CveEmpresaCRMUnificar > 0 Then - If (VincularEmpresaCRM()) Then - LiLnkUnificarCRM.Visible = False - UpAccionesCRM.Update() - - RegistraScript("$('#DivModalUnificarCRM').modal('hide');") - Alert("Se Unificó correctamente al Cliente con la Empresa CRM.") - End If - End If - End Sub -#End Region - -#Region "PORCENTAJE PRECIO DE MARCAS" - Private Sub LnkPorcentajeMarcas_Click(sender As Object, e As EventArgs) Handles LnkPorcentajeMarcas.Click - RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajeMarcas")) - - CreaDT() - - CargaMarcas() - LimpiaModalPorcentaje() - End Sub - Private Sub CreaDT() - Dim DTPorcentajeTemp As New DataTable - - Dim column As DataColumn = New DataColumn("No") - column.DataType = Type.GetType("System.Int32") - With column - .AutoIncrement = True - .AutoIncrementSeed = 1 - .AutoIncrementStep = 1 - End With - - DTPorcentajeTemp.Columns.Add(column) - DTPorcentajeTemp.Columns.Add("CveMarca", GetType(Integer)) - DTPorcentajeTemp.Columns.Add("Marca", GetType(String)) - DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("PorcentajeProducto2", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("PorcentajeProducto3", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("ProntoPago", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("Plazo", GetType(Integer)) - DTPorcentajeTemp.Columns.Add("Estatus", GetType(String)) - DTPorcentajePrecios = DTPorcentajeTemp.Clone - End Sub - Private Sub CargaMarcas() - Dim ObjMarcas As New ClsProductosServicios - ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) - DdlMarcaPS.DataSource = ObjMarcas.DtResultados - ObjMarcas.Dispose() - DdlMarcaPS.DataBind() - DdlMarcaPS.Items.Insert(0, New ListItem("Seleccione", "-1")) - - CargaGridPorcentajes() - UpPorcentaje.Update() - End Sub - - Private Sub CargaGridPorcentajes() - Dim ObjPS As New ClsProductosServicios - - If ObjPS.GetPorcentajeMarcas(CveCliente) Then - DTPorcentajePrecios = ObjPS.DtResultados - GvM.DataSource = DTPorcentajePrecios - End If - ObjPS.Dispose() - - GvM.DataBind() - UppGrid.Update() - - End Sub - Private Sub CargaDTPorcentajePrecios(DtTemp As DataTable) - GvM.DataSource = DtTemp - GvM.DataBind() - - UppGrid.Update() - End Sub - - Private Sub LimpiaModalPorcentaje() - txtPorcentaje.Text = "" - txtPorcentaje2.Text = "" - txtPorcentaje3.Text = "" - txtProntoPago.Text = "" - txtPlazo.Text = "" - DdlMarcaPS.SelectedValue = "-1" - End Sub - - Protected Sub LbAgregarMarca_Click(sender As Object, e As EventArgs) Handles LbAgregarMarca.Click - If txtPorcentaje.Text.ToDecimal > 0 And txtPorcentaje.Text.ToDecimal <= 100 And txtPorcentaje2.Text.ToDecimal >= 0 And txtPorcentaje2.Text.ToDecimal <= 100 And txtPorcentaje3.Text.ToDecimal >= 0 And txtPorcentaje3.Text.ToDecimal <= 100 Then - - Dim registro As DataRow = DTPorcentajePrecios.NewRow - - registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1 - registro.Item("CveMarca") = DdlMarcaPS.SelectedValue.ToEntero - registro.Item("Marca") = DdlMarcaPS.SelectedItem.Text - registro.Item("PorcentajeProducto") = txtPorcentaje.Text.ToDecimal - registro.Item("PorcentajeProducto2") = txtPorcentaje2.Text.ToDecimal - registro.Item("PorcentajeProducto3") = txtPorcentaje3.Text.ToDecimal - registro.Item("ProntoPago") = txtProntoPago.Text.ToDecimal - registro.Item("Plazo") = txtPlazo.Text.ToEntero - registro.Item("Estatus") = "I" - DTPorcentajePrecios.Rows.Add(registro) - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - Else - Alert("El Porcentaje debe estar en un rango mayor a 0 y menor o igual a 100", TipoMensaje.MsgAdvertencia) - End If - - LimpiaModalPorcentaje() - End Sub - - Protected Sub DeleteRowMarca(sender As Object, e As EventArgs) - - Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) - - - If DTPorcentajePrecios.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then - Dim i As Integer - i = lnkRemove.CommandArgument.ToString.ToEntero - Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", i)) - If Drs.Count > 0 Then - If CveCliente > 0 AndAlso Drs(0)("CveMarca").ToString.ToEntero > 0 Then - Drs(0)("Estatus") = "D" - Else - Drs(0).Delete() - End If - - End If - DTPorcentajePrecios.AcceptChanges() - End If - - GvM.EditIndex = -1 - - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - - End Sub - - Protected Sub GvM_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvM.RowEditing - GvM.EditIndex = e.NewEditIndex - - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - End Sub - Protected Sub GvM_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvM.RowCancelingEdit - GvM.EditIndex = -1 - - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - End Sub - Protected Sub GvM_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvM.RowUpdating - - Dim PorcentajeProducto As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP").Text.ToDouble - Dim PorcentajeProducto2 As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP2").Text.ToDouble - Dim PorcentajeProducto3 As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP3").Text.ToDouble - Dim ProntoPago As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtProntoPagoP").Text.ToDouble - Dim Plazo As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPlazoP").Text.ToDouble - - If PorcentajeProducto > 0 And PorcentajeProducto <= 100 And PorcentajeProducto2 >= 0 And PorcentajeProducto2 <= 100 And PorcentajeProducto3 >= 0 And PorcentajeProducto3 <= 100 Then - Dim No As Integer = GvM.Rows(e.RowIndex).DataKey("No").ToEntero - - Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", No)) - - If Drs.Count > 0 Then - Drs(0)("PorcentajeProducto") = PorcentajeProducto - Drs(0)("PorcentajeProducto2") = PorcentajeProducto2 - Drs(0)("PorcentajeProducto3") = PorcentajeProducto3 - Drs(0)("ProntoPago") = ProntoPago - Drs(0)("Plazo") = Plazo - If Drs(0)("Estatus").ToString <> "I" Then - Drs(0)("Estatus") = "U" - End If - End If - - DTPorcentajePrecios.AcceptChanges() - GvM.EditIndex = -1 - - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - Else - Alert("El Porcentaje debe estar en un rango mayor a 0 y menor o igual a 100", TipoMensaje.MsgAdvertencia) - End If - - End Sub - - Protected Sub BtnGuardarPorcentajesMarca_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajesMarca.Click - - Dim TieneError As Boolean = False - - Dim ObjPS As New ClsProductosServicios - ObjPS.IniciaTransacSQL() - - For Each Dr As DataRow In DTPorcentajePrecios.Rows - - If Dr("Estatus").ToString <> "" Then - - If Dr("Estatus").ToString = "I" Then - If Not ObjPS.AddPorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, Dr("PorcentajeProducto2").ToString.ToDecimal, Dr("PorcentajeProducto3").ToString.ToDecimal, UsuarioActual.CveUsuario, Dr("ProntoPago").ToString.ToDecimal, Dr("Plazo").ToString.ToEntero) Then - TieneError = True - End If - ElseIf Dr("Estatus").ToString = "U" Then - If Not ObjPS.UpdatePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, Dr("PorcentajeProducto2").ToString.ToDecimal, Dr("PorcentajeProducto3").ToString.ToDecimal, Dr("ProntoPago").ToString.ToDecimal, Dr("Plazo").ToString.ToEntero) Then - TieneError = True - End If - ElseIf Dr("Estatus").ToString = "D" Then - If Not ObjPS.RemovePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero) Then - TieneError = True - End If - End If - - End If - Next - - If TieneError Then - ObjPS.RollBack() - Else - ObjPS.Commit() - Alert("Los Porcentajes se guardaron correctamente.", TipoMensaje.MsgInformacion) - RegistraScript("$('#DivPorcentajeMarcas').modal('hide')", "hidemodal") - End If - - ObjPS.Dispose() - - End Sub -#End Region - -#Region "PORCENTAJE PRECIO DE PRODUCTOS" - Private Sub LnkPorcentajePrecios_Click(sender As Object, e As EventArgs) Handles LnkPorcentajePrecios.Click - RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajePrecios")) - - CreaDT2() - - TxtPorcentajePS.Attributes.Add("onchange", String.Format("FnCambiaPorcentaje({0});", "5")) - CargaPorcentajesProductos() - LimpiaModalPorcentaje2() - End Sub - Private Sub CreaDT2() - Dim DTPorcentajeTemp As New DataTable - - Dim column As DataColumn = New DataColumn("No") - column.DataType = Type.GetType("System.Int32") - With column - .AutoIncrement = True - .AutoIncrementSeed = 1 - .AutoIncrementStep = 1 - End With - - DTPorcentajeTemp.Columns.Add(column) - DTPorcentajeTemp.Columns.Add("CvePS", GetType(Integer)) - DTPorcentajeTemp.Columns.Add("Producto", GetType(String)) - DTPorcentajeTemp.Columns.Add("PrecioG", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("PrecioA", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("Estatus", GetType(String)) - DTPorcentajePrecios = DTPorcentajeTemp.Clone - End Sub - Private Sub CargaPorcentajesProductos() - 'Llenar el dropdownlist de Secciones - If UsuarioActual.CveEmpresa = 66 Then - DdlClasificacion2.DataSource = GlobalDTSubFamilias(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion") - Else - Dim ObjClasificaciones As New ClsClasificaciones - If ObjClasificaciones.GetClasificacionesExistencias(UsuarioActual.CveEmpresa) Then - DdlClasificacion2.DataSource = ObjClasificaciones.DtResultados - End If - ObjClasificaciones.Dispose() - End If - DdlClasificacion2.DataBind() - - CargaPS() - CargaGridPorcentajes2() - - UpPorcentajeP.Update() - End Sub - Private Sub CargaPS() - DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") - - If UsuarioActual.CveEmpresa = 66 Then - DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios") - End If - - If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then - DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2") - - DdlProducto2.DataBind() - - DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) - End If - - End Sub - - Protected Sub DdlProducto2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlProducto2.selectedindexchange - DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2) - End Sub - Private Sub DdlProducto2IndexChange(CvePSParametro As Integer, Ddl As ADServerControl.Dropdownlost) - Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") - - If drPS IsNot Nothing Then - Dim Precio = drPS("Precio").ToString.ToDouble - LbPrecioG.Text = Precio.FormatoNumero() - LbPrecioA.Text = ((Precio * TxtPorcentajePS.Text.ToDecimal) / 100).FormatoNumero - End If - End Sub - - Private Sub CargaGridPorcentajes2() - Dim ObjPS As New ClsProductosServicios - - If ObjPS.GetPorcentajeProductos(CveCliente) Then - DTPorcentajePrecios = ObjPS.DtResultados - GvP.DataSource = DTPorcentajePrecios - End If - ObjPS.Dispose() - - GvP.DataBind() - UpPorcentajePS.Update() - - End Sub - Private Sub CargaDTPorcentajePrecios2(DtTemp As DataTable) - GvP.DataSource = DtTemp - GvP.DataBind() - - UpPorcentajePS.Update() - End Sub - - Private Sub LimpiaModalPorcentaje2() - TxtPorcentajePS.Text = "" - DdlClasificacion2.SelectedValue = "-1" - DdlProducto2.SelectedText = "" - End Sub - - Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click - - If DdlProducto2.SelectedText <> "" Then - If TxtPorcentajePS.Text.ToDecimal >= 0 And TxtPorcentajePS.Text.ToDecimal <= 100 Then - - Dim registro As DataRow = DTPorcentajePrecios.NewRow - - registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1 - registro.Item("CvePS") = DdlProducto2.SelectedValue.ToEntero - registro.Item("Producto") = DdlProducto2.SelectedText - registro.Item("PrecioG") = LbPrecioG.Text.ToDecimal - registro.Item("PrecioA") = LbPrecioG.Text.ToDecimal * TxtPorcentajePS.Text.ToDecimal / 100 - registro.Item("PorcentajeProducto") = TxtPorcentajePS.Text.ToDecimal - registro.Item("Estatus") = "I" - DTPorcentajePrecios.Rows.Add(registro) - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - Else - Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia) - End If - Else - Alert("El campo ''Producto'' es necesario, por favor ingréselo.", TipoMensaje.MsgAdvertencia) - End If - - LimpiaModalPorcentaje() - End Sub - - Protected Sub DeleteRow(sender As Object, e As EventArgs) - - Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) - - - If DTPorcentajePrecios.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then - Dim i As Integer - i = lnkRemove.CommandArgument.ToString.ToEntero - Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", i)) - If Drs.Count > 0 Then - If CveCliente > 0 AndAlso Drs(0)("CvePS").ToString.ToEntero > 0 Then - Drs(0)("Estatus") = "D" - Else - Drs(0).Delete() - End If - - End If - DTPorcentajePrecios.AcceptChanges() - End If - - GvP.EditIndex = -1 - - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - - End Sub - - Protected Sub GvP_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvP.RowEditing - GvP.EditIndex = e.NewEditIndex - - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - End Sub - Protected Sub GvP_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvP.RowCancelingEdit - GvP.EditIndex = -1 - - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - End Sub - Protected Sub GvP_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvP.RowUpdating - - Dim PorcentajeProducto As Double = GvP.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP").Text.ToDouble - - If PorcentajeProducto >= 0 And PorcentajeProducto <= 100 Then - Dim No As Integer = GvP.Rows(e.RowIndex).DataKey("No").ToEntero - - Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", No)) - - If Drs.Count > 0 Then - Drs(0)("PorcentajeProducto") = PorcentajeProducto - Drs(0)("PrecioA") = Drs(0)("PrecioG").ToString.ToDouble * PorcentajeProducto / 100 - If Drs(0)("Estatus").ToString <> "I" Then - Drs(0)("Estatus") = "U" - End If - End If - - DTPorcentajePrecios.AcceptChanges() - GvP.EditIndex = -1 - - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - Else - Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia) - End If - - End Sub - - Protected Sub BtnGuardarPorcentajes_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajes.Click - - Dim TieneError As Boolean = False - - Dim ObjPS As New ClsProductosServicios - ObjPS.IniciaTransacSQL() - - For Each Dr As DataRow In DTPorcentajePrecios.Rows - - If Dr("Estatus").ToString <> "" Then - - If Dr("Estatus").ToString = "I" Then - If Not ObjPS.AddPorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, UsuarioActual.CveUsuario) Then - TieneError = True - End If - ElseIf Dr("Estatus").ToString = "U" Then - If Not ObjPS.UpdatePorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal) Then - TieneError = True - End If - ElseIf Dr("Estatus").ToString = "D" Then - If Not ObjPS.RemovePorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero) Then - TieneError = True - End If - End If - - End If - Next - - If TieneError Then - ObjPS.RollBack() - Else - ObjPS.Commit() - Alert("Los Porcentajes se guardaron correctamente.", TipoMensaje.MsgInformacion) - RegistraScript("$('#DivPorcentajePrecios').modal('hide')", "hidemodal") - End If - - ObjPS.Dispose() - - End Sub - - Protected Sub BtnCambiaPorcentaje_Click(sender As Object, e As EventArgs) - DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2) - End Sub -#End Region - -#Region " A C U M U L A D O R E S" - - - Protected Sub LnkFacturaUsadosCargos_Click(sender As Object, e As EventArgs) - 'CveVentaNota = 0 - - 'Dim Cargos As Decimal = 0D - 'Dim Iva As Decimal = 0D - - 'For Each GvRow As GridViewRow In GvAcum.Rows - - ' If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then - ' Cargos = Cargos + GvRow.DataKey("ImporteCargo").ToDecimal - ' End If - 'Next - - 'Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Cargo Nota - 'Dim CveUnidadMedida As Integer - 'Dim CveClasificacion As Integer - - 'If CvePS > 0 Then - - ' If Cargos > 0 Then - - ' CveUnidadMedida = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero - ' CveClasificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveClasificacion").ToString.ToEntero - ' Iva = Cargos * 0.16D - - ' If GenerarNotaCredito(CvePS, 1, CveUnidadMedida, Cargos, Iva, "Clientes/Usados", CveClasificacion) Then - ' Alert($"LA nota de crédito fue generada correctamente {SerieNotaAcumulador}-{FolioNotaAcumulador}") - ' Else - ' Alert("Se presento un error al generar la nota de creédito", TipoMensaje.MsgError) - ' End If - ' End If - - 'Else - ' Alert("No esta asignada la funcionalidad CvePS Distruibuidor Cargo Nota") - 'End If - - CreaObjetosVenta(1) - - 'If ObjFactura.CveCliente > 0 Then - ' If TmpDT.Rows.Count > 0 Then - ' Dim Retorno = ObjFactura.EmitirFactura(false) - ' For Each Mensaje In Retorno.Mensajes - ' Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion)) - ' Next - ' End If - 'End If - - CargaUsados() - - End Sub - Protected Sub LnkFacturaUsadosBonificacion_Click(sender As Object, e As EventArgs) - - 'CveVentaNota = 0 - 'Dim Bonificacion As Decimal = 0D - 'Dim Iva As Decimal = 0D - - 'For Each GvRow As GridViewRow In GvAcum.Rows - ' If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then - ' Bonificacion = Bonificacion + GvRow.DataKey("ImporteBonificacion").ToDecimal - ' End If - 'Next - - - 'Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Bonificación Nota - 'Dim CveUnidadMedida As Integer - 'Dim CveClasificacion As Integer - 'If CvePS > 0 Then - ' If Bonificacion > 0 Then - - ' CveUnidadMedida = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero - ' CveClasificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveClasificacion").ToString.ToEntero - ' Iva = Bonificacion * 0.16D - - ' If GenerarNotaCredito(CvePS, 2, CveUnidadMedida, Bonificacion, Iva, "Clientes/Usados", CveClasificacion) Then - ' Alert($"LA nota de crédito fue generada correctamente {SerieNotaAcumulador}-{FolioNotaAcumulador}") - ' Else - ' Alert("Se presento un error al generar la nota de creédito", TipoMensaje.MsgError) - ' End If - - ' End If - - 'Else - ' Alert("No esta asignada la funcionalidad CvePS Distruibuidor Bonificación Nota") - 'End If - - CreaObjetosVenta(2) - - If ObjFactura.CveCliente > 0 Then - If TmpDT.Rows.Count > 0 Then - Dim Retorno = ObjFactura.EmitirFactura(False) - For Each Mensaje In Retorno.Mensajes - Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion)) - Next - End If - End If - - Alert("Listo") - - CargaUsados() - - - End Sub - - - Function FolioNotaCredito(Tipo As Integer) As Boolean - - FolioNotaAcumulador = 0 - SerieNotaAcumulador = "" - Dim Respuesta As Boolean = False - - Dim ObjFolios As New ClsGralFolios() - - Dim DTSucursales As DataTable = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1).FiltraParametros("EsSucursal = True ") - - If DTSucursales.Rows.Count > 0 Then - - If ObjFolios.GetFolios("RNC", UsuarioActual.CveEmpresa) Then - Dim CveSubProyecto As Integer = DTSucursales.FiltroPrimeroValor("CveSubProyecto", "").ToEntero - Dim DT As DataTable - If CveSubProyecto > 0 Then - DT = ObjFolios.DtResultados.FiltraParametros(" Estado = 'Activo' AND LEN(Serie) > 0 AND CveSubProyecto = " & CveSubProyecto) - Else - DT = ObjFolios.DtResultados.FiltraParametros(" Estado = 'Activo' AND LEN(Serie) > 0 ") - End If - - If DT.Rows.Count > 0 Then - FolioNotaAcumulador = DT.Rows(0)("FActual").ToString.ToEntero - SerieNotaAcumulador = DT.Rows(0)("Serie").ToString - Respuesta = True - End If - - End If - End If - - ObjFolios.Dispose() - - Return Respuesta - - End Function - - Private Sub GvAcum_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAcum.RowDataBound - - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.DataKey("CveConcepto").ToEntero = 1 Then - - Dim FacturadoCargo As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoCargo")) - Dim FacturadoBonificacion As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoBonificacion")) - - If FacturadoCargo Then - e.Row.FCCheckBox("ChkCargo").Checked = False - e.Row.FCCheckBox("ChkCargo").Visible = False - Else - e.Row.FCCheckBox("ChkCargo").Checked = False - e.Row.FCCheckBox("ChkCargo").Visible = False 'True - End If - - If FacturadoBonificacion Then - e.Row.FCCheckBox("ChkBonificacion").Checked = False - e.Row.FCCheckBox("ChkBonificacion").Visible = False - Else - e.Row.FCCheckBox("ChkBonificacion").Checked = False - e.Row.FCCheckBox("ChkBonificacion").Visible = True - End If - - Else - e.Row.FCCheckBox("ChkCargo").Checked = False - e.Row.FCCheckBox("ChkCargo").Visible = False - - e.Row.FCCheckBox("ChkBonificacion").Checked = False - e.Row.FCCheckBox("ChkBonificacion").Visible = False - End If - - End If - - End Sub - - Protected Sub BtnConsultaUsados_Click(sender As Object, e As EventArgs) - CargaUsados() - End Sub - - Private Sub CargaUsados() - - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' Funcionalidad Es Distribuidor - - DivEsDistribuidor.Visible = True - TabUsados.Visible = True - - Dim ObjAcum As New ClsAcumuladores - Dim ImporteCargo As Decimal = 0D - Dim ImporteBonificacion As Decimal = 0D - - If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, TxtFechaIUsados.Text.ToDate, TxtFechaFUsados.Text.ToDate) Then - - GvAcum.DataSource = ObjAcum.DtResultados - - LblUsadosPuntos.Text = (ObjAcum.DtResultados.SUM("Puntos", " CveConcepto = 2 ") - ObjAcum.DtResultados.SUM("Puntos", " CveConcepto IN (1,3) ")).ToDecimal.FormatoNumero(2) - - ImporteCargo = ObjAcum.DtResultados.SUM("ImporteCargo", "(FacturadoCargo = 0 OR FacturadoCargo IS NULL) AND CveConcepto = 1 ").ToDecimal - ImporteBonificacion = ObjAcum.DtResultados.SUM("ImporteBonificacion", "(FacturadoBonificacion = 0 OR FacturadoBonificacion IS NULL) AND CveConcepto = 1 ").ToDecimal - - LblUsadosImpCargo.Text = ImporteCargo.FormatoNumero(2) - LblusadosImpBonificacion.Text = ImporteBonificacion.FormatoNumero(2) - - Else - GvAcum.DataSource = Nothing - - ImporteCargo = 0D - ImporteBonificacion = 0D - - LblUsadosImpCargo.Text = "" - LblusadosImpBonificacion.Text = "" - LblUsadosPuntos.Text = "" - - End If - - 'LnkFacturaUsadosCargos.Visible = If(ImporteCargo > 0, True, False) - LnkFacturaUsadosBonificacion.Visible = If(ImporteBonificacion > 0, True, False) - - ObjAcum.Dispose() - GvAcum.DataBind() - - UpAcciones.Update() - UpUsadosResumen.Update() - UpAcum.Update() - - End If - - End Sub - - Private Sub CreaDTVentas() - TmpDT = New DataTable - TmpDT.Columns.Add("CveVenta", GetType(Integer)) - TmpDT.Columns.Add("Consec", GetType(Integer)) - TmpDT.Columns.Add("Cantidad", GetType(Decimal)) - TmpDT.Columns.Add("Codigo", GetType(String)) - TmpDT.Columns.Add("CveUM", GetType(Integer)) - TmpDT.Columns.Add("UM", GetType(String)) - TmpDT.Columns.Add("SATClaveUM", GetType(String)) - TmpDT.Columns.Add("CveClasificacion", GetType(Integer)) - TmpDT.Columns.Add("Clasificacion", GetType(String)) - TmpDT.Columns.Add("CvePS", GetType(Integer)) - TmpDT.Columns.Add("PS", GetType(String)) - TmpDT.Columns.Add("CodigoPS", GetType(String)) - TmpDT.Columns.Add("SATClaveProdServ", GetType(String)) - TmpDT.Columns.Add("NoIdentificacion", GetType(String)) - TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) - TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) - TmpDT.Columns.Add("SerieLote", GetType(String)) - TmpDT.Columns.Add("CuentaPredial", GetType(String)) - TmpDT.Columns.Add("Obs", GetType(String)) - TmpDT.Columns.Add("TiempoEntrega", GetType(String)) - TmpDT.Columns.Add("PU", GetType(Decimal)) - TmpDT.Columns.Add("IVA", GetType(Decimal)) - TmpDT.Columns.Add("ImporteIVA", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal)) - TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal)) - TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal)) - TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal)) - TmpDT.Columns.Add("IEPS", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal)) - TmpDT.Columns.Add("Descuento", GetType(Decimal)) - TmpDT.Columns.Add("TipoDescuento", GetType(Integer)) - TmpDT.Columns.Add("TotalImporte", GetType(Decimal)) - TmpDT.Columns.Add("Total", GetType(Decimal)) - 'Para uso del módulo contable - TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer)) - TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer)) - TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean)) - TmpDT.Columns.Add("CveProyecto", GetType(Integer)) - TmpDT.Columns.Add("Proyecto", GetType(String)) - TmpDT.Columns.Add("CveSubProyecto", GetType(Integer)) - TmpDT.Columns.Add("SubProyecto", GetType(String)) - TmpDT.Columns.Add("CveVentaDetallePadre", GetType(Integer)) - - 'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto - TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer)) - TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer)) - 'Contratos - TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) - 'Remisiones a Facturas - TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer)) - TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer)) - TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer)) - - 'Pedido2 a Facturas - TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer)) - - TmpDT.Columns.Add("Origen", GetType(Integer)) - 'Ordenes Servicio - TmpDT.Columns.Add("CveOS", GetType(Integer)) - TmpDT.Columns.Add("CveOSDetalle", GetType(Integer)) - TmpDT.Columns.Add("SeFacturara", GetType(Integer)) - TmpDT.Columns.Add("Folio", GetType(Integer)) - TmpDT.Columns.Add("Estatus", GetType(String)) - 'Ordenamiento - TmpDT.Columns.Add("Orden", GetType(Integer)) - TmpDT.Columns.Add("TipoDocto", GetType(String)) - 'OC - TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) - TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) - - TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) - TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal)) - TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal)) - TmpDT.Columns.Add("CantidadFacturadaPed2", GetType(Decimal)) - TmpDT.Columns.Add("CantidadInventario", GetType(Decimal)) - - TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String)) - TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String)) - TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String)) - TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) - - TmpDT.Columns.Add("CveTamaño", GetType(Integer)) - TmpDT.Columns.Add("EsCargo", GetType(Boolean)) - - End Sub - Private Function AgregarProductoServicio(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, - PU As Decimal, Descuento As Decimal, - CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, - Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, - Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, - Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, - Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False, Optional PorcentajeIVA As Decimal = 0D) As Boolean - - Dim Retorno As Boolean = False - If Not CvePS > 0 Then - Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Return False - End If - - If (Obs.Length + PS.Length > 1000) Then - Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia) - Return False - End If - - - Dim Row As DataRow = Nothing - Dim TotalCalculableImpuestos As Decimal = 0 - PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos - - Row = TmpDT.NewRow() - Row("CveProyecto") = CveProyecto - Row("Proyecto") = Proyecto - Row("CveSubProyecto") = CveSubProyecto - Row("SubProyecto") = SubProyecto - Row("SerieLote") = SerieLote - Row("TiempoEntrega") = TiempoEntrega - Row("Orden") = TmpDT.Rows.Count + 1 - Row("Cantidad") = Cantidad - Row("CveUM") = CveUM - Row("UM") = UM - Row("CveClasificacion") = CveClasificacion - Row("Clasificacion") = Clasificacion - Row("CvePS") = CvePS - Row("Obs") = Obs - - - - Dim DrPS As DataRow = Nothing - - DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 - - If DrPS Is Nothing Then - Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Return False - End If - - - DrPS("IEPSPorcentaje") = 0 - - 'verifica si tiene ventaminima - If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then - 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... - If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then - Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString)) - Return False - End If - End If - - TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento - - Row("PU") = PU - Row("Codigo") = DrPS("Codigo") - Row("NoIdentificacion") = DrPS("Codigo") - Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria") - Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana") - Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion") - Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion") - Row("Consec") = TmpDT.Rows.Count + 1 - - Row("PS") = DrPS("PS") - Row("CodigoPS") = DrPS("PSCodigo").ToString - Row("CveTipoPS") = DrPS("CveTipoPS") - Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") - Row("CveTamaño") = DrPS("CveTamaño") - - If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion") - If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") - - Row("PorcentajeIVA") = PorcentajeIVA - - Row("IVA") = Row("PorcentajeIVA") - Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) - - - Row("ImporteRetIVA") = 0 - Row("ImporteRetISR") = 0 - Row("PorcentajeRetIVA") = 0 - Row("PorcentajeRetISR") = 0 - Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") - Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) - Row("IEPS") = Row("ImporteIEPS") - Row("Descuento") = Math.Round(Descuento, NumeroDecimales) - Row("TipoDescuento") = 0 - Row("Total") = (Cantidad * PU) - Row("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales) - 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas") - ' Row("IdCtaContVentas") = IdCtaContable - ' Row("AplicaParaConcepto") = AplicaParaConcepto - - Row("SATClaveProdServ") = DrPS("SATClavePS") - Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") - - - Row("EntregaDirecta") = EntregaDirecta - 'Contratos - Row("CveContratoDetalle") = CveContratoDetalle - Row("CveVentaDetalle") = CveVentaDetalle - Row("CveMovimientoDetallePedido") = CveVentaDetalle - Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle - Row("CveVentaDetalleRemision") = CveVentaDetalleRemision - Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion - Row("CveVentaDetallePedido2") = CveVentaDetallePedido2 - Row("CuentaPredial") = CuentaPredial - Row("EsCargo") = EsCargo - - 'RECARGAR GV - TmpDT.Rows.Add(Row) - TmpDT.AcceptChanges() - Retorno = True - Return Retorno - - End Function - Private Sub CreaObjetosVenta(Tipo As Integer) - - Dim SubTotal As Decimal = 0D - Dim IVA As Decimal = 0D - - For Each GvRow As GridViewRow In GvAcum.Rows - If Tipo = 1 Then - If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then - SubTotal = SubTotal + GvRow.DataKey("ImporteCargo").ToDecimal - End If - ElseIf Tipo = 2 Then - If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then - SubTotal = SubTotal + GvRow.DataKey("ImporteBonificacion").ToDecimal - End If - End If - Next - - Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Bonificación Nota - Dim CveUnidadMedida As Integer = 0 - Dim CveClasificacion As Integer = 0 - Dim UnidadMedida As String = "" - Dim Clasificacion As String = "" - Dim PS As String = "" - Dim PorcentajeIVA As Decimal = 0D - If CvePS > 0 Then - If SubTotal > 0 Then - Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0) - If Dr IsNot Nothing Then - CveUnidadMedida = Dr("CveUnidadMedida").ToString.ToEntero - CveClasificacion = Dr("CveClasificacion").ToString.ToEntero - PS = Dr("PSCodigo").ToString - UnidadMedida = Dr("UnidadMedida").ToString - Clasificacion = Dr("Clasificacion").ToString - End If - PorcentajeIVA = 0.16D - IVA = SubTotal * PorcentajeIVA - End If - End If - - TmpDT.Rows.Clear() - TmpDT.AcceptChanges() - AgregarProductoServicio(1, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "Clientes/Usados", SubTotal, 0, -1, "", DdlSubProyecto.SelectedValue.ToEntero, - DdlSubProyecto.SelectedItem.Text, PorcentajeIVA:=PorcentajeIVA) - - Dim Folio As Integer = -1 - Dim Serie As String = "" - - 'If FolioNotaCredito(Tipo) Then - ' Folio = FolioNotaAcumulador - ' Serie = SerieNotaAcumulador - 'End If - - If ObjFactura IsNot Nothing Then - ObjFactura.Dispose() - ObjFactura = Nothing - End If - - ObjFactura = New Modelos.Factura(UsuarioActual) - ObjFactura.CveUsuario = UsuarioActual.CveUsuario - ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa - ObjFactura.CveVenta = -1 - ObjFactura.Version = "3.3" - ObjFactura.TipoCambio = 1 - ObjFactura.TipoCambioDolares = 0 - ObjFactura.ConvertirPesos = False - ObjFactura.ConvertirDolares = False - ObjFactura.CveMoneda = 1 - ObjFactura.Moneda = "Pesos" - ObjFactura.MonedaSAT = "MXN" - ObjFactura.TipoDocto = "RNC" - - ObjFactura.Folio = Folio - ObjFactura.Serie = Serie - - ObjFactura.Fecha = Now - ObjFactura.CvePrePoliza = -1 - ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero - ObjFactura.MetodoPago = DdlMetodoPago.SelectedItem.Text - ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago.SelectedValue}") - ObjFactura.FechaVencimiento = TxtFechaPago.Text.ToDate - - ObjFactura.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero - ObjFactura.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero > 0, DdlMetodoPago33.SelectedItem.Text, "") - ObjFactura.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") - - ObjFactura.CveFormaPago33 = DdlFormaPago33.SelectedValue.ToEntero - ObjFactura.FormaPago33 = If(DdlFormaPago33.SelectedValue.ToEntero > 0, DdlFormaPago33.SelectedItem.Text, "") - ObjFactura.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {DdlFormaPago33.SelectedValue}") - - ObjFactura.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero - ObjFactura.UsoCFDI = If(DdlUsoCFDI.SelectedValue.ToEntero > 0, DdlUsoCFDI.SelectedItem.Text, "") - ObjFactura.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") - - ObjFactura.UsuarioCreo = UsuarioActual.Nombre - ObjFactura.CveCondicionEntrega = -1 - ObjFactura.CondicionEntrega = "" - - ObjFactura.CondicionesPago = 0 ' 0 - Contado, 1 - Credito, 2 - termianl - ObjFactura.FormaPago = 0 - - ObjFactura.AtnA = "" - ObjFactura.FordGSDB = "" - - ObjFactura.NumeroContrato = "" - ObjFactura.DescripcionContrato = "" - ObjFactura.NumeroDescripcionContrato = "" - ObjFactura.PedidoContrato = "" - ObjFactura.OrdenCompra = "" - - Select Case ObjFactura.TipoDocto - Case "Ing" - ObjFactura.TipoDocumento = "Factura" - Case "Rem" - ObjFactura.TipoDocumento = "Remision" - Case "Cot" - ObjFactura.TipoDocumento = "Cotizacion" - Case "Egs" - ObjFactura.TipoDocumento = "Nota de Crédito" - Case "Dev" - ObjFactura.TipoDocumento = "Nota de Devolución" - Case "DPe" - ObjFactura.TipoDocumento = "Devolución de pedido" - Case "PeC" - ObjFactura.TipoDocumento = "Consignación de Pedido" - Case Else - ObjFactura.TipoDocumento = "" - End Select - - ObjFactura.Fech1 = Now - ObjFactura.Fech2 = Now - ObjFactura.Fech3 = Now - - ObjFactura.Alfa1 = "" - ObjFactura.Alfa2 = "" - ObjFactura.Alfa3 = "" - - ObjFactura.Num1 = 0 - ObjFactura.Num2 = 0 - - ObjFactura.Num3 = 0 - ObjFactura.FechaPago = Now - - ObjFactura.CveCorte = -1 - ObjFactura.CveMesa = -1 - ObjFactura.NumeroPersonas = 0 - ObjFactura.CveContrato = -1 - - ObjFactura.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero - ObjFactura.Entrega = "" - ObjFactura.Vigencia = Now - - ObjFactura.CveVentaPadre = -1 - - ObjFactura.CveVendedor = DdlVendedor.SelectedValue.ToEntero - If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then - DdlVendedor.Enabled = False - End If - - ObjFactura.FechaEjecucion = Now - ObjFactura.CveSubProyecto = UsuarioActual.CveSubProyecto - ObjFactura.CveSubProyectoCobranza = UsuarioActual.CveSubProyecto - ObjFactura.CveSubProyectoEjecucion = UsuarioActual.CveSubProyecto - ObjFactura.AtencionA = "-1" - ObjFactura.MotivoDescuento = "" - ObjFactura.Observaciones = "" - ObjFactura.Det_OrdenCompra = "" - ObjFactura.Det_FechaOrdenCompra = "" - ObjFactura.MonedaAbreviatura = "" - - ObjFactura.SubTotal = SubTotal - ObjFactura.Descuento = 0 - ObjFactura.Amortizacion = 0 - ObjFactura.IVA = IVA - ObjFactura.RetIVA = 0 - ObjFactura.RetISR = 0 - ObjFactura.IEPS = 0 - ObjFactura.Total = SubTotal + IVA - ObjFactura.DtDetalle = TmpDT - ObjFactura.DtPagos = DtPagos - ObjFactura.DtPromociones = DtPromociones - - '' CLIENTE - ObjFactura.CveCliente = CveCliente - ObjFactura.SetCliente() - - ''SUCURSAL - - ObjFactura.SetSubProyectoMatriz(Me) - ObjFactura.SetSubProyecto(Me) - ObjFactura.ClienteSucursal = New Modelos.SucursalModel - - If ObjFactura.Timbre.Comprobante.TipoComprobante = "E" Then - If ObjFactura.TipoDocumento.Contiene("Nota de Crédito") Then - ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "01" - ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" - End If - If ObjFactura.TipoDocumento.Contiene("Nota de Devolución") Then - ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "03" - ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" - End If - - End If - - If ObjFactura.TipoDocto.Contiene("Egs", "RNC") Then - ObjFactura.CveTipoRelacion = -1 - End If - - Dim UsadosBonificacion As List(Of Integer) = New List(Of Integer) - For Each GvRow As GridViewRow In GvAcum.Rows - Dim CveMovto As Integer = GvRow.DataKey("CveMovto").ToEntero - If (Tipo = 1 And GvRow.FCCheckBox("ChkCargo").Checked) Or (Tipo = 2 And GvRow.FCCheckBox("ChkBonificacion").Checked) Then - UsadosBonificacion.Add(CveMovto) - End If - Next - - ObjFactura.UsadosBonificacion = UsadosBonificacion - ObjFactura.TipoBonificacion = Tipo - - Dim FM As New Modelos.FemsaFactura - Dim TmpDT7Eleven As New DataTable - Dim TmpDTComplementosTimbrado As New DataTable - - 'PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) - - ObjFactura.FemsaFactura = FM - - ' ObjFactura.Timbre = PreParaTimbre(ObjFactura) - - End Sub - - 'Private Sub PrepararTimbrado(ByRef FM As Modelos.FemsaFactura, ByRef TmpDT7Eleven As DataTable, ByRef TmpDTComplementosTimbrado As DataTable) - ' FM.AplicaFEMSA = ChkAplicaFEMSA.Checked - ' FM.FEMSA_NumSociedad = "" - ' FM.FEMSA_NumProveedor = "" - ' FM.FEMSA_Mail = "" - ' FM.FEMSA_Version = "".ToEntero - ' FM.FEMSA_NumPedido = "".ToEntero - ' FM.FEMSA_NumEntrada = "" - ' FM.FEMSA_NumRemision = "" - ' FM.FEMSA_NumSocio = "" - ' FM.FEMSA_CentroCosto = "" - ' FM.FEMSA_IPeriodoLiquidacion = "" - ' FM.FEMSA_FPeriodoLiquidacion = "" - ' FM.FEMSA_CodRetencion1 = "" - ' FM.FEMSA_CodRetencion2 = "" - - ' TmpDT7Eleven.Columns.Add("sevenElevenNumProveedor") - ' TmpDT7Eleven.Columns.Add("sevenElevenFolio") - ' TmpDT7Eleven.Columns.Add("sevenElevenTienda") - ' TmpDT7Eleven.Columns.Add("sevenElevenFecha") - - ' Dim Row As DataRow = TmpDT7Eleven.NewRow - ' Row("sevenElevenNumProveedor") = "" - ' Row("sevenElevenFolio") = "" - ' Row("sevenElevenTienda") = "" - ' Row("sevenElevenFecha") = "" - - ' TmpDT7Eleven.Rows.Add(Row) - - ' TmpDTComplementosTimbrado.Columns.Add("CveComplemento") - ' TmpDTComplementosTimbrado.Columns.Add("IdContabilidad") - ' TmpDTComplementosTimbrado.Columns.Add("TipoProceso") - ' TmpDTComplementosTimbrado.Columns.Add("TipoAmbito") - ' TmpDTComplementosTimbrado.Columns.Add("Entidad") - - ' Dim Row2 As DataRow = TmpDTComplementosTimbrado.NewRow - ' Row2("CveComplemento") = -1 - ' Row2("IdContabilidad") = -1 - ' Row2("TipoProceso") = -1 - ' Row2("TipoAmbito") = -1 - ' Row2("Entidad") = -1 - - ' TmpDTComplementosTimbrado.Rows.Add(Row2) - 'End Sub - - 'Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre - ' Dim Timbre As New CFDITimbre - ' Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) - ' Timbre.Comprobante.Folio = Obj.Folio.ToString - ' Timbre.Comprobante.Serie = Obj.Serie - ' Timbre.Comprobante.Fecha = Obj.FechaCP - ' Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 - ' Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 - ' Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT - ' Timbre.Comprobante.Subtotal = Obj.SubTotal - ' Timbre.Comprobante.Descuentos = Obj.Descuento - ' Timbre.Comprobante.Moneda = Obj.MonedaSAT - ' Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) - ' Timbre.Comprobante.Total = Obj.Total - - ' Try - ' Obj.SetSubProyecto(Me) - ' Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP - ' Catch ex As Exception - - ' End Try - - ' Timbre.Comprobante.Confirmacion = "" - - ' Timbre.Receptor.RFC = Obj.Cliente.RFC - ' Timbre.Receptor.Nombre = Obj.Cliente.Nombre - ' Timbre.Receptor.ResidenciaFiscal = "" - ' Timbre.Receptor.NumeroRegistroTributario = "" - ' Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI - - - ' If Obj.CveTipoRelacion > 0 Then - ' Select Case Obj.CveTipoRelacion - ' Case 1 - ' Timbre.CFDIRelacionados.TipoRelacion = "01" - ' Timbre.CFDIRelacionados.TipoRelacionTexto = "01-Nota de Crédito aplicada a Ingreso" - ' Case 2 - ' Timbre.CFDIRelacionados.TipoRelacion = "02" - ' Timbre.CFDIRelacionados.TipoRelacionTexto = "02-Nota de débito de los documentos relacionados" - ' Case 3 - ' Timbre.CFDIRelacionados.TipoRelacion = "03" - ' Timbre.CFDIRelacionados.TipoRelacionTexto = "03-Devolución aplicada a Ingreso" - ' Case 4 - ' Timbre.CFDIRelacionados.TipoRelacion = "04" - ' Timbre.CFDIRelacionados.TipoRelacionTexto = "04-Refacturación de Ingreso" - ' Case 7 - ' Timbre.CFDIRelacionados.TipoRelacion = "07" - ' Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo" - ' Case 8 - ' Timbre.CFDIRelacionados.TipoRelacion = "08" - ' Timbre.CFDIRelacionados.TipoRelacionTexto = "08-Factura generada por pagos en parcialidades " - ' Case 9 - ' Timbre.CFDIRelacionados.TipoRelacion = "09" - ' Timbre.CFDIRelacionados.TipoRelacionTexto = "09-Factura generada por pagos diferidos" - - ' End Select - ' End If - - ' Dim totSubTotal As Decimal = Obj.SubTotal - ' Dim totIVA As Decimal = Obj.IVA - ' Dim totRetIVA As Decimal = Obj.RetIVA - ' Dim totRetISR As Decimal = Obj.RetISR - ' Dim TasaRetIVA As Decimal = 0 - ' Dim TasaRetISR As Decimal = 0 - ' Dim i As Integer = 1 - - ' 'detalles - ' Dim tPS As String = "" - - ' For Each drr As DataRow In Obj.DtDetalle.Rows - ' If drr("PS").ToString.Length = 1 Then - ' tPS = drr("Obs").ToString - ' Else - ' If drr("PS").ToString.Length = 0 Then - ' tPS = "" - ' Else - ' tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) - ' End If - ' End If - ' 'condicionante, especial - ' If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" ' les comentan que no debe de ir la etiqueta de "unidad" en el producto - - ' Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal, - ' .Descripcion = tPS, - ' .ValorUnitario = drr("PU").ToString.ToDecimal, - ' .Importe = drr("TotalImporte").ToString.ToDecimal, - ' .Descuento = drr("Descuento").ToString.ToDecimal, - ' .Unidad = drr("UM").ToString, - ' .ClaveUnidad = drr("SATClaveUM").ToString, - ' .ClaveProdServ = drr("SATClaveProdServ").ToString, - ' .Noidentificacion = drr("Noidentificacion").ToString, - ' .CuentaPredial = drr("CuentaPredial").ToString} - ' 'verifica suma subtotales - ' If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales - ' concepto.Importe = totSubTotal - ' End If - ' totSubTotal = totSubTotal - concepto.Importe - - ' 'siempre estaremos agregando el iva, auqnue sea en importe cero o tasa cero, para que se emita la factura - ' ' If drr("ImporteIVA").ToString.ToDouble > 0 Then - - ' 'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos - ' If Timbre.Comprobante.Total > 0 Then - ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) - ' End If - - ' If drr("ImporteIEPS").ToString.ToDouble > 0 Then - ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal}) - ' End If - - ' If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones - ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetIVA, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal}) - ' End If - - ' If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR - ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetISR, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal}) - ' End If - - ' Timbre.Conceptos.Add(concepto) - ' i += 1 - ' Next - - ' Return Timbre - 'End Function - - 'Private Function GenerarNotaCredito(CvePS As Integer, Tipo As Integer, CveUnidadMedida As Integer, Importe As Decimal, Iva As Decimal, Descripcion As String, CveClasificacion As Integer) As Boolean - - ' Dim Respuesta As Boolean = False - - ' Dim ObjVentas As New ClsVentas - ' Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) - ' Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL()) - - ' Dim ErrorVentas As Boolean = False - ' Dim SubTotal As Decimal = Importe - ' Dim Total As Decimal = Importe + Iva - - ' Dim RetIVA As Decimal = 0 - ' Dim RetISR As Decimal = 0 - ' Dim TipoCambio As Decimal = 0 - ' Dim FechaVencimiento As Date = Now - ' Dim fecha As Date = Now - - ' Dim Folio As Integer = 0 - ' Dim Serie As String = "" - - ' If FolioNotaCredito() Then - ' Folio = FolioNotaAcumulador - ' Serie = SerieNotaAcumulador - ' End If - - ' Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero - - ' Dim CveVenta As Integer - - ' If Folio > 0 Then - - ' Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas($"Clientes/{Descripcion}", 1, Total, Total, 1, fecha, "Nota de crédito por Cargo", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - ' If ObjVentas.AddVenta("Egs", Folio, CveCliente.ToEntero, -1, SubTotal, 0, 0, Iva, RetIVA, RetISR, Total, 1, TipoCambio, - ' 0, 0, 0, FechaVencimiento, fecha, "", "", fecha, -1, "", "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, -1, 0, CvePrePoliza, - ' UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Serie:=Serie, CveSubProyecto:=CveSubProyecto, CveSubProyectoEjecucion:=CveSubProyecto) Then - - ' CveVenta = ObjVentas.CveVenta - - ' If CveVenta > 0 Then - ' If ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, 0.16, SubTotal * 0.16, Descripcion, 0, 0, -1, 0) Then - - ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, Folio.ToString, 150, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, ImporteMX:=SubTotal, CveSubProyecto:=CveSubProyecto) Then - ' ErrorVentas = True - ' End If - ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio.ToString, 12, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total) Then - ' ErrorVentas = True - ' End If - ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Iva, Folio.ToString, 13, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Iva) Then - ' ErrorVentas = True - ' End If - - ' If Not ErrorVentas Then - ' For Each GvRow As GridViewRow In GvAcum.Rows - ' Dim CveMovto As Integer = GvRow.DataKey("CveMovto").ToEntero - - ' If (Tipo = 1 And GvRow.FCCheckBox("ChkCargo").Checked) Or (Tipo = 2 And GvRow.FCCheckBox("ChkBonificacion").Checked) Then - - ' If ObjAcum.DistribuidorActualizarFacturados(CveMovto, UsuarioActual.CveEmpresa, Tipo, CveVenta) Then - ' Respuesta = True - ' ErrorVentas = False - ' CveVentaNota = CveVenta - ' Else - ' Respuesta = False - ' ErrorVentas = True - ' CveVentaNota = 0 - ' Exit For - ' End If - - ' End If - ' Next - ' End If - - - ' If Not ErrorVentas Then - ' Alert($"Nota de crédito generada correctamente {Serie}-{Folio}") - ' End If - - - ' Else - ' ErrorVentas = True - ' End If - ' Else - ' ErrorVentas = True - ' End If - - ' Else - ' ErrorVentas = True - ' End If - ' Else - ' Alert("No se pudo obtener el Folio.", TipoMensaje.MsgError) - ' End If - - - - ' If ErrorVentas Then - ' ObjVentas.RollBack() - ' Else - - ' ObjVentas.Commit() - ' CargaUsados() - - ' 'Dim DtDetallesVenta As New DataTable - - ' 'If ObjVentas.GetVentaDetalle(CveVenta) Then - - ' ' DtDetallesVenta = ObjVentas.DtResultados - ' ' 'CreaObjetosVenta(CveVenta, Serie, Folio, SubTotal, Iva, DtDetallesVenta) - - ' ' ObjFactura.Timbre = PreParaTimbre(ObjFactura, ObjFactura.CveSubProyecto) - - ' ' Dim ObjTimbrado As New Timbrado - ' ' Dim SeTimbro As Boolean = False - - ' ' SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) - - ' ' If SeTimbro Then - ' ' Alert("Se timbro correctamente") - ' ' Else - ' ' Alert("No se pudo timbrar, intente mas tarde.", TipoMensaje.MsgError) - ' ' End If - - ' 'Else - ' ' Alert("No se pudo timbrar, no se pudieron obtener los detalles de la venta.", TipoMensaje.MsgError) - ' 'End If - - ' End If - - - - ' ObjVentas.Dispose() - ' Return Respuesta - - 'End Function - 'Private Function generaNC(CveVenta As Integer, ByRef ObjVentas As ClsVentas, ByVal factura As Modelos.Factura) As List(Of Object) - - ' Dim Obj As New List(Of Object) - ' Dim CveVentaNueva As Integer = ObjVentas.CveVenta - ' Dim BanderaGeneraNC As Boolean = False - ' If UsuarioActual.CveEmpresa.Contiene(1, 119) Then BanderaGeneraNC = True - - ' If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then - ' If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - ' Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) - ' Dim TmpDTconceptos As DataTable = Nothing - - ' ''CargaCliente - - ' Dim CveCliente As Integer = drv("CveCliente").ToString.ToEntero - ' If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then - ' Return Nothing - ' ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then - ' Return Nothing - ' End If - ' factura.TipoDocto = drv("TipoDocto").ToString - ' factura.Serie = drv("Serie").ToString - ' factura.FechaEjecucion = drv("FechaEjecucion").ToString.ToDateTime - ' factura.Fecha = drv("Fecha").ToString.ToDateTime - ' factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString.ToEntero - ' factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString.ToEntero - ' factura.CveClienteSucursal = drv("CveClienteSucursal").ToString.ToEntero - ' factura.CveSubProyecto = drv("CveSubProyecto").ToString.ToEntero - - - ' ''CargaDetalle - ' If ObjVentas.GetVentaDetalle(CveVenta) Then - ' TmpDTconceptos = ObjVentas.DtResultados - ' TmpDTconceptos.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) - ' GvPS.DataSource = TmpDTconceptos - ' GvPS.DataBind() - ' End If - - ' '' Carga Totales - ' factura.SubTotal = drv("SubTotal").ToString.ToDecimal - ' factura.Descuento = drv("Descuento").ToString.ToDecimal - ' factura.Amortizacion = drv("Amortizacion").ToString.ToDecimal - ' factura.IVA = drv("IVA").ToString.ToDecimal - ' factura.RetIVA = drv("RetIVA").ToString.ToDecimal - ' factura.RetISR = drv("RetISR").ToString.ToDecimal - ' factura.Total = drv("Total").ToString.ToDecimal - ' factura.MotivoDescuento = drv("MotivoDescuento").ToString - ' factura.Observaciones = drv("Observaciones").ToString - ' factura.CveMoneda = drv("CveMoneda").ToString.ToEntero - ' factura.TipoCambio = drv("TipoCambio").ToString.ToDecimal - ' factura.CveVendedor = drv("CveVendedor").ToString.ToEntero - ' factura.RefDocto = drv("Ref").ToString - - ' If factura.CveCliente > 0 Then - ' If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then - - ' If Not drv("Total").ToString.ToDecimal = factura.Total Then - ' Return Nothing - ' End If - - - - ' End If - ' End If - ' End If - ' End If - - ' If Obj.Count > 0 Then - ' Return Obj - ' Else - ' Return Nothing - ' End If - - 'End Function - - 'Private Function PreParaTimbre(Obj As Modelos.Factura, CveSubProyecto As Integer) As CFDITimbre - - ' Dim Timbre As New CFDITimbre - ' Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) - ' Timbre.Comprobante.Folio = Obj.Folio.ToString - ' Timbre.Comprobante.Serie = Obj.Serie - ' Timbre.Comprobante.Fecha = Obj.Fecha - ' Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 - ' Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 - ' Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT - ' Timbre.Comprobante.Subtotal = Obj.SubTotal - - ' Timbre.Comprobante.Descuentos = Obj.Descuento - ' Timbre.Comprobante.Moneda = Obj.MonedaSAT - ' Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) - ' Timbre.Comprobante.Total = Obj.Total - - ' Try - ' Obj.SetSubProyecto(Me) - ' Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP - ' Catch ex As Exception - - ' End Try - - ' Timbre.Comprobante.Confirmacion = "" - - ' Timbre.Receptor.RFC = TxtRFC.Text - ' Timbre.Receptor.Nombre = TxtNombre.Text - ' Timbre.Receptor.ResidenciaFiscal = "" - ' Timbre.Receptor.NumeroRegistroTributario = "" - ' Timbre.Receptor.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") - - ' Dim totSubTotal As Decimal = Obj.SubTotal - ' Dim totIVA As Decimal = Obj.IVA - ' Dim totRetIVA As Decimal = Obj.RetIVA - ' Dim totRetISR As Decimal = Obj.RetISR - ' Dim TasaRetIVA As Decimal = 0 - ' Dim TasaRetISR As Decimal = 0 - ' Dim i As Integer = 1 - - ' ''detalles - ' Dim tPS As String = "" - - ' For Each drr As DataRow In Obj.DtDetalle.Rows - ' If drr("PS").ToString.Length = 1 Then - ' tPS = drr("Obs").ToString - ' Else - ' If drr("PS").ToString.Length = 0 Then - ' tPS = "" - ' Else - ' tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) - ' End If - ' End If - ' '' condicionante, especial - ' If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" ' les comentan que no debe de ir la etiqueta de "unidad" en el producto - - ' Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal, - ' .Descripcion = tPS, - ' .ValorUnitario = drr("PU").ToString.ToDecimal, - ' .Importe = drr("TotalImporte").ToString.ToDecimal, - ' .Descuento = drr("Descuento").ToString.ToDecimal, - ' .Unidad = drr("UM").ToString, - ' .ClaveUnidad = drr("SATClaveUM").ToString, - ' .ClaveProdServ = drr("SATClaveProdServ").ToString, - ' .Noidentificacion = drr("Noidentificacion").ToString, - ' .CuentaPredial = drr("CuentaPredial").ToString} - ' '' verifica suma subtotales - ' If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales - ' concepto.Importe = totSubTotal - ' End If - ' totSubTotal = totSubTotal - concepto.Importe - - ' ''siempre estaremos agregando el iva, auqnue sea en importe cero o tasa cero, para que se emita la factura - ' If drr("ImporteIVA").ToString.ToDouble > 0 Then - ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) - ' End If - - ' If drr("ImporteIEPS").ToString.ToDouble > 0 Then - ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal}) - ' End If - - ' If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones - ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetIVA, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal}) - ' End If - - ' If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR - ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetISR, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal}) - ' End If - - ' Timbre.Conceptos.Add(concepto) - ' i += 1 - ' Next - - ' Dim AplicaComercioExteriorSubProyecto As Boolean = If(GlobalDTSubProyectos(-1, Obj.CveSubProyecto)(0)("AplicaComercioExterior").ToString = "True", True, False) - ' Timbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto = AplicaComercioExteriorSubProyecto - - ' If Obj.Cliente.AplicaComercioExterior And AplicaComercioExteriorSubProyecto Then - - ' Timbre.Receptor.ResidenciaFiscal = Obj.Cliente.ClaveSATPais - ' Timbre.Receptor.NumeroRegistroTributario = Obj.Cliente.NumRegIdTrib - - ' End If - - ' Return Timbre - 'End Function - -#End Region - -#Region "C L I E N T E S G R I D S I M P R I M I R P D F/Excel" - Private Sub LnkCotizacionesPDF_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesPDF.Click - ImprimeGridsProveedores("PDF", DtCotizaciones, "RepClientesCotizaciones") - End Sub - Private Sub LnkCotizacionesExcel_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesExcel.Click - ImprimeGridsProveedores("Excel", DtCotizaciones, "RepClientesCotizaciones") - End Sub - - Private Sub LnkCxCActivasPDF_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasPDF.Click - ImprimeGridsProveedores("PDF", DtCxCActivas, "RepClientesCxCActivas") - End Sub - Private Sub LnkCxCActivasExcel_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasExcel.Click - ImprimeGridsProveedores("Excel", DtCxCActivas, "RepClientesCxCActivas") - End Sub - - Private Sub LnkHistorialCxCPDF_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCPDF.Click - ImprimeGridsProveedores("PDF", DtHistorialCxC, "RepClientesHistorialCxC") - End Sub - Private Sub LnkHistorialCxCExcel_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCExcel.Click - ImprimeGridsProveedores("Excel", DtHistorialCxC, "RepClientesHistorialCxC") - End Sub - - Private Sub LnkAnticipoClientePDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClientePDF.Click - ImprimeGridsProveedores("PDF", DtClientesAnticipo, "RepClientesAnticipos") - End Sub - Private Sub LnkAnticipoClienteExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClienteExcel.Click - ImprimeGridsProveedores("Excel", DtClientesAnticipo, "RepClientesAnticipos") - End Sub - - Private Sub LnkAnticipoHistorialPDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialPDF.Click - ImprimeGridsProveedores("PDF", DtAnticipoHistorial, "RepClientesAnticipoHistorial") - End Sub - Private Sub LnkAnticipoHistorialExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialExcel.Click - ImprimeGridsProveedores("Excel", DtAnticipoHistorial, "RepClientesAnticipoHistorial") - End Sub - - Private Sub LnkCuentasBancariasPDF_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasPDF.Click - ImprimeGridsProveedores("PDF", DTCuentasBancos, "RepClientesCuentasBancarias") - End Sub - Private Sub LnkCuentasBancariasExcel_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasExcel.Click - ImprimeGridsProveedores("Excel", DTCuentasBancos, "RepClientesCuentasBancarias") - End Sub - - Private Sub ImprimeGridsProveedores(Formato As String, DtTemp As DataTable, NombreFormato As String) - If DtTemp IsNot Nothing And DtTemp.Rows.Count > 0 Then - Dim params As New List(Of ReportParameter) - - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = 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("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("AgrupadoPor", "Cliente: " & LtlCliente.Text)) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - ImprimirPDF("Empresas\Grales\Formatos\" & NombreFormato & ".rdlc", DtTemp, params, NombreFormato & "_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato) - Else - Alert("No se encontró información.", TipoMensaje.MsgAdvertencia) - End If - End Sub - - Private Sub LnkUsadosReset_Click(sender As Object, e As EventArgs) Handles LnkUsadosReset.Click - - Dim Acum As New ClsAcumuladores - Dim Puntos As Decimal = -LblUsadosPuntos.Text.ToDecimal - If Acum.DistribuidorMovtosAdd(CveCliente, 1, 1, 3, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Puntos, "Saldo Inicializado") Then - Alert("Puntuación Inicializada") - End If - Acum.Dispose() - - End Sub -#End Region - Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs) - If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then - TxtRetIVA.Text = "0" - DivRetIVA.Visible = False - - If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then - TxtRetIVA.Text = "10" - DivRetIVA.Visible = True - ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then - TxtRetIVA.Text = "4" - DivRetIVA.Visible = True - ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") Then - TxtRetIVA.Text = "6" - DivRetIVA.Visible = True - End If - - End If - End Sub -End Class - +#End Region + +#Region "COMERCIO EXTERIOR" + Public Sub CargaCombosComercioExterior() + + DdlTipoOperacion.Items.Clear() + DdlTipoOperacion.DataSource = GlobalDTTipoOperacion() + DdlTipoOperacion.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlTipoOperacion.DataBind() + + DdlIncoterm.Items.Clear() + DdlIncoterm.DataSource = GlobalDTIncoterm() + DdlIncoterm.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlIncoterm.DataBind() + + DdlClavePedimento.Items.Clear() + DdlClavePedimento.DataSource = GlobalDTClavePedimento() + DdlClavePedimento.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlClavePedimento.DataBind() + + DdlMotivoTraslado.Items.Clear() + DdlMotivoTraslado.DataSource = GlobalDTSATMotivoTraslado() + DdlMotivoTraslado.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlMotivoTraslado.DataBind() + + CargaPais() + CargaEstado() + CargaMunicipio() + CargaColonia() + + End Sub + + + Private Sub CargaPais() + DdlPais.Items.Clear() + DdlPais.DataSource = GlobalDTPais() + DdlPais.DataBind() + DdlPais.SelectedValueExist("151") + End Sub + + Private Sub CargaEstado() + DdlEstado.Items.Clear() + If DdlPais.SelectedValue.ToEntero > 0 Then + DdlEstado.DataSource = GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString) + End If + DdlEstado.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlEstado.DataBind() + End Sub + + Private Sub CargaMunicipio() + DdlMunicipio.Items.Clear() + If DdlEstado.SelectedValue.ToEntero > 0 Then + DdlMunicipio.DataSource = GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString) + End If + DdlMunicipio.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlMunicipio.DataBind() + End Sub + + Private Sub CargaColonia() + DdlColonia.Items.Clear() + If DdlMunicipio.SelectedValue.ToEntero > 0 Then + DdlColonia.DataSource = GlobalDTColonia(GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString).FiltraParametros($"CveMunicipio = {DdlMunicipio.SelectedValue.ToEntero}")(0)("ClaveSATMunicipio").ToString) + End If + DdlColonia.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlColonia.DataBind() + End Sub + + Protected Sub DdlPais_SelectedIndexChanged(sender As Object, e As EventArgs) + 'si contiene MX, USA o CANADA carga ddls, si no carga txt + CargaEstado() + + If DdlPais.SelectedValue.Contiene("151", "66", "40") Then + DdlEstado.Visible = True + DdlMunicipio.Visible = True + DdlColonia.Visible = True + + TxtComExtEstado.Visible = False + TxtComExtMunicipio.Visible = False + TxtComExtColonia.Visible = False + + TxtComExtEstado.Text = "" + TxtComExtMunicipio.Text = "" + TxtComExtColonia.Text = "" + + If DdlPais.SelectedValue.Contiene("66", "40") Then + DdlMunicipio.Visible = False + DdlColonia.Visible = False + + DdlMunicipio.SelectedValue = "-1" + DdlColonia.SelectedValue = "-1" + + TxtComExtMunicipio.Visible = True + TxtComExtColonia.Visible = True + End If + + Else + 'Limpia los DDLs + CargaMunicipio() + CargaColonia() + + DdlEstado.Visible = False + DdlMunicipio.Visible = False + DdlColonia.Visible = False + + TxtComExtEstado.Visible = True + TxtComExtMunicipio.Visible = True + TxtComExtColonia.Visible = True + End If + End Sub + Protected Sub DdlEstado_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaMunicipio() + CargaColonia() + End Sub + Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaColonia() + End Sub + +#End Region + +#Region "D O C U M E N T A C I O N " + + Private Sub CargaDocumentacionCliente() + Dim objRH As New ClsEdocumentacion() + + If objRH.DocumentacionElectronicaGet(-1, If(CveCliente = -1, 0, CveCliente), -1, UsuarioActual.Empresa.CveEmpresa, -1, Modulo:=2) Then + DTDocumentacion = objRH.DtResultados + GvDocumentosCliente.DataSource = objRH.DtResultados + End If + objRH.Dispose() + 'If DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ").Rows.Count > 0 Then + ' GvDocumentosCliente.DataSource = DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ") + 'Else + ' GvDocumentosCliente.DataSource = Nothing + 'End If + GvDocumentosCliente.DataBind() + + UPGvDocumentosCliente.Update() + 'UpGvDocumentosFirma2.Update() + End Sub + Public Sub UploadModal_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim chkEstatus As CheckBox + CveDocumentacionElectronica = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero + CveDocumentacion = GvRow.DataKey("CveDocumentacion").ToString.ToEntero + Documentacion = GvRow.DataKey("Documentacion") + AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString + + chkEstatus = GvRow.FCCheckBox("chkEstatus") + + + + ObservacionDocumentacion = GvRow.FCTextBox("TxtObservaciones").Text.Trim.ToUpper + FechaLimite = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + AdjuntoDocumentacion = GvRow.DataKey("Adjunto") + + LtlTitulofirmaContrato.Text = "Subir " & Documentacion + + UpTituloFirma.Update() + + RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal({ backdrop: 'static', keyboard: false});") + End Sub + Private Sub GuardarDocumentosClientes(Optional _CveDocumentacionExcluir As Integer = -1) + + Dim hasError As Boolean = True + Dim objDocumentos As New ClsEdocumentacion + + For Each dRow As GridViewRow In GvDocumentosCliente.Rows + + Dim _CveDocumentacion As Integer = dRow.DataKey("CveDocumentacion").ToString.ToEntero + Dim _Adjunto As String = dRow.DataKey("Adjunto") + 'Dim _Documentacion As String = dRow.DataKey("Documentacion") + Dim _CveDocumentacionElectronica As Integer = dRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero + Dim _txtObservaciones As TextBox = dRow.FCTextBox("TxtObservaciones") + Dim _TxtFechaLimite As TextBox = dRow.FCTextBox("TxtFechaLimite") + Dim _TxtFechaVigencia As TextBox = dRow.FCTextBox("TxtFechaVigencia") + Dim chkEstatus As CheckBox = dRow.FCCheckBox("chkEstatus") + Dim _estatus As Integer + + _estatus = If(dRow.FCCheckBox("chkEstatus").Checked, 1, 0) + + Dim _FechaVigencia As Date + Dim _FechaLimite As Date + + Dim DiasLimite As Integer = dRow.DataKey("DiasLimite").ToString.ToEntero + Dim AplicaDiasLimite As Boolean = If(dRow.DataKey("AplicaDiasLimite").ToString = "1", True, False) + Dim AplicaFechaVencimiento As Boolean = If(dRow.DataKey("AplicaFechaVencimiento").ToString = "1", True, False) + + If _TxtFechaVigencia.Text.Length = 10 Then + _FechaVigencia = _TxtFechaVigencia.Text.ToDate + Else + _FechaVigencia = Nothing + End If + + If Not AplicaDiasLimite Then + _FechaLimite = MinFecha + Else + _FechaLimite = _TxtFechaLimite.Text.ToDate + End If + + If Not AplicaFechaVencimiento Then + _FechaVigencia = MinFecha + End If + + + If Not _CveDocumentacionExcluir = _CveDocumentacion Then + Try + If _CveDocumentacionElectronica = -1 Then + + If objDocumentos.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) > 0 Then + Else + hasError = True + Exit For + End If + + Else + If objDocumentos.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) Then + Else + hasError = True + Exit For + End If + End If + + + hasError = False + Catch ex As Exception + hasError = True + Exit For + End Try + End If + Next + + 'refrescar grid datos investigacion + CargaDocumentacionCliente() + End Sub + + Protected Sub chkEstatus_CheckedChanged(sender As Object, e As EventArgs) + GuardarDocumentosClientes() + End Sub + + Protected Sub TxtObservaciones_TextChanged(sender As Object, e As EventArgs) + GuardarDocumentosClientes() + End Sub + Protected Sub BtnModalFirmaContratoDocumentoUpload_Click(sender As Object, e As EventArgs) Handles BtnModalFirmaContratoDocumentoUpload.Click + + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = TxtFileFirmaContrato.getfiles().Archivos + Dim Filename As String = "" + + + For Each fileItem As Archivo In Filesgral + Try + + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Dim tempArray() As String + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + + Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "\" & Documentacion & "." & FileExtension + Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\" & AdjuntoDocumentacion + + If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\") Then + System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\") + End If + + If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then + File.Delete(rutaAdjuntoAnterior) + End If + + If System.IO.File.Exists(rutaDestino) Then + System.IO.File.Delete(rutaDestino) + End If + + System.IO.File.Move(fileItem.FileUrl, rutaDestino) + + Dim objRH As New ClsEdocumentacion + + + If CveDocumentacionElectronica = -1 Then + If objRH.DocumentacionElectronicaAdd(CveDocumentacion, -1, CveCliente, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) > 0 Then + + End If + Else + If objRH.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, CveCliente, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) Then + + End If + End If + + objRH.Dispose() + + GuardarDocumentosClientes(CveDocumentacion) + CargaDocumentacionCliente() + + + TxtFileFirmaContrato.Text = "" + UpModalFirmaContratoDocumento.Update() + + Catch ex As Exception + OnError("Error al cargar archivo", ex) + End Try + + Next + RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal('hide')", "hidemodal7") + + End Sub + + Public Sub Update_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim activo As Boolean = False + + Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero + Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero + Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString + Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + Dim obserbaciones As String = DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text + 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) + Dim chkCompleto As CheckBox = DirectCast(GvRow.FindControl("chkEstatus"), CheckBox) + + If chkCompleto.Checked Then + Estatus = 1 + Else + Estatus = 0 + End If + + Dim ObjEdoc As New ClsEdocumentacion + + If Not _CveDocumentacionElectronica = -1 Then + If ObjEdoc.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) Then + Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) + End If + Else + If ObjEdoc.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) > 0 Then + Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) + End If + End If + + CargaDocumentacionCliente() + ObjEdoc.Dispose() + + End Sub + + + Public Sub Update_ClickDocumentacionRemove(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim activo As Boolean = False + + Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero + Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero + Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString + Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + Dim obserbaciones As String = DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text + 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) + Dim chkCompleto As CheckBox = DirectCast(GvRow.FindControl("chkEstatus"), CheckBox) + + Dim UrlArchivo = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "/" & _Adjunto + + If File.Exists(UrlArchivo) Then + Try + File.Delete(UrlArchivo) + Catch ex As Exception + End Try + + End If + + Dim ObjEdoc As New ClsEdocumentacion + + If Not _CveDocumentacionElectronica = -1 Then + + If ObjEdoc.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, 0, "", "", UsuarioActual.CveUsuario, _fechaLimite) Then + Alert("Documento Eliminado Correctamente.", TipoMensaje.MsgInformacion) + End If + + End If + + CargaDocumentacionCliente() + ObjEdoc.Dispose() + + End Sub + Public Sub DownLoad_ClickDocumentacion(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim Adjunto As String = GvRow.DataKey("Adjunto") + linkDescargaPagare = ModExtensiones.DirectorioBaseEmpresas & String.Format("Empresas\{0}\DocElectronica\Clientes\{1}\{2}", UsuarioActual.CveEmpresa, CveCliente, Adjunto) + TxtDireccionAval.Text = "" + TxtAval.Text = "" + RegistraScript("$('#ModalDivPagare').modal('show')") + + End Sub + + Protected Sub ImprimirPagare(sender As Object, e As EventArgs) Handles BtnAgregarPagare.Click + Dim memoryStreamDoc As New System.IO.MemoryStream + Dim objGemBoxDocument As New clsGemBoxDocument(linkDescargaPagare) + Dim Tags As New List(Of TagsDocumentos) + Dim ObjClientes As New ClsClientes + + Dim monto As String = "" + Dim razonSocial As String = "" + Dim direccion As String = "" + Dim ciudad As String = "" + Dim Telefono As String = "" + Dim mesArray = New String() {"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"} + Dim hoy As DateTime = DateTime.Now + Dim fechaConFormato As String = String.Format("{0} de {1} del {2}", hoy.Day, mesArray(hoy.Month), hoy.Year) + + If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + monto = ObjClientes.DtResultados.FiltroPrimeroValor("LimiteCredito").ToDouble.ToString("N") + razonSocial = ObjClientes.DtResultados.FiltroPrimeroValor("NombreComercial") + direccion = ObjClientes.DtResultados.FiltroPrimeroValor("Direccion") + ciudad = ObjClientes.DtResultados.FiltroPrimeroValor("Ciudad") + Telefono = ObjClientes.DtResultados.FiltroPrimeroValor("Telefono") + End If + + Tags.Add(New TagsDocumentos("{Monto}", monto)) + Tags.Add(New TagsDocumentos("{Fecha}", fechaConFormato)) + Tags.Add(New TagsDocumentos("{FechaConFormato}", fechaConFormato)) + Tags.Add(New TagsDocumentos("{CantidadLetra}", monto.ToDouble.Texto2Letras(1))) + Tags.Add(New TagsDocumentos("{RazonSocial}", razonSocial)) + Tags.Add(New TagsDocumentos("{Direccion}", direccion)) + Tags.Add(New TagsDocumentos("{Ciudad}", ciudad)) + Tags.Add(New TagsDocumentos("{Telefono}", Telefono)) + Tags.Add(New TagsDocumentos("{RazonSocialAval}", TxtAval.Text)) + Tags.Add(New TagsDocumentos("{DireccionAval}", TxtDireccionAval.Text)) + Tags.Add(New TagsDocumentos("{CiudadAval}", UsuarioActual.Empresa.Ciudad)) + Tags.Add(New TagsDocumentos("{TelefonoAval}", UsuarioActual.Empresa.Telefono)) + + If Not ObjClientes.AddClientePagare(CveCliente, UsuarioActual.CveEmpresa, TxtAval.Text, TxtDireccionAval.Text) Then + Alert("no se pudo registrar el pagare") + Exit Sub + End If + + 'objGemBoxDocument.AgregarImagen(RutaLogo, 61.0, 53.0) + RegistraScript("$('#ModalDivPagare').modal('hide')") + Alert("Pagaré registrado con exito") + + objGemBoxDocument.SustituirTags(Tags) + objGemBoxDocument.GuardarStream() + Dim memoryStream As New System.IO.MemoryStream(objGemBoxDocument.GetBytesDocumento()) + objGemBoxDocument.Dispose() + ObjClientes.Dispose() + Response.Clear() + Response.ContentType = "application/text" + Response.AddHeader("content-disposition", "attachment;filename=pagare.docx") + Response.Buffer = True + memoryStream.WriteTo(Response.OutputStream) + Response.End() + + End Sub + + Protected Sub GvDocumentosFirma_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentosCliente.RowDataBound + + + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString + Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato") + 'Dim ImgDownLoad As Literal = e.Row.FCLiteral("ImgDownLoad") + Dim LnkDownLoadDoc As LinkButton = e.Row.FCLinkButton("LnkDownLoadDoc") + Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired") + Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite") + Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False) + Dim chkEstatus As CheckBox = e.Row.FCCheckBox("chkEstatus") + Dim documentacionFormato As String = e.Row.DBCampo("DocumentacionFormato").ToString + Dim Documentacion As String = e.Row.DBCampo("Documentacion").ToString + Dim _CveDocumentacion As Integer = e.Row.DBCampo("CveDocumentacion").ToString.ToEntero + Dim separado As Char() = ".".ToString.ToCharArray + Dim array() As String = Adjunto.Split(separado) + Dim extencion As String = "" + Dim existeAdjunto As Boolean = False + Dim TxtFechaVigencia As TextBox = e.Row.FCTextBox("TxtFechaVigencia") + + Dim imgCalendario As LinkButton = e.Row.FCLinkButton("imgCalendario") + + + + + + + ' FechaVigencia + + Dim DiasLimite As Integer = e.Row.DataKey("DiasLimite").ToString.ToEntero + Dim AplicaDiasLimite As Boolean = If(e.Row.DataKey("AplicaDiasLimite").ToString = "1", True, False) + Dim AplicaFechaVencimiento As Boolean = If(e.Row.DataKey("AplicaFechaVencimiento").ToString = "1", True, False) + + txtFechaLimite.Visible = If(AplicaDiasLimite, True, False) + TxtFechaVigencia.Visible = If(AplicaFechaVencimiento, True, False) + imgCalendario.Visible = If(AplicaFechaVencimiento, True, False) + + + 'Dim scripMascara = " $('#" & TxtFechaVigencia.ClientID & "').mask('00/00/0000');" + ' RegistraScript(scripMascara) + + If TxtFechaVigencia.Text.Length = 10 Then + TxtFechaVigencia.Text = TxtFechaVigencia.Text.ToDate.ToString("dd/MM/yyyy") + End If + + If array.Length > 0 Then + extencion = array(array.Length - 1) + End If + + If e.Row.DBCampo("Estatus").ToString.ToEntero = 1 Then + chkEstatus.Checked = True + Else + chkEstatus.Checked = False + End If + + If documentacionFormato = "" Then + 'ImgDownLoadFormato.Visible = False + LnkDownLoadDoc.Visible = False + Else + Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/Formatos/" & CveDocumentacion & "" & documentacionFormato + LnkDownLoadDoc.Visible = True + End If + + txtFechaLimite.Text = e.Row.DBCampo("FechaLimite").ToString.ToDate.ToString("dd/MM/yyyy") + + If Adjunto.Trim.Length > 0 Then + + Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "\DocElectronica\Clientes\" & CveCliente & "/" & Adjunto + Dim linkDescargaArchivo = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "/" & Adjunto + + If File.Exists(linkDescargaArchivo) Then + + LnkDownLoadDoc.Visible = True + ScriptManager.GetCurrent(Me).RegisterPostBackControl(LnkDownLoadDoc) + 'If extencion.Length > 0 Then + ' ImgDownLoad.Text = String.Format(" ", linkDescarga, CveCliente & Documentacion & "." & extencion) + 'Else + ' ImgDownLoad.Text = String.Format(" ", linkDescarga, CveCliente & Documentacion) + 'End If + Else + LnkDownLoadDoc.Visible = False + End If + Else + LnkDownLoadDoc.Visible = False + End If + + If requerido Then + ImgRequired.Text = " " + Else + ' ImgRequired.Text = " " + End If + + If UsuarioActual.TienePermisoProceso(248) And e.Row.DBCampo("Estatus").ToString.ToEntero = 1 And LnkDownLoadDoc.Visible Then + e.Row.FCLinkButton("LnkGvDocumentosEliminar").Visible = True + End If + + End If + + End Sub + Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero + Dim DocumentacionFormato As String = CveDocumentacion & "_" & GvRow.DataKey("DocumentacionFormato") + + DescarFormato(DocumentacionFormato) + + End Sub + Public Sub DescarFormato(documento As String) + + Dim PathRoot As String = Server.MapPath("/") + Dim PathSource As String + Dim pathDesti As String + + PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & documento + pathDesti = PathRoot & "Temp\" & CveCliente & documento + + If File.Exists(pathDesti) Then + File.Delete(pathDesti) + End If + + File.Copy(PathSource, pathDesti) + + Dim objDoc As New clsGemBoxDocument(pathDesti) + Dim objRH As New ClsRH + Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString & " del " & Now.Year.ToString() + + + objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(-1, UsuarioActual.CveEmpresa)) ' Pendiente + objRH.Dispose() + + + + objDoc.Guardar(pathDesti) + + Dim fileinfo As New FileInfo(pathDesti) + + Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) + baseUrl = baseUrl & "/temp/" & fileinfo.Name + + RegistraDescargaJavaScript(baseUrl) + + End Sub + + + + 'Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) + ' Dim ListaTagsDocumentost = New List(Of TagsDocumentos) + + ' If CvePersonal <> -1 Then + ' Dim objRH As New ClsRH + + + + ' If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{RFC}", objRH.DtResultados(0)("RFC").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", Cliente)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString)) + + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString.ToDecimal.ToString("###,###,###.00"))) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString)) + + + ' 'If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then + + ' ' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text)) + ' 'End If + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString)) + + + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaIngreso}", objRH.DtResultados(0)("FechaIngreso").ToString.ToDate.ToShortDateString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString.ToDate.ToShortDateString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CUIP}", "")) + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Denominacion}", "")) + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaNacimiento}", objRH.DtResultados(0)("FechaNacimiento").ToString.ToDate.ToString("dd/MM/yyyy"))) + + + ' Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year + + ' Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy") + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual)) + ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF)) + ' End If + + + ' objRH.Dispose() + ' End If + + ' Return ListaTagsDocumentost + 'End Function + + + + + + + + ''Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) + '' Dim ListaTagsDocumentost = New List(Of TagsDocumentos) + + '' If CvePersonal <> -1 Then + '' Dim objRH As New ClsRH + + + + '' If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then + + '' If Not IsDBNull(objRH.DtResultados(0)("Nombres")) Then + '' ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString)) + '' End If + + '' If Not objRH.DtResultados(0)("APaterno") Is Nothing Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString)) + '' End If + + '' If Not objRH.DtResultados(0)("AMaterno") Is Nothing Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString)) + '' End If + + '' If Not objRH.DtResultados(0)("NombreCompleto") Is Nothing Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", objRH.DtResultados(0)("NombreCompleto").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("Estatura")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("Peso")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("LugarNacimiento")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("Edad")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("NombreTelEmergencia")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("TipoSangre")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("Vivienda")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("ViviendaDueno")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CreditoInfonavit")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("RentaMensual")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString.ToDecimal.ToString("###,###,###.00"))) + + '' If Not IsDBNull(objRH.DtResultados(0)("TransportePublico")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormente")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("ParientesEmpresa")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelito")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelitoObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Direccion")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Calle")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Colonia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Telefono")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Celular")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Correo")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then + + '' ' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("NumeroSS")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Licencia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CartillaMilitar")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CURP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("AutorizaAntidoping")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Observaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CredencialElector")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CredencialElector}", objRH.DtResultados(0)("CredencialElector").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Sucursal")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Sucursal}", objRH.DtResultados(0)("Sucursal").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Puesto")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString)) + + '' 'If Not IsDBNull(objRH.DtResultados(0)("InformacionFidedigno")) Then chkFidedigna4.Checked = objRH.DtResultados(0)("InformacionFidedigno") + '' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("InformacionFidedigno").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("FechaNacimiento")) Then + '' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("FechaNacimiento").ToString.ToDate.ToString("dd/MM/yyyy"))) + '' End If + + + '' Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year + '' Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy") + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual)) + '' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF)) + + + '' objRH.Dispose() + '' End If + + '' Return ListaTagsDocumentost + ''End Function + Private Sub RegistraDescargaJavaScript(baseUrl As String) + + RegistraScript("Download('" & baseUrl & "')") + + End Sub + +#End Region + +#Region "D O C U M E N T O S V E N T A S" + + Private Sub CargaDocumentosVenta(tCveCliente As Integer) + Dim objInv As New ClsEdocumentacion + + If objInv.DocumentacionElectronicaGet(-1, tCveCliente, -1, UsuarioActual.CveEmpresa, 14) Then + GvDocsVentas.DataSource = objInv.DtResultados + If objInv.DtResultados.Rows.Count > 0 Then BtnGuardarDocumentacion.Visible = True + Else + GvDocsVentas.DataSource = Nothing + End If + + objInv.Dispose() + GvDocsVentas.DataBind() + UpDocumentacion.Update() + + End Sub + + Private Sub BtnGuardarDocumentación_Click(sender As Object, e As EventArgs) Handles BtnGuardarDocumentacion.Click + Dim objDoc As New ClsEdocumentacion() + objDoc.IniciaTransacSQL() + Dim HuboError As Boolean = False + + If CveCliente <= 0 Then + For Each gvr As GridViewRow In GvDocsVentas.Rows + If gvr.FCCheckBox("ChkDoc").Checked Then + + If objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text) <= 0 Then HuboError = True + + End If + + Next + + Else + For Each gvr As GridViewRow In GvDocsVentas.Rows + 'sino está registrada y se selecciona, se va a insertar + If gvr.DataKey("CveDocumentacionElectronica").ToEntero <= 0 AndAlso gvr.FCCheckBox("ChkDoc").Checked Then + If objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text) <= 0 Then HuboError = True + Else + ', Observacion2:=gvr.FCTextBox("TxtObs2").Text + If Not objDoc.DocumentacionElectronicaUpdate(gvr.DataKey("CveDocumentacionElectronica").ToEntero, gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, gvr.DataKey("FechaLimite").ToDate, Observacion2:=gvr.FCTextBox("TxtObs2").Text) Then HuboError = True + End If + + 'si ya estaba registrada y no se selecciona, se va a insertar + If gvr.DataKey("CveDocumentacionElectronica").ToEntero > 0 AndAlso Not gvr.FCCheckBox("ChkDoc").Checked Then + If Not objDoc.DocumentacionElectronicaRemove(gvr.DataKey("CveDocumentacionElectronica").ToEntero, -1) Then HuboError = True + End If + + Next + + End If + + + If Not HuboError Then + Alert("Documentación guardada", TipoMensaje.MsgInformacion) + objDoc.Commit() + Else + objDoc.RollBack() + End If + objDoc.Dispose() + + End Sub + + Public Sub Upload_ClickDocumentacion(sender As Object, e As EventArgs) + RegistraScript("$('#ModalCXCDocumento').modal({ backdrop: 'static', keyboard: false});") + End Sub + + Protected Sub BtnModalCXCDocumentoClienteUpload_Click(sender As Object, e As EventArgs) Handles BtnModalCXCDocumentoClienteUpload.Click + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacion").ToEntero + Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToEntero + Dim _Obserbaciones As String = GvRow.FCTextBox("TxtObservaciones").Text.Trim + Dim _FechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + SubirComprobante(_CveDocumentacionElectronica, _CveDocumentacion, _Obserbaciones, _FechaLimite) + 'CargaDocs() + + End Sub + + Private Function SubirComprobante(_CveDocumentacionElecronica As Integer, _CveDocumentacion As Integer, _Obserbaciones As String, _FechaLimite As Date) As Boolean + + Dim Respuesta As Boolean = False + Dim RutaDirectorio As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, "Clientes\") + + Dim filesgral As List(Of Archivo) = TxtCXCDocumentoCliente.getfiles().Archivos + Dim filemove As String = "" + Dim Comprobante As String = "" + Dim ShortFileName As String = "" + + + If filesgral.Count > 0 Then + + Dim RutaArchivo As String + + For Each fileItem As Archivo In filesgral + + Dim edoc As New ClsEdocumentacion + + Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + filemove = fileItem.FileUrl + RutaArchivo = String.Format("{0}{1}_{2}", RutaDirectorio, CveCliente, _CveDocumentacion) + RutaArchivo = String.Format("{0}.{1}", RutaArchivo, fileItem.Extencion) + + Try + If Not Directory.Exists(RutaDirectorio) Then + Directory.CreateDirectory(RutaDirectorio) + End If + + If File.Exists(RutaArchivo) Then + File.Delete(RutaArchivo) + End If + + File.Move(filemove, RutaArchivo) + Respuesta = True + ShortFileName = System.IO.Path.GetFileName(RutaArchivo) + + If edoc.DocumentacionElectronicaUpdate(_CveDocumentacionElecronica, _CveDocumentacion, -1, CveCliente, -1, 1, _Obserbaciones, ShortFileName, UsuarioActual.CveEmpresa, _FechaLimite) Then + + + End If + + Catch ex As Exception + + OnError("Error al intentar guardar archivo ", ex) + Respuesta = False + RutaArchivo = "-1" + End Try + Anexo.Text = "" + + edoc.Dispose() + Next + Else + Respuesta = True + End If + + + + UpModalCXCClienteDocumento.Update() + Return Respuesta + + End Function + + Public Sub Update_ClickDocumentacion(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim activo As Boolean = False + + Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToEntero + Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString + Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + Dim observaciones As String = GvRow.FCTextBox("TxtObservaciones").Text ' DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text + 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) + Dim chkCompleto As CheckBox = GvRow.FCCheckBox("chkEstatus") + Dim _Estatus As Integer + If chkCompleto.Checked Then _Estatus = 1 Else _Estatus = 0 + + + Dim objRH As New ClsEdocumentacion + + If Not GvRow.DataKey("CveDocumentacionElectronica").ToEntero = -1 Then + If objRH.DocumentacionElectronicaUpdate(GvRow.DataKey("CveDocumentacionElectronica").ToEntero, _CveDocumentacion, -1, CveCliente, -1, _Estatus, observaciones, _Adjunto, UsuarioActual.CveUsuario, GvRow.FCTextBox("TxtFechaLimite").Text.ToDate) Then + Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) + End If + Else + If objRH.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, _Estatus, observaciones, _Adjunto, UsuarioActual.CveUsuario, GvRow.FCTextBox("TxtFechaLimite").Text.ToDate) > 0 Then + Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) + End If + End If + + objRH.Dispose() + + End Sub + + +#End Region + +#Region "PERSONA FISICA" + Protected Sub LnkPersonaFisica_Click(sender As Object, e As EventArgs) + RegistraScript("$('#DivModalPersonaFisica').modal();") + End Sub + Protected Sub LnkActualizarPersonaFisica_Click(sender As Object, e As EventArgs) + Dim ObjCliente As New ClsClientes + + If ObjCliente.UpdateClientePersonaFisica(CveCliente, TxtApellidoPaternoPF.Text, TxtApellidoMaternoPF.Text, TxtNombrePF.Text) Then + Alert("El Cliente se ha actualizado correctamente.", TipoMensaje.MsgInformacion) + + TxtNombre.Text = $"{TxtNombrePF.Text} {TxtApellidoPaternoPF.Text} {TxtApellidoMaternoPF.Text}" + + TxtApellidoPaterno.Text = TxtApellidoPaternoPF.Text + TxtApellidoMaterno.Text = TxtApellidoMaternoPF.Text + TxtNombres.Text = TxtNombrePF.Text + + DivRazonSocial.Visible = False + DivPersonaFisica.Visible = True + + RegistraScript("$('#DivModalPersonaFisica').modal('hide');") + End If + + ObjCliente.Dispose() + UpDatos.Update() + End Sub +#End Region + +#Region "USUARIOS PLATAFORMA CLIENTE - 6 " + Protected Sub CargaUsuariosPortalCliente() + Dim objUsuario As ClsSisUsuarios = New ClsSisUsuarios + If objUsuario.GetUsuariosPortal(-1, CveCliente, -1) Then + GvUsuarios.DataSource = objUsuario.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa}") + GvUsuarios.DataBind() + End If + objUsuario.Dispose() + End Sub +#End Region + +#Region " DEVOLVER DINERO ANT/NC " + Private Sub InicializaDevolverDinero() + If UsuarioActual.TienePermisoProceso(247) Then + GVAnticipos.Columns(6).Visible = True + End If + End Sub +#End Region + +#Region "MODAL GRAFICA/PEDIDOS" + + Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) + If CargaDatatables() Then + RegistraScript("$('#DivModalGrafica').modal('show')") + CargaGrafica() + End If + End Sub + + Protected Sub LnkCancelar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + Dim ObjCliente As New ClsClientes + If ObjCliente.UpdateEstatusPedido(gvRow.DataKey("CveVenta").ToEntero, 17, -1, UsuarioActual.CveUsuario) Then + Alert("Cancelado correctamente.") + CargaPedido() + End If + ObjCliente.Dispose() + End Sub + + + Private Sub CargaPedido() + Dim ObjCliente As New ClsClientes + If ObjCliente.GetClienteVentasPedido(CveCliente, UsuarioActual.CveEmpresa) Then + GvPedidos.DataSource = ObjCliente.DtResultados + End If + ObjCliente.Dispose() + GvPedidos.DataBind() + UpPedido.Update() + End Sub + + Protected Sub LnkAutorizar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + Dim ObjCliente As New ClsClientes + ObjCliente.IniciaTransacSQL() + Dim ErrorTrans As Boolean = False + Dim CveU As Integer = 0 + Dim MsgAut As String = "" + + If ObjCliente.UpdateEstatusPedido(gvRow.DataKey("CveVenta").ToEntero, 16, gvRow.FCTextBox("TxtDiasCredito").Text.ToEntero, UsuarioActual.CveUsuario) Then + CveU = gvRow.DataKey("CveUsuario").ToEntero + MsgAut = String.Format(" Solicitud Autorizada {0} ", gvRow.DataKey("SerieFolio")) + 'If Not ObjCliente.UpdateFechaPedido(gvRow.DataKey("CveVenta").ToEntero, gvRow.FCTextBox("TxtDiasCredito").Text.ToEntero) Then + ' ErrorTrans = True + 'End If + Else + ErrorTrans = True + End If + If Not ErrorTrans Then + ObjCliente.Commit() + Alert("Autorizado correctamente.") + + If CveU > 0 Then ClsSisNotificaciones.SendNotificacionERP(CveU, MsgAut, MsgAut, 1) + + CargaPedido() + Else + ObjCliente.RollBack() + End If + ObjCliente.Dispose() + End Sub + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + If CargaDatatables() Then + CargaGrafica() + End If + End Sub + + Private Function CargaDatatables() As Boolean + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClienteVencido(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then + DtVencido = ObjClientes.DtResultados + End If + + If ObjClientes.GetRotacionCartera(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then + DtRotacion = ObjClientes.DtResultados + End If + + If ObjClientes.GetClienteSaldoMensual(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then + DtSaldoMensual = ObjClientes.DtResultados + End If + + If ObjClientes.GetClienteComportamientoVentaMensual(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then + DtComportamientoVentas = ObjClientes.DtResultados + End If + + If ObjClientes.GetClienteVentasPedido(CveCliente, UsuarioActual.CveEmpresa) Then + GvPedidos.DataSource = ObjClientes.DtResultados + End If + + ObjClientes.Dispose() + GvPedidos.DataBind() + UpPedido.Update() + + Return True + End Function + + Private Sub CargaGrafica() + Dim FactVencida As Boolean = False + Dim Saldo As Double = 0 + Dim LimiteCredito As Double = 0 + If DtVencido.Rows.Count > 0 Then + Saldo = DtVencido.SUM("Saldo") + LimiteCredito = DtVencido.Rows(0)("LimiteCredito").ToString.ToDouble + LblVencido.Text = DtVencido.SUM("Total", "DiasVencidos > 0").FormatoNumero + LblPorVencer.Text = DtVencido.SUM("Total", "DiasVencidos <= 0").FormatoNumero + Else + LimiteCredito = TxtLimiteCredito.Text.ToDouble + LblVencido.Text = "0" + LblPorVencer.Text = "0" + End If + + Dim Dt As New DataTable() + Dt.Columns.Add("value") + For Each Dr As DataRow In DtVencido.Rows + Dim Row As DataRow = Nothing + Row = Dt.NewRow() + Row("value") = Dr("DiasVencidos").ToString + Dt.Rows.Add(Row) + If Dr("DiasVencidos").ToString.ToEntero > 0 And Dr("Saldo").ToString.ToDouble > 0 Then + FactVencida = True + End If + Next + + + Dim query = From s In Dt.AsEnumerable() Select New With {.date = "", .value = s("value").ToString()} + Dim json = Newtonsoft.Json.JsonConvert.SerializeObject(query) + RegistraScript($"CargaGraficaVencido({json})", "22") + + Dim Dt2 As New DataTable() + Dt2.Columns.Add("limite") + Dt2.Columns.Add("saldo") + Dim Row2 As DataRow = Nothing + Row2 = Dt2.NewRow() + LtlLimiteCreditoModal.Text = LimiteCredito.FormatoNumero + Row2("limite") = LimiteCredito - Saldo + Row2("saldo") = Saldo + Dt2.Rows.Add(Row2) + Dim query2 = From s In Dt2.AsEnumerable() Select New With {.year = "", .limite = s("limite").ToString(), .saldo = s("saldo").ToString()} + Dim json2 = Newtonsoft.Json.JsonConvert.SerializeObject(query2) + + RegistraScript($"CargaGraficaLimiteCredito({json2})", "33") + + If DtRotacion.Rows.Count > 0 Then + LblVentasModal.Text = DtRotacion.Rows(0)("Ventas").ToString.FormatoNumero + LblPagadoModal.Text = DtRotacion.Rows(0)("Pagado").ToString.FormatoNumero + LblRotacionModal.Text = DtRotacion.Rows(0)("Rotacion").ToString.FormatoNumero + LblDiasModal.Text = DtRotacion.Rows(0)("Dias").ToString.FormatoNumero + LblDiasCreditoModal.Text = DtRotacion.Rows(0)("DiasCredito").ToString.FormatoNumero + Else + LblVentasModal.Text = "0" + LblPagadoModal.Text = "0" + LblRotacionModal.Text = "0" + LblDiasModal.Text = "0" + LblDiasCreditoModal.Text = "0" + End If + + If FactVencida Or (Saldo > LimiteCredito) Then + LblEstatusModal.Text = "Vencido" + LblEstatusModal.ForeColor = Drawing.Color.Red + Else + LblEstatusModal.Text = "Al Corriente" + LblEstatusModal.ForeColor = Drawing.Color.Green + End If + + Dim Dt3 As New DataTable() + Dt3.Columns.Add("mes") + + Dim Dt4 As New DataTable() + Dt4.Columns.Add("balloonText") + Dt4.Columns.Add("bullet") + Dt4.Columns.Add("title") + Dt4.Columns.Add("valueField") + Dt4.Columns.Add("fillAlphas") + Dt4.Columns.Add("hidden") + + + Dim Cont As Integer = 1 + For Each Dr As DataRow In DtComportamientoVentas.Rows + Dt3.Columns.Add(Dr("Ano").ToString) + Dim Row4 As DataRow = Nothing + Row4 = Dt4.NewRow() + Row4("balloonText") = "Ventas [[category]]: [[value]]" + Row4("bullet") = "round" + Row4("title") = Dr("Ano").ToString + Row4("valueField") = Dr("Ano").ToString + Row4("fillAlphas") = 0 + Row4("hidden") = If(Cont > DtComportamientoVentas.Rows.Count - 3, False, True) + Dt4.Rows.Add(Row4) + Cont += 1 + Next + + Dim RowEnero As DataRow = Nothing + RowEnero = Dt3.NewRow() + Dim RowFebrero As DataRow = Nothing + RowFebrero = Dt3.NewRow() + Dim RowMarzo As DataRow = Nothing + RowMarzo = Dt3.NewRow() + Dim RowAbril As DataRow = Nothing + RowAbril = Dt3.NewRow() + Dim RowMayo As DataRow = Nothing + RowMayo = Dt3.NewRow() + Dim RowJunio As DataRow = Nothing + RowJunio = Dt3.NewRow() + Dim RowJulio As DataRow = Nothing + RowJulio = Dt3.NewRow() + Dim RowAgosto As DataRow = Nothing + RowAgosto = Dt3.NewRow() + Dim RowSeptiembre As DataRow = Nothing + RowSeptiembre = Dt3.NewRow() + Dim RowOctubre As DataRow = Nothing + RowOctubre = Dt3.NewRow() + Dim RowNoviembre As DataRow = Nothing + RowNoviembre = Dt3.NewRow() + Dim RowDiciembre As DataRow = Nothing + RowDiciembre = Dt3.NewRow() + For Each Dr As DataRow In DtComportamientoVentas.Rows + RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString + RowEnero("mes") = "Enero" + RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString + RowFebrero("mes") = "Febrero" + RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString + RowMarzo("mes") = "Marzo" + RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString + RowAbril("mes") = "Abril" + RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString + RowMayo("mes") = "Mayo" + RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString + RowJunio("mes") = "Junio" + RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString + RowJulio("mes") = "Julio" + RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString + RowAgosto("mes") = "Agosto" + RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString + RowSeptiembre("mes") = "Septiembre" + RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString + RowOctubre("mes") = "Octubre" + RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString + RowNoviembre("mes") = "Noviembre" + RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString + RowDiciembre("mes") = "Diciembre" + Next + Dt3.Rows.Add(RowEnero) + Dt3.Rows.Add(RowFebrero) + Dt3.Rows.Add(RowMarzo) + Dt3.Rows.Add(RowAbril) + Dt3.Rows.Add(RowMayo) + Dt3.Rows.Add(RowJunio) + Dt3.Rows.Add(RowJulio) + Dt3.Rows.Add(RowAgosto) + Dt3.Rows.Add(RowSeptiembre) + Dt3.Rows.Add(RowOctubre) + Dt3.Rows.Add(RowNoviembre) + Dt3.Rows.Add(RowDiciembre) + + RegistraScript($"CargaGraficaComportamientoVentas({Dt3.ToJson},{Dt4.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "44") + + Dim Dt5 As New DataTable() + Dt5.Columns.Add("mes") + + Dim Dt6 As New DataTable() + Dt6.Columns.Add("balloonText") + Dt6.Columns.Add("bullet") + Dt6.Columns.Add("title") + Dt6.Columns.Add("valueField") + Dt6.Columns.Add("fillAlphas") + Dt6.Columns.Add("hidden") + + Cont = 1 + For Each Dr As DataRow In DtSaldoMensual.Rows + Dt5.Columns.Add(Dr("Ano").ToString) + Dim Row6 As DataRow = Nothing + Row6 = Dt6.NewRow() + Row6("balloonText") = "Saldo [[category]]: [[value]]" + Row6("bullet") = "round" + Row6("title") = Dr("Ano").ToString + Row6("valueField") = Dr("Ano").ToString + Row6("fillAlphas") = 0 + Row6("hidden") = If(Cont > DtSaldoMensual.Rows.Count - 3, False, True) + Dt6.Rows.Add(Row6) + Cont += 1 + Next + RowEnero = Dt5.NewRow() + RowFebrero = Dt5.NewRow() + RowMarzo = Dt5.NewRow() + RowAbril = Dt5.NewRow() + RowMayo = Dt5.NewRow() + RowJunio = Dt5.NewRow() + RowJulio = Dt5.NewRow() + RowAgosto = Dt5.NewRow() + RowSeptiembre = Dt5.NewRow() + RowOctubre = Dt5.NewRow() + RowNoviembre = Dt5.NewRow() + RowDiciembre = Dt5.NewRow() + For Each Dr As DataRow In DtSaldoMensual.Rows + RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString + RowEnero("mes") = "Enero" + RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString + RowFebrero("mes") = "Febrero" + RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString + RowMarzo("mes") = "Marzo" + RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString + RowAbril("mes") = "Abril" + RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString + RowMayo("mes") = "Mayo" + RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString + RowJunio("mes") = "Junio" + RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString + RowJulio("mes") = "Julio" + RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString + RowAgosto("mes") = "Agosto" + RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString + RowSeptiembre("mes") = "Septiembre" + RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString + RowOctubre("mes") = "Octubre" + RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString + RowNoviembre("mes") = "Noviembre" + RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString + RowDiciembre("mes") = "Diciembre" + Next + Dt5.Rows.Add(RowEnero) + Dt5.Rows.Add(RowFebrero) + Dt5.Rows.Add(RowMarzo) + Dt5.Rows.Add(RowAbril) + Dt5.Rows.Add(RowMayo) + Dt5.Rows.Add(RowJunio) + Dt5.Rows.Add(RowJulio) + Dt5.Rows.Add(RowAgosto) + Dt5.Rows.Add(RowSeptiembre) + Dt5.Rows.Add(RowOctubre) + Dt5.Rows.Add(RowNoviembre) + Dt5.Rows.Add(RowDiciembre) + + + RegistraScript($"CargaGraficaCompratamientoSaldoMensual({Dt5.ToJson},{Dt6.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "55") + + UPModalProd.Update() + End Sub + + +#End Region + +#Region "TAB - COMPORTAMIENTO DE VENTAS" + + Private Sub CargaGrupo() + DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3")) + DdlGrupo.Items.Insert(1, New ListItem("Clasificacion", "4")) + DdlGrupo.Items.Insert(2, New ListItem("Productos-Servicios", "5")) + DdlGrupo.Items.Insert(3, New ListItem("Año", "6")) + DdlGrupo.Items.Insert(4, New ListItem("Mes", "7")) + DdlGrupo.Items.Insert(5, New ListItem("Año/Mes", "8")) + DdlGrupo.Items.Insert(6, New ListItem("Fecha", "9")) + DdlGrupo.Items.Insert(7, New ListItem("Cliente", "10")) + DdlGrupo.Items.Insert(8, New ListItem("Vendedor", "12")) + DdlGrupo.Items.Insert(9, New ListItem("Usuario", "13")) + DdlGrupo.Items.Insert(10, New ListItem("Estatus Fact.", "14")) + DdlGrupo.Items.Insert(11, New ListItem("Año Ejec.", "15")) + DdlGrupo.Items.Insert(12, New ListItem("Mes Ejec.", "16")) + DdlGrupo.Items.Insert(13, New ListItem("Año/Mes Ejec.", "17")) + DdlGrupo.Items.Insert(14, New ListItem("Fecha Ejec.", "18")) + DdlGrupo.Items.Insert(15, New ListItem("Cliente - PS", "20")) + DdlGrupo.DataBind() + DdlGrupo.SelectedValueExist("8") + End Sub + + Private Sub CargaTipoCentroCosto() + + If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then + DdlSubProyectoFiltro.Items.Clear() + DivProyecto.Visible = False + LblProyecto.Visible = False + LblSubProyecto.InnerText = "Sucursal:" + DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSubProyectoFiltro.DataBind() + + DdlGrupo.Items.Insert(0, New ListItem("Sucursal", "2")) + DdlGrupo.Items.Insert(16, New ListItem("Sucursal Ejec.", "19")) + DdlGrupo.DataBind() + + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then + DdlSubProyectoFiltro.Items.Clear() + DivProyecto.Visible = False + LblProyecto.Visible = False + LblSubProyecto.InnerText = "Proyecto:" + DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSubProyectoFiltro.DataBind() + + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "2")) + DdlGrupo.Items.Insert(16, New ListItem("Proyecto Ejec.", "19")) + DdlGrupo.DataBind() + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 3 Then + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then + LblProyecto.InnerText = "Sucursal:" + LblSubProyecto.InnerText = "Proyecto:" + + + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then + LblProyecto.InnerText = "Proyecto:" + LblSubProyecto.InnerText = "Sucursal:" + + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + End If + End Sub + + Private Sub CargaFiltros() + 'Cargo Proyectos + DdlProyecto.DataSource = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1) + DdlProyecto.DataBind() + + 'Cargo Clasificaciones + DdlClasificacionFilto.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacionFilto.DataBind() + + 'CargaSubProyectos + DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectoFiltro.DataBind() + + 'Vendedor + DdlVendedorFiltro.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedorFiltro.DataBind() + + 'CargaUsuarios + DdlUsuario.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + DdlUsuario.DataBind() + + 'Carga Productos + DdlPSFiltro.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then + DdlPSFiltro.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionFilto.SelectedValue) + DdlPSFiltro.SelectedText = "" + DdlPSFiltro.SelectedValue = "-1" + Else + DdlPSFiltro.ddl.Items.Clear() + DdlPSFiltro.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionFilto.SelectedValue.ToEntero) + DdlPSFiltro.ddl.DataBind() + DdlPSFiltro.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) + End If + + CargaGrupo() + CargaTipoCentroCosto() + + End Sub + + Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged + CargaSubProyecto() + End Sub + + Private Sub CargaSubProyecto() + DdlSubProyectoFiltro.Items.Clear() + If DdlProyecto.SelectedValue <> "-1" Then + DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectoFiltro.DataBind() + End If + DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + + Protected Sub DdlClasificacionFilto_SelectedIndexChanged(sender As Object, e As EventArgs) + If UsuarioActual.Empresa.Funcionalidad(105) = "" Then + DdlPSFiltro.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionFilto.SelectedValue.ToEntero) + DdlPSFiltro.DataBind() + DdlPSFiltro.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + Else + DdlPSFiltro.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionFilto.SelectedValue) + DdlPSFiltro.SelectedText = "Todos" + DdlPSFiltro.SelectedValue = "-1" + End If + End Sub + + Protected Sub GvComportamientoVenta_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + + If DdlGrupo.SelectedValue.ToEntero = 20 Then + + If e.Row.DBCampo("PS").ToString = "" Then + e.Row.CssClass = "Totales" + End If + Else + If Not e.Row.DBCampo("CveVenta").ToEntero > 0 Then + e.Row.Cells(5).Text = e.Row.DBCampo("Gpo").ToString + e.Row.CssClass = "Totales" + + End If + End If + End If + End Sub + + Protected Sub BtnConsultarComportamiento_Click(sender As Object, e As EventArgs) + CargaGvComportamientoVenta() + End Sub + + Private Sub CargaGvComportamientoVenta() + Dim ObjVentas As New ClsVentas() + Dim FechaI, FechaF As Date + FechaI = If(IsDate(TxtFechaIFiltro.Text.Trim()), TxtFechaIFiltro.Text.ToDate, MinFecha) + FechaF = If(IsDate(TxtFechaFFiltro.Text.Trim()), TxtFechaFFiltro.Text.ToDate, MaxFecha) + + If ObjVentas.GetRepProductosServiciosDetalle(DdlProyecto.SelectedValue.ToEntero, DdlSubProyectoFiltro.SelectedValue.ToEntero, -1, DdlClasificacionFilto.SelectedValue.ToEntero, + DdlPSFiltro.SelectedValue.ToEntero, FechaI, FechaF, -1, MinFecha, MaxFecha, -1, + CveCliente, -1, DdlVendedorFiltro.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, -1, + UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoDocto:="Ing", GPO:=DdlGrupo.SelectedValue.ToEntero) Then + GvComportamientoVenta.DataSource = ObjVentas.DtResultados + Else + GvComportamientoVenta.DataSource = Nothing + End If + + ObjVentas.Dispose() + GvComportamientoVenta.DataBind() + UpDatosComportamientoVenta.Update() + End Sub + +#End Region + +#Region "DISPOSITIVOS" + + Protected Sub LnkMoverDispositivo_Click(sender As Object, e As EventArgs) + Dim CveDispositivo As Integer = HdnCveDispositivoMover.Value.ToEntero() + Dim CveCliente As Integer = DdlClienteDispositivo.SelectedValue.ToEntero() + + If CveDispositivo <= 0 Then + Alert("Se debe seleccionar un dispositivo.", TipoMensaje.MsgAdvertencia) + Return + End If + If CveCliente <= 0 Then + Alert("Se debe seleccionar un cliente.", TipoMensaje.MsgAdvertencia) + Return + End If + Dim TieneError As Boolean = False + Dim ObjGPS = New ClsGPS() + Dim ObjEventos As New ClsOIEventos(ObjGPS.IniciaTransacSQL()) + + If ObjGPS.UpdateClienteDispositivo(CveDispositivo, CveCliente) Then + TieneError = Not ObjEventos.AddEventoBitacora($"Se movió el dispositivo: {NombreDispositivo} de cliente. Valor Anterior:{UsuarioActual.Empresa.Empresa}, {LtlCliente.Text} Valor Actual:{DdlEmpresaDispositivo.SelectedItem.Text}, {DdlClienteDispositivo.SelectedItem.Text}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) + Else + TieneError = True + End If + + If TieneError Then + ObjGPS.RollBack() + Alert($"Ocurrió un error al mover el dispostivo.", TipoMensaje.MsgError) + Else + ObjGPS.Commit() + Alert($"El dispositivo '{NombreDispositivo}' se movió correctamente.") + End If + + ObjGPS.Dispose() + ObjEventos.Dispose() + + CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) + CargaEventoBitacora() + NombreDispositivo = "" + RegistraScript("$('#DivMoverDispositivo').modal('hide');") + End Sub + +#End Region + +#Region "CRM" + Protected Sub CargaDatosCRM() + Dim ObjCRM = New ClsCRM() + + If ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, CveEmpresaCRM) And ObjCRM.DtResultados.Rows.Count > 0 Then + TxtNombre.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa").ToString + TxtNombreComercial.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa").ToString + TxtRFC.Text = ObjCRM.DtResultados.FiltroPrimeroValor("RFC").ToString + + TxtEmail.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo").ToString + TxtEmailCotizacion.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo").ToString + + DdlVendedor.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveVendedorAsignado").ToString) + DdlSubProyecto.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToString) + Else + Alert("La empresa CRM solicitada no existe, porfavor verifique", TipoMensaje.MsgAdvertencia) + CveEmpresaCRM = -1 + End If + ObjCRM.Dispose() + End Sub + + Protected Sub VerificaVinculacion() + Dim ObjCRM = New ClsCRM() + + If ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, -1) And ObjCRM.DtResultados.Rows.Count > 0 Then + If ObjCRM.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente)).Rows.Count > 0 Then + LiLnkUnificarCRM.Visible = False + Else + LiLnkUnificarCRM.Visible = True + End If + End If + ObjCRM.Dispose() + End Sub + + Protected Function VincularEmpresaCRM() As Boolean + Dim Ok As Boolean = False + Dim ObjCRM = New ClsCRM() + Dim ObjBitacora = New ClsOIEventos(ObjCRM.IniciaTransacSQL()) + If (CveCliente > 0) Then + + Dim CveEmpresaCRMVincular As Integer = If(CveEmpresaCRM > 0, CveEmpresaCRM, If(CveEmpresaCRMUnificar > 0, CveEmpresaCRMUnificar, -1)) + + If ObjCRM.UpdateEmpresCRM("-2", "-2", -2, CveEmpresaCRMVincular, -2, UsuarioActual.CveUsuario, CveCliente, -1, "-1") Then + If CveEmpresaCRM > 0 Then + ObjBitacora.AddEventoBitacora(String.Format("Se Creó el Cliente: {0} a partir de la Empresa CRM", TxtNombre.Text), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM:=CveEmpresaCRM) + End If + If CveEmpresaCRMUnificar > 0 Then + ObjBitacora.AddEventoBitacora(String.Format("Se Unificó el Cliente: {0} con la Empresa CRM", TxtNombre.Text), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM:=CveEmpresaCRMUnificar) + End If + Ok = True + End If + End If + + If (Ok) Then + ObjCRM.Commit() + Else + ObjCRM.RollBack() + End If + ObjCRM.Dispose() + ObjBitacora.Dispose() + + Return Ok + End Function + + Protected Sub CargaModalEmpresasCRM() + Dim ObjCRM = New ClsCRM() + + If (ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa) And ObjCRM.DtResultados.Rows.Count > 0) Then + DtEmpresasCRM = ObjCRM.DtResultados.FiltraParametros(String.Format("CveCliente IS NULL")) + GvEmpresasCRM.DataSource = DtEmpresasCRM + End If + ObjCRM.Dispose() + GvEmpresasCRM.DataBind() + UpEmpresasCRM.Update() + End Sub + + Protected Sub LnkUnificarCRM_Click(sender As Object, e As EventArgs) + CveEmpresaCRMUnificar = -1 + CargaModalEmpresasCRM() + RegistraScript("$('#DivModalUnificarCRM').modal();") + End Sub + + Protected Sub BtnUnificarCRM_Click(sender As Object, e As EventArgs) + For Each row As GridViewRow In GvEmpresasCRM.Rows + Dim chkSeleccionado As RadioButton = CType(row.FindControl("RBSeleccion"), RadioButton) + If chkSeleccionado.Checked Then + CveEmpresaCRMUnificar = row.DataKey("CveEmpresaCRM").ToEntero + End If + Next + + If CveEmpresaCRMUnificar > 0 Then + If (VincularEmpresaCRM()) Then + LiLnkUnificarCRM.Visible = False + UpAccionesCRM.Update() + + RegistraScript("$('#DivModalUnificarCRM').modal('hide');") + Alert("Se Unificó correctamente al Cliente con la Empresa CRM.") + End If + End If + End Sub +#End Region + +#Region "PORCENTAJE PRECIO DE MARCAS" + Private Sub LnkPorcentajeMarcas_Click(sender As Object, e As EventArgs) Handles LnkPorcentajeMarcas.Click + RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajeMarcas")) + + CreaDT() + + CargaMarcas() + LimpiaModalPorcentaje() + End Sub + Private Sub CreaDT() + Dim DTPorcentajeTemp As New DataTable + + Dim column As DataColumn = New DataColumn("No") + column.DataType = Type.GetType("System.Int32") + With column + .AutoIncrement = True + .AutoIncrementSeed = 1 + .AutoIncrementStep = 1 + End With + + DTPorcentajeTemp.Columns.Add(column) + DTPorcentajeTemp.Columns.Add("CveMarca", GetType(Integer)) + DTPorcentajeTemp.Columns.Add("Marca", GetType(String)) + DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("PorcentajeProducto2", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("PorcentajeProducto3", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("ProntoPago", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("Plazo", GetType(Integer)) + DTPorcentajeTemp.Columns.Add("Estatus", GetType(String)) + DTPorcentajePrecios = DTPorcentajeTemp.Clone + End Sub + Private Sub CargaMarcas() + Dim ObjMarcas As New ClsProductosServicios + ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) + DdlMarcaPS.DataSource = ObjMarcas.DtResultados + ObjMarcas.Dispose() + DdlMarcaPS.DataBind() + DdlMarcaPS.Items.Insert(0, New ListItem("Seleccione", "-1")) + + CargaGridPorcentajes() + UpPorcentaje.Update() + End Sub + + Private Sub CargaGridPorcentajes() + Dim ObjPS As New ClsProductosServicios + + If ObjPS.GetPorcentajeMarcas(CveCliente) Then + DTPorcentajePrecios = ObjPS.DtResultados + GvM.DataSource = DTPorcentajePrecios + End If + ObjPS.Dispose() + + GvM.DataBind() + UppGrid.Update() + + End Sub + Private Sub CargaDTPorcentajePrecios(DtTemp As DataTable) + GvM.DataSource = DtTemp + GvM.DataBind() + + UppGrid.Update() + End Sub + + Private Sub LimpiaModalPorcentaje() + txtPorcentaje.Text = "" + txtPorcentaje2.Text = "" + txtPorcentaje3.Text = "" + txtProntoPago.Text = "" + txtPlazo.Text = "" + DdlMarcaPS.SelectedValue = "-1" + End Sub + + Protected Sub LbAgregarMarca_Click(sender As Object, e As EventArgs) Handles LbAgregarMarca.Click + If txtPorcentaje.Text.ToDecimal > 0 And txtPorcentaje.Text.ToDecimal <= 100 And txtPorcentaje2.Text.ToDecimal >= 0 And txtPorcentaje2.Text.ToDecimal <= 100 And txtPorcentaje3.Text.ToDecimal >= 0 And txtPorcentaje3.Text.ToDecimal <= 100 Then + + Dim registro As DataRow = DTPorcentajePrecios.NewRow + + registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1 + registro.Item("CveMarca") = DdlMarcaPS.SelectedValue.ToEntero + registro.Item("Marca") = DdlMarcaPS.SelectedItem.Text + registro.Item("PorcentajeProducto") = txtPorcentaje.Text.ToDecimal + registro.Item("PorcentajeProducto2") = txtPorcentaje2.Text.ToDecimal + registro.Item("PorcentajeProducto3") = txtPorcentaje3.Text.ToDecimal + registro.Item("ProntoPago") = txtProntoPago.Text.ToDecimal + registro.Item("Plazo") = txtPlazo.Text.ToEntero + registro.Item("Estatus") = "I" + DTPorcentajePrecios.Rows.Add(registro) + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + Else + Alert("El Porcentaje debe estar en un rango mayor a 0 y menor o igual a 100", TipoMensaje.MsgAdvertencia) + End If + + LimpiaModalPorcentaje() + End Sub + + Protected Sub DeleteRowMarca(sender As Object, e As EventArgs) + + Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) + + + If DTPorcentajePrecios.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then + Dim i As Integer + i = lnkRemove.CommandArgument.ToString.ToEntero + Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", i)) + If Drs.Count > 0 Then + If CveCliente > 0 AndAlso Drs(0)("CveMarca").ToString.ToEntero > 0 Then + Drs(0)("Estatus") = "D" + Else + Drs(0).Delete() + End If + + End If + DTPorcentajePrecios.AcceptChanges() + End If + + GvM.EditIndex = -1 + + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + + End Sub + + Protected Sub GvM_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvM.RowEditing + GvM.EditIndex = e.NewEditIndex + + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + End Sub + Protected Sub GvM_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvM.RowCancelingEdit + GvM.EditIndex = -1 + + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + End Sub + Protected Sub GvM_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvM.RowUpdating + + Dim PorcentajeProducto As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP").Text.ToDouble + Dim PorcentajeProducto2 As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP2").Text.ToDouble + Dim PorcentajeProducto3 As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP3").Text.ToDouble + Dim ProntoPago As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtProntoPagoP").Text.ToDouble + Dim Plazo As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPlazoP").Text.ToDouble + + If PorcentajeProducto > 0 And PorcentajeProducto <= 100 And PorcentajeProducto2 >= 0 And PorcentajeProducto2 <= 100 And PorcentajeProducto3 >= 0 And PorcentajeProducto3 <= 100 Then + Dim No As Integer = GvM.Rows(e.RowIndex).DataKey("No").ToEntero + + Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", No)) + + If Drs.Count > 0 Then + Drs(0)("PorcentajeProducto") = PorcentajeProducto + Drs(0)("PorcentajeProducto2") = PorcentajeProducto2 + Drs(0)("PorcentajeProducto3") = PorcentajeProducto3 + Drs(0)("ProntoPago") = ProntoPago + Drs(0)("Plazo") = Plazo + If Drs(0)("Estatus").ToString <> "I" Then + Drs(0)("Estatus") = "U" + End If + End If + + DTPorcentajePrecios.AcceptChanges() + GvM.EditIndex = -1 + + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + Else + Alert("El Porcentaje debe estar en un rango mayor a 0 y menor o igual a 100", TipoMensaje.MsgAdvertencia) + End If + + End Sub + + Protected Sub BtnGuardarPorcentajesMarca_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajesMarca.Click + + Dim TieneError As Boolean = False + + Dim ObjPS As New ClsProductosServicios + ObjPS.IniciaTransacSQL() + + For Each Dr As DataRow In DTPorcentajePrecios.Rows + + If Dr("Estatus").ToString <> "" Then + + If Dr("Estatus").ToString = "I" Then + If Not ObjPS.AddPorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, Dr("PorcentajeProducto2").ToString.ToDecimal, Dr("PorcentajeProducto3").ToString.ToDecimal, UsuarioActual.CveUsuario, Dr("ProntoPago").ToString.ToDecimal, Dr("Plazo").ToString.ToEntero) Then + TieneError = True + End If + ElseIf Dr("Estatus").ToString = "U" Then + If Not ObjPS.UpdatePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, Dr("PorcentajeProducto2").ToString.ToDecimal, Dr("PorcentajeProducto3").ToString.ToDecimal, Dr("ProntoPago").ToString.ToDecimal, Dr("Plazo").ToString.ToEntero) Then + TieneError = True + End If + ElseIf Dr("Estatus").ToString = "D" Then + If Not ObjPS.RemovePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero) Then + TieneError = True + End If + End If + + End If + Next + + If TieneError Then + ObjPS.RollBack() + Else + ObjPS.Commit() + Alert("Los Porcentajes se guardaron correctamente.", TipoMensaje.MsgInformacion) + RegistraScript("$('#DivPorcentajeMarcas').modal('hide')", "hidemodal") + End If + + ObjPS.Dispose() + + End Sub +#End Region + +#Region "PORCENTAJE PRECIO DE PRODUCTOS" + Private Sub LnkPorcentajePrecios_Click(sender As Object, e As EventArgs) Handles LnkPorcentajePrecios.Click + RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajePrecios")) + + CreaDT2() + + TxtPorcentajePS.Attributes.Add("onchange", String.Format("FnCambiaPorcentaje({0});", "5")) + CargaPorcentajesProductos() + LimpiaModalPorcentaje2() + End Sub + Private Sub CreaDT2() + Dim DTPorcentajeTemp As New DataTable + + Dim column As DataColumn = New DataColumn("No") + column.DataType = Type.GetType("System.Int32") + With column + .AutoIncrement = True + .AutoIncrementSeed = 1 + .AutoIncrementStep = 1 + End With + + DTPorcentajeTemp.Columns.Add(column) + DTPorcentajeTemp.Columns.Add("CvePS", GetType(Integer)) + DTPorcentajeTemp.Columns.Add("Producto", GetType(String)) + DTPorcentajeTemp.Columns.Add("PrecioG", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("PrecioA", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("Estatus", GetType(String)) + DTPorcentajePrecios = DTPorcentajeTemp.Clone + End Sub + Private Sub CargaPorcentajesProductos() + 'Llenar el dropdownlist de Secciones + If UsuarioActual.CveEmpresa = 66 Then + DdlClasificacion2.DataSource = GlobalDTSubFamilias(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion") + Else + Dim ObjClasificaciones As New ClsClasificaciones + If ObjClasificaciones.GetClasificacionesExistencias(UsuarioActual.CveEmpresa) Then + DdlClasificacion2.DataSource = ObjClasificaciones.DtResultados + End If + ObjClasificaciones.Dispose() + End If + DdlClasificacion2.DataBind() + + CargaPS() + CargaGridPorcentajes2() + + UpPorcentajeP.Update() + End Sub + Private Sub CargaPS() + DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + If UsuarioActual.CveEmpresa = 66 Then + DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios") + End If + + If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then + DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2") + + DdlProducto2.DataBind() + + DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + + End Sub + + Protected Sub DdlProducto2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlProducto2.selectedindexchange + DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2) + End Sub + Private Sub DdlProducto2IndexChange(CvePSParametro As Integer, Ddl As ADServerControl.Dropdownlost) + Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") + + If drPS IsNot Nothing Then + Dim Precio = drPS("Precio").ToString.ToDouble + LbPrecioG.Text = Precio.FormatoNumero() + LbPrecioA.Text = ((Precio * TxtPorcentajePS.Text.ToDecimal) / 100).FormatoNumero + End If + End Sub + + Private Sub CargaGridPorcentajes2() + Dim ObjPS As New ClsProductosServicios + + If ObjPS.GetPorcentajeProductos(CveCliente) Then + DTPorcentajePrecios = ObjPS.DtResultados + GvP.DataSource = DTPorcentajePrecios + End If + ObjPS.Dispose() + + GvP.DataBind() + UpPorcentajePS.Update() + + End Sub + Private Sub CargaDTPorcentajePrecios2(DtTemp As DataTable) + GvP.DataSource = DtTemp + GvP.DataBind() + + UpPorcentajePS.Update() + End Sub + + Private Sub LimpiaModalPorcentaje2() + TxtPorcentajePS.Text = "" + DdlClasificacion2.SelectedValue = "-1" + DdlProducto2.SelectedText = "" + End Sub + + Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click + + If DdlProducto2.SelectedText <> "" Then + If TxtPorcentajePS.Text.ToDecimal >= 0 And TxtPorcentajePS.Text.ToDecimal <= 100 Then + + Dim registro As DataRow = DTPorcentajePrecios.NewRow + + registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1 + registro.Item("CvePS") = DdlProducto2.SelectedValue.ToEntero + registro.Item("Producto") = DdlProducto2.SelectedText + registro.Item("PrecioG") = LbPrecioG.Text.ToDecimal + registro.Item("PrecioA") = LbPrecioG.Text.ToDecimal * TxtPorcentajePS.Text.ToDecimal / 100 + registro.Item("PorcentajeProducto") = TxtPorcentajePS.Text.ToDecimal + registro.Item("Estatus") = "I" + DTPorcentajePrecios.Rows.Add(registro) + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + Else + Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia) + End If + Else + Alert("El campo ''Producto'' es necesario, por favor ingréselo.", TipoMensaje.MsgAdvertencia) + End If + + LimpiaModalPorcentaje() + End Sub + + Protected Sub DeleteRow(sender As Object, e As EventArgs) + + Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) + + + If DTPorcentajePrecios.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then + Dim i As Integer + i = lnkRemove.CommandArgument.ToString.ToEntero + Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", i)) + If Drs.Count > 0 Then + If CveCliente > 0 AndAlso Drs(0)("CvePS").ToString.ToEntero > 0 Then + Drs(0)("Estatus") = "D" + Else + Drs(0).Delete() + End If + + End If + DTPorcentajePrecios.AcceptChanges() + End If + + GvP.EditIndex = -1 + + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + + End Sub + + Protected Sub GvP_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvP.RowEditing + GvP.EditIndex = e.NewEditIndex + + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + End Sub + Protected Sub GvP_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvP.RowCancelingEdit + GvP.EditIndex = -1 + + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + End Sub + Protected Sub GvP_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvP.RowUpdating + + Dim PorcentajeProducto As Double = GvP.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP").Text.ToDouble + + If PorcentajeProducto >= 0 And PorcentajeProducto <= 100 Then + Dim No As Integer = GvP.Rows(e.RowIndex).DataKey("No").ToEntero + + Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", No)) + + If Drs.Count > 0 Then + Drs(0)("PorcentajeProducto") = PorcentajeProducto + Drs(0)("PrecioA") = Drs(0)("PrecioG").ToString.ToDouble * PorcentajeProducto / 100 + If Drs(0)("Estatus").ToString <> "I" Then + Drs(0)("Estatus") = "U" + End If + End If + + DTPorcentajePrecios.AcceptChanges() + GvP.EditIndex = -1 + + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + Else + Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia) + End If + + End Sub + + Protected Sub BtnGuardarPorcentajes_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajes.Click + + Dim TieneError As Boolean = False + + Dim ObjPS As New ClsProductosServicios + ObjPS.IniciaTransacSQL() + + For Each Dr As DataRow In DTPorcentajePrecios.Rows + + If Dr("Estatus").ToString <> "" Then + + If Dr("Estatus").ToString = "I" Then + If Not ObjPS.AddPorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, UsuarioActual.CveUsuario) Then + TieneError = True + End If + ElseIf Dr("Estatus").ToString = "U" Then + If Not ObjPS.UpdatePorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal) Then + TieneError = True + End If + ElseIf Dr("Estatus").ToString = "D" Then + If Not ObjPS.RemovePorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero) Then + TieneError = True + End If + End If + + End If + Next + + If TieneError Then + ObjPS.RollBack() + Else + ObjPS.Commit() + Alert("Los Porcentajes se guardaron correctamente.", TipoMensaje.MsgInformacion) + RegistraScript("$('#DivPorcentajePrecios').modal('hide')", "hidemodal") + End If + + ObjPS.Dispose() + + End Sub + + Protected Sub BtnCambiaPorcentaje_Click(sender As Object, e As EventArgs) + DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2) + End Sub +#End Region + +#Region " A C U M U L A D O R E S" + + + Protected Sub LnkFacturaUsadosCargos_Click(sender As Object, e As EventArgs) + 'CveVentaNota = 0 + + 'Dim Cargos As Decimal = 0D + 'Dim Iva As Decimal = 0D + + 'For Each GvRow As GridViewRow In GvAcum.Rows + + ' If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then + ' Cargos = Cargos + GvRow.DataKey("ImporteCargo").ToDecimal + ' End If + 'Next + + 'Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Cargo Nota + 'Dim CveUnidadMedida As Integer + 'Dim CveClasificacion As Integer + + 'If CvePS > 0 Then + + ' If Cargos > 0 Then + + ' CveUnidadMedida = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero + ' CveClasificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveClasificacion").ToString.ToEntero + ' Iva = Cargos * 0.16D + + ' If GenerarNotaCredito(CvePS, 1, CveUnidadMedida, Cargos, Iva, "Clientes/Usados", CveClasificacion) Then + ' Alert($"LA nota de crédito fue generada correctamente {SerieNotaAcumulador}-{FolioNotaAcumulador}") + ' Else + ' Alert("Se presento un error al generar la nota de creédito", TipoMensaje.MsgError) + ' End If + ' End If + + 'Else + ' Alert("No esta asignada la funcionalidad CvePS Distruibuidor Cargo Nota") + 'End If + + CreaObjetosVenta(1) + + 'If ObjFactura.CveCliente > 0 Then + ' If TmpDT.Rows.Count > 0 Then + ' Dim Retorno = ObjFactura.EmitirFactura(false) + ' For Each Mensaje In Retorno.Mensajes + ' Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion)) + ' Next + ' End If + 'End If + + CargaUsados() + + End Sub + Protected Sub LnkFacturaUsadosBonificacion_Click(sender As Object, e As EventArgs) + + 'CveVentaNota = 0 + 'Dim Bonificacion As Decimal = 0D + 'Dim Iva As Decimal = 0D + + 'For Each GvRow As GridViewRow In GvAcum.Rows + ' If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then + ' Bonificacion = Bonificacion + GvRow.DataKey("ImporteBonificacion").ToDecimal + ' End If + 'Next + + + 'Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Bonificación Nota + 'Dim CveUnidadMedida As Integer + 'Dim CveClasificacion As Integer + 'If CvePS > 0 Then + ' If Bonificacion > 0 Then + + ' CveUnidadMedida = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero + ' CveClasificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveClasificacion").ToString.ToEntero + ' Iva = Bonificacion * 0.16D + + ' If GenerarNotaCredito(CvePS, 2, CveUnidadMedida, Bonificacion, Iva, "Clientes/Usados", CveClasificacion) Then + ' Alert($"LA nota de crédito fue generada correctamente {SerieNotaAcumulador}-{FolioNotaAcumulador}") + ' Else + ' Alert("Se presento un error al generar la nota de creédito", TipoMensaje.MsgError) + ' End If + + ' End If + + 'Else + ' Alert("No esta asignada la funcionalidad CvePS Distruibuidor Bonificación Nota") + 'End If + + CreaObjetosVenta(2) + + If ObjFactura.CveCliente > 0 Then + If TmpDT.Rows.Count > 0 Then + Dim Retorno = ObjFactura.EmitirFactura(False) + For Each Mensaje In Retorno.Mensajes + Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion)) + Next + End If + End If + + Alert("Listo") + + CargaUsados() + + + End Sub + + + Function FolioNotaCredito(Tipo As Integer) As Boolean + + FolioNotaAcumulador = 0 + SerieNotaAcumulador = "" + Dim Respuesta As Boolean = False + + Dim ObjFolios As New ClsGralFolios() + + Dim DTSucursales As DataTable = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1).FiltraParametros("EsSucursal = True ") + + If DTSucursales.Rows.Count > 0 Then + + If ObjFolios.GetFolios("RNC", UsuarioActual.CveEmpresa) Then + Dim CveSubProyecto As Integer = DTSucursales.FiltroPrimeroValor("CveSubProyecto", "").ToEntero + Dim DT As DataTable + If CveSubProyecto > 0 Then + DT = ObjFolios.DtResultados.FiltraParametros(" Estado = 'Activo' AND LEN(Serie) > 0 AND CveSubProyecto = " & CveSubProyecto) + Else + DT = ObjFolios.DtResultados.FiltraParametros(" Estado = 'Activo' AND LEN(Serie) > 0 ") + End If + + If DT.Rows.Count > 0 Then + FolioNotaAcumulador = DT.Rows(0)("FActual").ToString.ToEntero + SerieNotaAcumulador = DT.Rows(0)("Serie").ToString + Respuesta = True + End If + + End If + End If + + ObjFolios.Dispose() + + Return Respuesta + + End Function + + Private Sub GvAcum_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAcum.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DataKey("CveConcepto").ToEntero = 1 Then + + Dim FacturadoCargo As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoCargo")) + Dim FacturadoBonificacion As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoBonificacion")) + + If FacturadoCargo Then + e.Row.FCCheckBox("ChkCargo").Checked = False + e.Row.FCCheckBox("ChkCargo").Visible = False + Else + e.Row.FCCheckBox("ChkCargo").Checked = False + e.Row.FCCheckBox("ChkCargo").Visible = False 'True + End If + + If FacturadoBonificacion Then + e.Row.FCCheckBox("ChkBonificacion").Checked = False + e.Row.FCCheckBox("ChkBonificacion").Visible = False + Else + e.Row.FCCheckBox("ChkBonificacion").Checked = False + e.Row.FCCheckBox("ChkBonificacion").Visible = True + End If + + Else + e.Row.FCCheckBox("ChkCargo").Checked = False + e.Row.FCCheckBox("ChkCargo").Visible = False + + e.Row.FCCheckBox("ChkBonificacion").Checked = False + e.Row.FCCheckBox("ChkBonificacion").Visible = False + End If + + End If + + End Sub + + Protected Sub BtnConsultaUsados_Click(sender As Object, e As EventArgs) + CargaUsados() + End Sub + + Private Sub CargaUsados() + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' Funcionalidad Es Distribuidor + + DivEsDistribuidor.Visible = True + TabUsados.Visible = True + + Dim ObjAcum As New ClsAcumuladores + Dim ImporteCargo As Decimal = 0D + Dim ImporteBonificacion As Decimal = 0D + + If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, TxtFechaIUsados.Text.ToDate, TxtFechaFUsados.Text.ToDate) Then + + GvAcum.DataSource = ObjAcum.DtResultados + + LblUsadosPuntos.Text = (ObjAcum.DtResultados.SUM("Puntos", " CveConcepto = 2 ") - ObjAcum.DtResultados.SUM("Puntos", " CveConcepto IN (1,3) ")).ToDecimal.FormatoNumero(2) + + ImporteCargo = ObjAcum.DtResultados.SUM("ImporteCargo", "(FacturadoCargo = 0 OR FacturadoCargo IS NULL) AND CveConcepto = 1 ").ToDecimal + ImporteBonificacion = ObjAcum.DtResultados.SUM("ImporteBonificacion", "(FacturadoBonificacion = 0 OR FacturadoBonificacion IS NULL) AND CveConcepto = 1 ").ToDecimal + + LblUsadosImpCargo.Text = ImporteCargo.FormatoNumero(2) + LblusadosImpBonificacion.Text = ImporteBonificacion.FormatoNumero(2) + + Else + GvAcum.DataSource = Nothing + + ImporteCargo = 0D + ImporteBonificacion = 0D + + LblUsadosImpCargo.Text = "" + LblusadosImpBonificacion.Text = "" + LblUsadosPuntos.Text = "" + + End If + + 'LnkFacturaUsadosCargos.Visible = If(ImporteCargo > 0, True, False) + LnkFacturaUsadosBonificacion.Visible = If(ImporteBonificacion > 0, True, False) + + ObjAcum.Dispose() + GvAcum.DataBind() + + UpAcciones.Update() + UpUsadosResumen.Update() + UpAcum.Update() + + End If + + End Sub + + Private Sub CreaDTVentas() + TmpDT = New DataTable + TmpDT.Columns.Add("CveVenta", GetType(Integer)) + TmpDT.Columns.Add("Consec", GetType(Integer)) + TmpDT.Columns.Add("Cantidad", GetType(Decimal)) + TmpDT.Columns.Add("Codigo", GetType(String)) + TmpDT.Columns.Add("CveUM", GetType(Integer)) + TmpDT.Columns.Add("UM", GetType(String)) + TmpDT.Columns.Add("SATClaveUM", GetType(String)) + TmpDT.Columns.Add("CveClasificacion", GetType(Integer)) + TmpDT.Columns.Add("Clasificacion", GetType(String)) + TmpDT.Columns.Add("CvePS", GetType(Integer)) + TmpDT.Columns.Add("PS", GetType(String)) + TmpDT.Columns.Add("CodigoPS", GetType(String)) + TmpDT.Columns.Add("SATClaveProdServ", GetType(String)) + TmpDT.Columns.Add("NoIdentificacion", GetType(String)) + TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) + TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) + TmpDT.Columns.Add("SerieLote", GetType(String)) + TmpDT.Columns.Add("CuentaPredial", GetType(String)) + TmpDT.Columns.Add("Obs", GetType(String)) + TmpDT.Columns.Add("TiempoEntrega", GetType(String)) + TmpDT.Columns.Add("PU", GetType(Decimal)) + TmpDT.Columns.Add("IVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteIVA", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal)) + TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal)) + TmpDT.Columns.Add("IEPS", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal)) + TmpDT.Columns.Add("Descuento", GetType(Decimal)) + TmpDT.Columns.Add("TipoDescuento", GetType(Integer)) + TmpDT.Columns.Add("TotalImporte", GetType(Decimal)) + TmpDT.Columns.Add("Total", GetType(Decimal)) + 'Para uso del módulo contable + TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer)) + TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer)) + TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean)) + TmpDT.Columns.Add("CveProyecto", GetType(Integer)) + TmpDT.Columns.Add("Proyecto", GetType(String)) + TmpDT.Columns.Add("CveSubProyecto", GetType(Integer)) + TmpDT.Columns.Add("SubProyecto", GetType(String)) + TmpDT.Columns.Add("CveVentaDetallePadre", GetType(Integer)) + + 'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto + TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer)) + TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer)) + 'Contratos + TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) + 'Remisiones a Facturas + TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer)) + TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer)) + TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer)) + + 'Pedido2 a Facturas + TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer)) + + TmpDT.Columns.Add("Origen", GetType(Integer)) + 'Ordenes Servicio + TmpDT.Columns.Add("CveOS", GetType(Integer)) + TmpDT.Columns.Add("CveOSDetalle", GetType(Integer)) + TmpDT.Columns.Add("SeFacturara", GetType(Integer)) + TmpDT.Columns.Add("Folio", GetType(Integer)) + TmpDT.Columns.Add("Estatus", GetType(String)) + 'Ordenamiento + TmpDT.Columns.Add("Orden", GetType(Integer)) + TmpDT.Columns.Add("TipoDocto", GetType(String)) + 'OC + TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) + TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) + + TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) + TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal)) + TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal)) + TmpDT.Columns.Add("CantidadFacturadaPed2", GetType(Decimal)) + TmpDT.Columns.Add("CantidadInventario", GetType(Decimal)) + + TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String)) + TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String)) + TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String)) + TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) + + TmpDT.Columns.Add("CveTamaño", GetType(Integer)) + TmpDT.Columns.Add("EsCargo", GetType(Boolean)) + + End Sub + Private Function AgregarProductoServicio(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, + PU As Decimal, Descuento As Decimal, + CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, + Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, + Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, + Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, + Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False, Optional PorcentajeIVA As Decimal = 0D) As Boolean + + Dim Retorno As Boolean = False + If Not CvePS > 0 Then + Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Return False + End If + + If (Obs.Length + PS.Length > 1000) Then + Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia) + Return False + End If + + + Dim Row As DataRow = Nothing + Dim TotalCalculableImpuestos As Decimal = 0 + PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos + + Row = TmpDT.NewRow() + Row("CveProyecto") = CveProyecto + Row("Proyecto") = Proyecto + Row("CveSubProyecto") = CveSubProyecto + Row("SubProyecto") = SubProyecto + Row("SerieLote") = SerieLote + Row("TiempoEntrega") = TiempoEntrega + Row("Orden") = TmpDT.Rows.Count + 1 + Row("Cantidad") = Cantidad + Row("CveUM") = CveUM + Row("UM") = UM + Row("CveClasificacion") = CveClasificacion + Row("Clasificacion") = Clasificacion + Row("CvePS") = CvePS + Row("Obs") = Obs + + + + Dim DrPS As DataRow = Nothing + + DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 + + If DrPS Is Nothing Then + Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Return False + End If + + + DrPS("IEPSPorcentaje") = 0 + + 'verifica si tiene ventaminima + If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then + 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... + If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then + Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString)) + Return False + End If + End If + + TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento + + Row("PU") = PU + Row("Codigo") = DrPS("Codigo") + Row("NoIdentificacion") = DrPS("Codigo") + Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria") + Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana") + Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion") + Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion") + Row("Consec") = TmpDT.Rows.Count + 1 + + Row("PS") = DrPS("PS") + Row("CodigoPS") = DrPS("PSCodigo").ToString + Row("CveTipoPS") = DrPS("CveTipoPS") + Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") + Row("CveTamaño") = DrPS("CveTamaño") + + If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion") + If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") + + Row("PorcentajeIVA") = PorcentajeIVA + + Row("IVA") = Row("PorcentajeIVA") + Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + + + Row("ImporteRetIVA") = 0 + Row("ImporteRetISR") = 0 + Row("PorcentajeRetIVA") = 0 + Row("PorcentajeRetISR") = 0 + Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") + Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + Row("IEPS") = Row("ImporteIEPS") + Row("Descuento") = Math.Round(Descuento, NumeroDecimales) + Row("TipoDescuento") = 0 + Row("Total") = (Cantidad * PU) + Row("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales) + 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas") + ' Row("IdCtaContVentas") = IdCtaContable + ' Row("AplicaParaConcepto") = AplicaParaConcepto + + Row("SATClaveProdServ") = DrPS("SATClavePS") + Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") + + + Row("EntregaDirecta") = EntregaDirecta + 'Contratos + Row("CveContratoDetalle") = CveContratoDetalle + Row("CveVentaDetalle") = CveVentaDetalle + Row("CveMovimientoDetallePedido") = CveVentaDetalle + Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle + Row("CveVentaDetalleRemision") = CveVentaDetalleRemision + Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion + Row("CveVentaDetallePedido2") = CveVentaDetallePedido2 + Row("CuentaPredial") = CuentaPredial + Row("EsCargo") = EsCargo + + 'RECARGAR GV + TmpDT.Rows.Add(Row) + TmpDT.AcceptChanges() + Retorno = True + Return Retorno + + End Function + Private Sub CreaObjetosVenta(Tipo As Integer) + + Dim SubTotal As Decimal = 0D + Dim IVA As Decimal = 0D + + For Each GvRow As GridViewRow In GvAcum.Rows + If Tipo = 1 Then + If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then + SubTotal = SubTotal + GvRow.DataKey("ImporteCargo").ToDecimal + End If + ElseIf Tipo = 2 Then + If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then + SubTotal = SubTotal + GvRow.DataKey("ImporteBonificacion").ToDecimal + End If + End If + Next + + Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Bonificación Nota + Dim CveUnidadMedida As Integer = 0 + Dim CveClasificacion As Integer = 0 + Dim UnidadMedida As String = "" + Dim Clasificacion As String = "" + Dim PS As String = "" + Dim PorcentajeIVA As Decimal = 0D + If CvePS > 0 Then + If SubTotal > 0 Then + Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0) + If Dr IsNot Nothing Then + CveUnidadMedida = Dr("CveUnidadMedida").ToString.ToEntero + CveClasificacion = Dr("CveClasificacion").ToString.ToEntero + PS = Dr("PSCodigo").ToString + UnidadMedida = Dr("UnidadMedida").ToString + Clasificacion = Dr("Clasificacion").ToString + End If + PorcentajeIVA = 0.16D + IVA = SubTotal * PorcentajeIVA + End If + End If + + TmpDT.Rows.Clear() + TmpDT.AcceptChanges() + AgregarProductoServicio(1, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "Clientes/Usados", SubTotal, 0, -1, "", DdlSubProyecto.SelectedValue.ToEntero, + DdlSubProyecto.SelectedItem.Text, PorcentajeIVA:=PorcentajeIVA) + + Dim Folio As Integer = -1 + Dim Serie As String = "" + + 'If FolioNotaCredito(Tipo) Then + ' Folio = FolioNotaAcumulador + ' Serie = SerieNotaAcumulador + 'End If + + If ObjFactura IsNot Nothing Then + ObjFactura.Dispose() + ObjFactura = Nothing + End If + + ObjFactura = New Modelos.Factura(UsuarioActual) + ObjFactura.CveUsuario = UsuarioActual.CveUsuario + ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa + ObjFactura.CveVenta = -1 + ObjFactura.Version = "3.3" + ObjFactura.TipoCambio = 1 + ObjFactura.TipoCambioDolares = 0 + ObjFactura.ConvertirPesos = False + ObjFactura.ConvertirDolares = False + ObjFactura.CveMoneda = 1 + ObjFactura.Moneda = "Pesos" + ObjFactura.MonedaSAT = "MXN" + ObjFactura.TipoDocto = "RNC" + + ObjFactura.Folio = Folio + ObjFactura.Serie = Serie + + ObjFactura.Fecha = Now + ObjFactura.CvePrePoliza = -1 + ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero + ObjFactura.MetodoPago = DdlMetodoPago.SelectedItem.Text + ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago.SelectedValue}") + ObjFactura.FechaVencimiento = TxtFechaPago.Text.ToDate + + ObjFactura.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero + ObjFactura.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero > 0, DdlMetodoPago33.SelectedItem.Text, "") + ObjFactura.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") + + ObjFactura.CveFormaPago33 = DdlFormaPago33.SelectedValue.ToEntero + ObjFactura.FormaPago33 = If(DdlFormaPago33.SelectedValue.ToEntero > 0, DdlFormaPago33.SelectedItem.Text, "") + ObjFactura.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {DdlFormaPago33.SelectedValue}") + + ObjFactura.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero + ObjFactura.UsoCFDI = If(DdlUsoCFDI.SelectedValue.ToEntero > 0, DdlUsoCFDI.SelectedItem.Text, "") + ObjFactura.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") + + ObjFactura.UsuarioCreo = UsuarioActual.Nombre + ObjFactura.CveCondicionEntrega = -1 + ObjFactura.CondicionEntrega = "" + + ObjFactura.CondicionesPago = 0 ' 0 - Contado, 1 - Credito, 2 - termianl + ObjFactura.FormaPago = 0 + + ObjFactura.AtnA = "" + ObjFactura.FordGSDB = "" + + ObjFactura.NumeroContrato = "" + ObjFactura.DescripcionContrato = "" + ObjFactura.NumeroDescripcionContrato = "" + ObjFactura.PedidoContrato = "" + ObjFactura.OrdenCompra = "" + + Select Case ObjFactura.TipoDocto + Case "Ing" + ObjFactura.TipoDocumento = "Factura" + Case "Rem" + ObjFactura.TipoDocumento = "Remision" + Case "Cot" + ObjFactura.TipoDocumento = "Cotizacion" + Case "Egs" + ObjFactura.TipoDocumento = "Nota de Crédito" + Case "Dev" + ObjFactura.TipoDocumento = "Nota de Devolución" + Case "DPe" + ObjFactura.TipoDocumento = "Devolución de pedido" + Case "PeC" + ObjFactura.TipoDocumento = "Consignación de Pedido" + Case Else + ObjFactura.TipoDocumento = "" + End Select + + ObjFactura.Fech1 = Now + ObjFactura.Fech2 = Now + ObjFactura.Fech3 = Now + + ObjFactura.Alfa1 = "" + ObjFactura.Alfa2 = "" + ObjFactura.Alfa3 = "" + + ObjFactura.Num1 = 0 + ObjFactura.Num2 = 0 + + ObjFactura.Num3 = 0 + ObjFactura.FechaPago = Now + + ObjFactura.CveCorte = -1 + ObjFactura.CveMesa = -1 + ObjFactura.NumeroPersonas = 0 + ObjFactura.CveContrato = -1 + + ObjFactura.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero + ObjFactura.Entrega = "" + ObjFactura.Vigencia = Now + + ObjFactura.CveVentaPadre = -1 + + ObjFactura.CveVendedor = DdlVendedor.SelectedValue.ToEntero + If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then + DdlVendedor.Enabled = False + End If + + ObjFactura.FechaEjecucion = Now + ObjFactura.CveSubProyecto = UsuarioActual.CveSubProyecto + ObjFactura.CveSubProyectoCobranza = UsuarioActual.CveSubProyecto + ObjFactura.CveSubProyectoEjecucion = UsuarioActual.CveSubProyecto + ObjFactura.AtencionA = "-1" + ObjFactura.MotivoDescuento = "" + ObjFactura.Observaciones = "" + ObjFactura.Det_OrdenCompra = "" + ObjFactura.Det_FechaOrdenCompra = "" + ObjFactura.MonedaAbreviatura = "" + + ObjFactura.SubTotal = SubTotal + ObjFactura.Descuento = 0 + ObjFactura.Amortizacion = 0 + ObjFactura.IVA = IVA + ObjFactura.RetIVA = 0 + ObjFactura.RetISR = 0 + ObjFactura.IEPS = 0 + ObjFactura.Total = SubTotal + IVA + ObjFactura.DtDetalle = TmpDT + ObjFactura.DtPagos = DtPagos + ObjFactura.DtPromociones = DtPromociones + + '' CLIENTE + ObjFactura.CveCliente = CveCliente + ObjFactura.SetCliente() + + ''SUCURSAL + + ObjFactura.SetSubProyectoMatriz(Me) + ObjFactura.SetSubProyecto(Me) + ObjFactura.ClienteSucursal = New Modelos.SucursalModel + + If ObjFactura.Timbre.Comprobante.TipoComprobante = "E" Then + If ObjFactura.TipoDocumento.Contiene("Nota de Crédito") Then + ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "01" + ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" + End If + If ObjFactura.TipoDocumento.Contiene("Nota de Devolución") Then + ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "03" + ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" + End If + + End If + + If ObjFactura.TipoDocto.Contiene("Egs", "RNC") Then + ObjFactura.CveTipoRelacion = -1 + End If + + Dim UsadosBonificacion As List(Of Integer) = New List(Of Integer) + For Each GvRow As GridViewRow In GvAcum.Rows + Dim CveMovto As Integer = GvRow.DataKey("CveMovto").ToEntero + If (Tipo = 1 And GvRow.FCCheckBox("ChkCargo").Checked) Or (Tipo = 2 And GvRow.FCCheckBox("ChkBonificacion").Checked) Then + UsadosBonificacion.Add(CveMovto) + End If + Next + + ObjFactura.UsadosBonificacion = UsadosBonificacion + ObjFactura.TipoBonificacion = Tipo + + Dim FM As New Modelos.FemsaFactura + Dim TmpDT7Eleven As New DataTable + Dim TmpDTComplementosTimbrado As New DataTable + + 'PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) + + ObjFactura.FemsaFactura = FM + + ' ObjFactura.Timbre = PreParaTimbre(ObjFactura) + + End Sub + + 'Private Sub PrepararTimbrado(ByRef FM As Modelos.FemsaFactura, ByRef TmpDT7Eleven As DataTable, ByRef TmpDTComplementosTimbrado As DataTable) + ' FM.AplicaFEMSA = ChkAplicaFEMSA.Checked + ' FM.FEMSA_NumSociedad = "" + ' FM.FEMSA_NumProveedor = "" + ' FM.FEMSA_Mail = "" + ' FM.FEMSA_Version = "".ToEntero + ' FM.FEMSA_NumPedido = "".ToEntero + ' FM.FEMSA_NumEntrada = "" + ' FM.FEMSA_NumRemision = "" + ' FM.FEMSA_NumSocio = "" + ' FM.FEMSA_CentroCosto = "" + ' FM.FEMSA_IPeriodoLiquidacion = "" + ' FM.FEMSA_FPeriodoLiquidacion = "" + ' FM.FEMSA_CodRetencion1 = "" + ' FM.FEMSA_CodRetencion2 = "" + + ' TmpDT7Eleven.Columns.Add("sevenElevenNumProveedor") + ' TmpDT7Eleven.Columns.Add("sevenElevenFolio") + ' TmpDT7Eleven.Columns.Add("sevenElevenTienda") + ' TmpDT7Eleven.Columns.Add("sevenElevenFecha") + + ' Dim Row As DataRow = TmpDT7Eleven.NewRow + ' Row("sevenElevenNumProveedor") = "" + ' Row("sevenElevenFolio") = "" + ' Row("sevenElevenTienda") = "" + ' Row("sevenElevenFecha") = "" + + ' TmpDT7Eleven.Rows.Add(Row) + + ' TmpDTComplementosTimbrado.Columns.Add("CveComplemento") + ' TmpDTComplementosTimbrado.Columns.Add("IdContabilidad") + ' TmpDTComplementosTimbrado.Columns.Add("TipoProceso") + ' TmpDTComplementosTimbrado.Columns.Add("TipoAmbito") + ' TmpDTComplementosTimbrado.Columns.Add("Entidad") + + ' Dim Row2 As DataRow = TmpDTComplementosTimbrado.NewRow + ' Row2("CveComplemento") = -1 + ' Row2("IdContabilidad") = -1 + ' Row2("TipoProceso") = -1 + ' Row2("TipoAmbito") = -1 + ' Row2("Entidad") = -1 + + ' TmpDTComplementosTimbrado.Rows.Add(Row2) + 'End Sub + + 'Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre + ' Dim Timbre As New CFDITimbre + ' Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) + ' Timbre.Comprobante.Folio = Obj.Folio.ToString + ' Timbre.Comprobante.Serie = Obj.Serie + ' Timbre.Comprobante.Fecha = Obj.FechaCP + ' Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 + ' Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 + ' Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT + ' Timbre.Comprobante.Subtotal = Obj.SubTotal + ' Timbre.Comprobante.Descuentos = Obj.Descuento + ' Timbre.Comprobante.Moneda = Obj.MonedaSAT + ' Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) + ' Timbre.Comprobante.Total = Obj.Total + + ' Try + ' Obj.SetSubProyecto(Me) + ' Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP + ' Catch ex As Exception + + ' End Try + + ' Timbre.Comprobante.Confirmacion = "" + + ' Timbre.Receptor.RFC = Obj.Cliente.RFC + ' Timbre.Receptor.Nombre = Obj.Cliente.Nombre + ' Timbre.Receptor.ResidenciaFiscal = "" + ' Timbre.Receptor.NumeroRegistroTributario = "" + ' Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI + + + ' If Obj.CveTipoRelacion > 0 Then + ' Select Case Obj.CveTipoRelacion + ' Case 1 + ' Timbre.CFDIRelacionados.TipoRelacion = "01" + ' Timbre.CFDIRelacionados.TipoRelacionTexto = "01-Nota de Crédito aplicada a Ingreso" + ' Case 2 + ' Timbre.CFDIRelacionados.TipoRelacion = "02" + ' Timbre.CFDIRelacionados.TipoRelacionTexto = "02-Nota de débito de los documentos relacionados" + ' Case 3 + ' Timbre.CFDIRelacionados.TipoRelacion = "03" + ' Timbre.CFDIRelacionados.TipoRelacionTexto = "03-Devolución aplicada a Ingreso" + ' Case 4 + ' Timbre.CFDIRelacionados.TipoRelacion = "04" + ' Timbre.CFDIRelacionados.TipoRelacionTexto = "04-Refacturación de Ingreso" + ' Case 7 + ' Timbre.CFDIRelacionados.TipoRelacion = "07" + ' Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo" + ' Case 8 + ' Timbre.CFDIRelacionados.TipoRelacion = "08" + ' Timbre.CFDIRelacionados.TipoRelacionTexto = "08-Factura generada por pagos en parcialidades " + ' Case 9 + ' Timbre.CFDIRelacionados.TipoRelacion = "09" + ' Timbre.CFDIRelacionados.TipoRelacionTexto = "09-Factura generada por pagos diferidos" + + ' End Select + ' End If + + ' Dim totSubTotal As Decimal = Obj.SubTotal + ' Dim totIVA As Decimal = Obj.IVA + ' Dim totRetIVA As Decimal = Obj.RetIVA + ' Dim totRetISR As Decimal = Obj.RetISR + ' Dim TasaRetIVA As Decimal = 0 + ' Dim TasaRetISR As Decimal = 0 + ' Dim i As Integer = 1 + + ' 'detalles + ' Dim tPS As String = "" + + ' For Each drr As DataRow In Obj.DtDetalle.Rows + ' If drr("PS").ToString.Length = 1 Then + ' tPS = drr("Obs").ToString + ' Else + ' If drr("PS").ToString.Length = 0 Then + ' tPS = "" + ' Else + ' tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) + ' End If + ' End If + ' 'condicionante, especial + ' If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" ' les comentan que no debe de ir la etiqueta de "unidad" en el producto + + ' Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal, + ' .Descripcion = tPS, + ' .ValorUnitario = drr("PU").ToString.ToDecimal, + ' .Importe = drr("TotalImporte").ToString.ToDecimal, + ' .Descuento = drr("Descuento").ToString.ToDecimal, + ' .Unidad = drr("UM").ToString, + ' .ClaveUnidad = drr("SATClaveUM").ToString, + ' .ClaveProdServ = drr("SATClaveProdServ").ToString, + ' .Noidentificacion = drr("Noidentificacion").ToString, + ' .CuentaPredial = drr("CuentaPredial").ToString} + ' 'verifica suma subtotales + ' If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales + ' concepto.Importe = totSubTotal + ' End If + ' totSubTotal = totSubTotal - concepto.Importe + + ' 'siempre estaremos agregando el iva, auqnue sea en importe cero o tasa cero, para que se emita la factura + ' ' If drr("ImporteIVA").ToString.ToDouble > 0 Then + + ' 'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos + ' If Timbre.Comprobante.Total > 0 Then + ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) + ' End If + + ' If drr("ImporteIEPS").ToString.ToDouble > 0 Then + ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal}) + ' End If + + ' If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones + ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetIVA, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal}) + ' End If + + ' If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR + ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetISR, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal}) + ' End If + + ' Timbre.Conceptos.Add(concepto) + ' i += 1 + ' Next + + ' Return Timbre + 'End Function + + 'Private Function GenerarNotaCredito(CvePS As Integer, Tipo As Integer, CveUnidadMedida As Integer, Importe As Decimal, Iva As Decimal, Descripcion As String, CveClasificacion As Integer) As Boolean + + ' Dim Respuesta As Boolean = False + + ' Dim ObjVentas As New ClsVentas + ' Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) + ' Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL()) + + ' Dim ErrorVentas As Boolean = False + ' Dim SubTotal As Decimal = Importe + ' Dim Total As Decimal = Importe + Iva + + ' Dim RetIVA As Decimal = 0 + ' Dim RetISR As Decimal = 0 + ' Dim TipoCambio As Decimal = 0 + ' Dim FechaVencimiento As Date = Now + ' Dim fecha As Date = Now + + ' Dim Folio As Integer = 0 + ' Dim Serie As String = "" + + ' If FolioNotaCredito() Then + ' Folio = FolioNotaAcumulador + ' Serie = SerieNotaAcumulador + ' End If + + ' Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero + + ' Dim CveVenta As Integer + + ' If Folio > 0 Then + + ' Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas($"Clientes/{Descripcion}", 1, Total, Total, 1, fecha, "Nota de crédito por Cargo", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + ' If ObjVentas.AddVenta("Egs", Folio, CveCliente.ToEntero, -1, SubTotal, 0, 0, Iva, RetIVA, RetISR, Total, 1, TipoCambio, + ' 0, 0, 0, FechaVencimiento, fecha, "", "", fecha, -1, "", "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, -1, 0, CvePrePoliza, + ' UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Serie:=Serie, CveSubProyecto:=CveSubProyecto, CveSubProyectoEjecucion:=CveSubProyecto) Then + + ' CveVenta = ObjVentas.CveVenta + + ' If CveVenta > 0 Then + ' If ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, 0.16, SubTotal * 0.16, Descripcion, 0, 0, -1, 0) Then + + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, Folio.ToString, 150, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, ImporteMX:=SubTotal, CveSubProyecto:=CveSubProyecto) Then + ' ErrorVentas = True + ' End If + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio.ToString, 12, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total) Then + ' ErrorVentas = True + ' End If + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Iva, Folio.ToString, 13, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Iva) Then + ' ErrorVentas = True + ' End If + + ' If Not ErrorVentas Then + ' For Each GvRow As GridViewRow In GvAcum.Rows + ' Dim CveMovto As Integer = GvRow.DataKey("CveMovto").ToEntero + + ' If (Tipo = 1 And GvRow.FCCheckBox("ChkCargo").Checked) Or (Tipo = 2 And GvRow.FCCheckBox("ChkBonificacion").Checked) Then + + ' If ObjAcum.DistribuidorActualizarFacturados(CveMovto, UsuarioActual.CveEmpresa, Tipo, CveVenta) Then + ' Respuesta = True + ' ErrorVentas = False + ' CveVentaNota = CveVenta + ' Else + ' Respuesta = False + ' ErrorVentas = True + ' CveVentaNota = 0 + ' Exit For + ' End If + + ' End If + ' Next + ' End If + + + ' If Not ErrorVentas Then + ' Alert($"Nota de crédito generada correctamente {Serie}-{Folio}") + ' End If + + + ' Else + ' ErrorVentas = True + ' End If + ' Else + ' ErrorVentas = True + ' End If + + ' Else + ' ErrorVentas = True + ' End If + ' Else + ' Alert("No se pudo obtener el Folio.", TipoMensaje.MsgError) + ' End If + + + + ' If ErrorVentas Then + ' ObjVentas.RollBack() + ' Else + + ' ObjVentas.Commit() + ' CargaUsados() + + ' 'Dim DtDetallesVenta As New DataTable + + ' 'If ObjVentas.GetVentaDetalle(CveVenta) Then + + ' ' DtDetallesVenta = ObjVentas.DtResultados + ' ' 'CreaObjetosVenta(CveVenta, Serie, Folio, SubTotal, Iva, DtDetallesVenta) + + ' ' ObjFactura.Timbre = PreParaTimbre(ObjFactura, ObjFactura.CveSubProyecto) + + ' ' Dim ObjTimbrado As New Timbrado + ' ' Dim SeTimbro As Boolean = False + + ' ' SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) + + ' ' If SeTimbro Then + ' ' Alert("Se timbro correctamente") + ' ' Else + ' ' Alert("No se pudo timbrar, intente mas tarde.", TipoMensaje.MsgError) + ' ' End If + + ' 'Else + ' ' Alert("No se pudo timbrar, no se pudieron obtener los detalles de la venta.", TipoMensaje.MsgError) + ' 'End If + + ' End If + + + + ' ObjVentas.Dispose() + ' Return Respuesta + + 'End Function + 'Private Function generaNC(CveVenta As Integer, ByRef ObjVentas As ClsVentas, ByVal factura As Modelos.Factura) As List(Of Object) + + ' Dim Obj As New List(Of Object) + ' Dim CveVentaNueva As Integer = ObjVentas.CveVenta + ' Dim BanderaGeneraNC As Boolean = False + ' If UsuarioActual.CveEmpresa.Contiene(1, 119) Then BanderaGeneraNC = True + + ' If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + ' If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + ' Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) + ' Dim TmpDTconceptos As DataTable = Nothing + + ' ''CargaCliente + + ' Dim CveCliente As Integer = drv("CveCliente").ToString.ToEntero + ' If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then + ' Return Nothing + ' ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then + ' Return Nothing + ' End If + ' factura.TipoDocto = drv("TipoDocto").ToString + ' factura.Serie = drv("Serie").ToString + ' factura.FechaEjecucion = drv("FechaEjecucion").ToString.ToDateTime + ' factura.Fecha = drv("Fecha").ToString.ToDateTime + ' factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString.ToEntero + ' factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString.ToEntero + ' factura.CveClienteSucursal = drv("CveClienteSucursal").ToString.ToEntero + ' factura.CveSubProyecto = drv("CveSubProyecto").ToString.ToEntero + + + ' ''CargaDetalle + ' If ObjVentas.GetVentaDetalle(CveVenta) Then + ' TmpDTconceptos = ObjVentas.DtResultados + ' TmpDTconceptos.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) + ' GvPS.DataSource = TmpDTconceptos + ' GvPS.DataBind() + ' End If + + ' '' Carga Totales + ' factura.SubTotal = drv("SubTotal").ToString.ToDecimal + ' factura.Descuento = drv("Descuento").ToString.ToDecimal + ' factura.Amortizacion = drv("Amortizacion").ToString.ToDecimal + ' factura.IVA = drv("IVA").ToString.ToDecimal + ' factura.RetIVA = drv("RetIVA").ToString.ToDecimal + ' factura.RetISR = drv("RetISR").ToString.ToDecimal + ' factura.Total = drv("Total").ToString.ToDecimal + ' factura.MotivoDescuento = drv("MotivoDescuento").ToString + ' factura.Observaciones = drv("Observaciones").ToString + ' factura.CveMoneda = drv("CveMoneda").ToString.ToEntero + ' factura.TipoCambio = drv("TipoCambio").ToString.ToDecimal + ' factura.CveVendedor = drv("CveVendedor").ToString.ToEntero + ' factura.RefDocto = drv("Ref").ToString + + ' If factura.CveCliente > 0 Then + ' If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then + + ' If Not drv("Total").ToString.ToDecimal = factura.Total Then + ' Return Nothing + ' End If + + + + ' End If + ' End If + ' End If + ' End If + + ' If Obj.Count > 0 Then + ' Return Obj + ' Else + ' Return Nothing + ' End If + + 'End Function + + 'Private Function PreParaTimbre(Obj As Modelos.Factura, CveSubProyecto As Integer) As CFDITimbre + + ' Dim Timbre As New CFDITimbre + ' Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) + ' Timbre.Comprobante.Folio = Obj.Folio.ToString + ' Timbre.Comprobante.Serie = Obj.Serie + ' Timbre.Comprobante.Fecha = Obj.Fecha + ' Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 + ' Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 + ' Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT + ' Timbre.Comprobante.Subtotal = Obj.SubTotal + + ' Timbre.Comprobante.Descuentos = Obj.Descuento + ' Timbre.Comprobante.Moneda = Obj.MonedaSAT + ' Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) + ' Timbre.Comprobante.Total = Obj.Total + + ' Try + ' Obj.SetSubProyecto(Me) + ' Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP + ' Catch ex As Exception + + ' End Try + + ' Timbre.Comprobante.Confirmacion = "" + + ' Timbre.Receptor.RFC = TxtRFC.Text + ' Timbre.Receptor.Nombre = TxtNombre.Text + ' Timbre.Receptor.ResidenciaFiscal = "" + ' Timbre.Receptor.NumeroRegistroTributario = "" + ' Timbre.Receptor.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") + + ' Dim totSubTotal As Decimal = Obj.SubTotal + ' Dim totIVA As Decimal = Obj.IVA + ' Dim totRetIVA As Decimal = Obj.RetIVA + ' Dim totRetISR As Decimal = Obj.RetISR + ' Dim TasaRetIVA As Decimal = 0 + ' Dim TasaRetISR As Decimal = 0 + ' Dim i As Integer = 1 + + ' ''detalles + ' Dim tPS As String = "" + + ' For Each drr As DataRow In Obj.DtDetalle.Rows + ' If drr("PS").ToString.Length = 1 Then + ' tPS = drr("Obs").ToString + ' Else + ' If drr("PS").ToString.Length = 0 Then + ' tPS = "" + ' Else + ' tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) + ' End If + ' End If + ' '' condicionante, especial + ' If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" ' les comentan que no debe de ir la etiqueta de "unidad" en el producto + + ' Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal, + ' .Descripcion = tPS, + ' .ValorUnitario = drr("PU").ToString.ToDecimal, + ' .Importe = drr("TotalImporte").ToString.ToDecimal, + ' .Descuento = drr("Descuento").ToString.ToDecimal, + ' .Unidad = drr("UM").ToString, + ' .ClaveUnidad = drr("SATClaveUM").ToString, + ' .ClaveProdServ = drr("SATClaveProdServ").ToString, + ' .Noidentificacion = drr("Noidentificacion").ToString, + ' .CuentaPredial = drr("CuentaPredial").ToString} + ' '' verifica suma subtotales + ' If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales + ' concepto.Importe = totSubTotal + ' End If + ' totSubTotal = totSubTotal - concepto.Importe + + ' ''siempre estaremos agregando el iva, auqnue sea en importe cero o tasa cero, para que se emita la factura + ' If drr("ImporteIVA").ToString.ToDouble > 0 Then + ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) + ' End If + + ' If drr("ImporteIEPS").ToString.ToDouble > 0 Then + ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal}) + ' End If + + ' If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones + ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetIVA, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal}) + ' End If + + ' If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR + ' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetISR, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal}) + ' End If + + ' Timbre.Conceptos.Add(concepto) + ' i += 1 + ' Next + + ' Dim AplicaComercioExteriorSubProyecto As Boolean = If(GlobalDTSubProyectos(-1, Obj.CveSubProyecto)(0)("AplicaComercioExterior").ToString = "True", True, False) + ' Timbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto = AplicaComercioExteriorSubProyecto + + ' If Obj.Cliente.AplicaComercioExterior And AplicaComercioExteriorSubProyecto Then + + ' Timbre.Receptor.ResidenciaFiscal = Obj.Cliente.ClaveSATPais + ' Timbre.Receptor.NumeroRegistroTributario = Obj.Cliente.NumRegIdTrib + + ' End If + + ' Return Timbre + 'End Function + +#End Region + +#Region "C L I E N T E S G R I D S I M P R I M I R P D F/Excel" + Private Sub LnkCotizacionesPDF_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesPDF.Click + ImprimeGridsProveedores("PDF", DtCotizaciones, "RepClientesCotizaciones") + End Sub + Private Sub LnkCotizacionesExcel_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesExcel.Click + ImprimeGridsProveedores("Excel", DtCotizaciones, "RepClientesCotizaciones") + End Sub + + Private Sub LnkCxCActivasPDF_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasPDF.Click + ImprimeGridsProveedores("PDF", DtCxCActivas, "RepClientesCxCActivas") + End Sub + Private Sub LnkCxCActivasExcel_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasExcel.Click + ImprimeGridsProveedores("Excel", DtCxCActivas, "RepClientesCxCActivas") + End Sub + + Private Sub LnkHistorialCxCPDF_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCPDF.Click + ImprimeGridsProveedores("PDF", DtHistorialCxC, "RepClientesHistorialCxC") + End Sub + Private Sub LnkHistorialCxCExcel_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCExcel.Click + ImprimeGridsProveedores("Excel", DtHistorialCxC, "RepClientesHistorialCxC") + End Sub + + Private Sub LnkAnticipoClientePDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClientePDF.Click + ImprimeGridsProveedores("PDF", DtClientesAnticipo, "RepClientesAnticipos") + End Sub + Private Sub LnkAnticipoClienteExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClienteExcel.Click + ImprimeGridsProveedores("Excel", DtClientesAnticipo, "RepClientesAnticipos") + End Sub + + Private Sub LnkAnticipoHistorialPDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialPDF.Click + ImprimeGridsProveedores("PDF", DtAnticipoHistorial, "RepClientesAnticipoHistorial") + End Sub + Private Sub LnkAnticipoHistorialExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialExcel.Click + ImprimeGridsProveedores("Excel", DtAnticipoHistorial, "RepClientesAnticipoHistorial") + End Sub + + Private Sub LnkCuentasBancariasPDF_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasPDF.Click + ImprimeGridsProveedores("PDF", DTCuentasBancos, "RepClientesCuentasBancarias") + End Sub + Private Sub LnkCuentasBancariasExcel_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasExcel.Click + ImprimeGridsProveedores("Excel", DTCuentasBancos, "RepClientesCuentasBancarias") + End Sub + + Private Sub ImprimeGridsProveedores(Formato As String, DtTemp As DataTable, NombreFormato As String) + If DtTemp IsNot Nothing And DtTemp.Rows.Count > 0 Then + Dim params As New List(Of ReportParameter) + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = 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("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("AgrupadoPor", "Cliente: " & LtlCliente.Text)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + ImprimirPDF("Empresas\Grales\Formatos\" & NombreFormato & ".rdlc", DtTemp, params, NombreFormato & "_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato) + Else + Alert("No se encontró información.", TipoMensaje.MsgAdvertencia) + End If + End Sub + + Private Sub LnkUsadosReset_Click(sender As Object, e As EventArgs) Handles LnkUsadosReset.Click + + Dim Acum As New ClsAcumuladores + Dim Puntos As Decimal = -LblUsadosPuntos.Text.ToDecimal + If Acum.DistribuidorMovtosAdd(CveCliente, 1, 1, 3, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Puntos, "Saldo Inicializado") Then + Alert("Puntuación Inicializada") + End If + Acum.Dispose() + + End Sub +#End Region + Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs) + If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then + TxtRetIVA.Text = "0" + DivRetIVA.Visible = False + + If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then + TxtRetIVA.Text = "10" + DivRetIVA.Visible = True + ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then + TxtRetIVA.Text = "4" + DivRetIVA.Visible = True + ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") Then + TxtRetIVA.Text = "6" + DivRetIVA.Visible = True + End If + + End If + End Sub + Protected Sub btnupEventoBitacora_Click(sender As Object, e As EventArgs) + CargaEventoBitacora() + End Sub +End Class + diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index b7201385f..c010e3d4c 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -226,13 +226,13 @@ Partial Class PV Private ReadOnly Property Ruta As String Get - Return AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Return ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" End Get End Property Private ReadOnly Property RutaPruebas As String Get - Return AppDomain.CurrentDomain.BaseDirectory & "Empresas\1\" + Return ModExtensiones.DirectorioBaseEmpresas & "Empresas\1\" End Get End Property @@ -1276,6 +1276,7 @@ Partial Class PV TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer)) + GvPS.DataSource = TmpDT GvPS.DataBind() @@ -1656,8 +1657,8 @@ Partial Class PV 'SI EL DETALLE NO TIENE MOVIMIENTOS DE INVENTARIO ES VISIBLE Dim CantidadFacturadaRemision = 0.0 For Each Gvr As GridViewRow In GvPS.Rows - Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True" - Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True" + Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False" + Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False" CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble Next @@ -1694,6 +1695,8 @@ Partial Class PV Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL()) Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL()) + Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL()) + Dim ObjAC As ClsContPAQi = Nothing Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero @@ -1701,8 +1704,8 @@ Partial Class PV Try 'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS If DdlMoneda.SelectedValue.ToEntero <> 2 AndAlso ChkConvertirDolares.Checked Then - - For Each Row As DataRow In TmpDT.Rows + Dim TmpDTTotales As DataTable = TmpDT.FiltraParametros("EliminarDB = False") + For Each Row As DataRow In TmpDTTotales.Rows Row("PU") = Math.Round(Row("PU").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6) Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) @@ -1721,13 +1724,13 @@ Partial Class PV End If Next - TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero - LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero + TxtSubTotal.Text = TmpDTTotales.SUM("Total").ToDecimal.FormatoNumero + LblDescuentos.Text = TmpDTTotales.SUM("Descuento").ToDecimal.FormatoNumero LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero - TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero - TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero - TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero - TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero + TxtIVA.Text = TmpDTTotales.SUM("ImporteIVA").ToDecimal.FormatoNumero + TxtRetIVA.Text = TmpDTTotales.SUM("ImporteRetIVA").ToDecimal.FormatoNumero + TxtRetISR.Text = TmpDTTotales.SUM("ImporteRetISR").ToDecimal.FormatoNumero + TxtIEPS.Text = TmpDTTotales.SUM("ImporteIEPS").ToDecimal.FormatoNumero TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero TipoCambio = TxtTipoCambioDlls.Text.Trim.ToDecimal @@ -1736,9 +1739,10 @@ Partial Class PV 'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then + Dim TmpDTTotales As DataTable = TmpDT.FiltraParametros("EliminarDB = False") Dim Importe As Decimal Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal - For Each Row As DataRow In TmpDT.Rows + For Each Row As DataRow In TmpDTTotales.Rows Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TCC, 6) Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) @@ -1758,13 +1762,13 @@ Partial Class PV End If Next - TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero - LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero + TxtSubTotal.Text = TmpDTTotales.SUM("Total").ToDecimal.FormatoNumero + LblDescuentos.Text = TmpDTTotales.SUM("Descuento").ToDecimal.FormatoNumero LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero - TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero - TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero - TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero - TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero + TxtIVA.Text = TmpDTTotales.SUM("ImporteIVA").ToDecimal.FormatoNumero + TxtRetIVA.Text = TmpDTTotales.SUM("ImporteRetIVA").ToDecimal.FormatoNumero + TxtRetISR.Text = TmpDTTotales.SUM("ImporteRetISR").ToDecimal.FormatoNumero + TxtIEPS.Text = TmpDTTotales.SUM("ImporteIEPS").ToDecimal.FormatoNumero TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero @@ -1802,32 +1806,99 @@ Partial Class PV Exit For Else TmpDT.Rows(index)("CveVentaDetalle") = ObjVentas.CveVentaDetalle + + If TmpDTRecepcionUsados IsNot Nothing Then + If TmpDTRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then + Dim rowInv As DataRow = TmpDTRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0) + rowInv("CveVentaDetalle") = ObjVentas.CveVentaDetalle + End If + End If + + If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then + If TmpDTAjustes.Select($"ConsecutivoVenta={Row("Consec").ToString.ToEntero}").Length > 0 Then + Dim DrAju As DataRow = TmpDTAjustes.Select($"ConsecutivoVenta={Row("Consec").ToString.ToEntero}")(0) + DrAju("CveVentaDetalle") = ObjVentas.CveVentaDetalle + End If + End If + + If TmpDTPolizaVirtual IsNot Nothing Then + If TmpDTPolizaVirtual.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then + Dim RowPoliza As DataRow = TmpDTPolizaVirtual.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0) + RowPoliza("CveVentaDetalle") = ObjVentas.CveVentaDetalle + End If + End If + End If End If index = index + 1 Next End If - ObjFactura.DtDetalle = TmpDT 'ELIMINA LOS DETALLES If Not OcurrioError Then - Dim DtEliminados As New DataTable - If ObjVentas.GetVentaDetalle(CveVenta) Then - DtEliminados = ObjVentas.DtResultados.FiltraParametros("", "", {"CveVentaDetalle"}) - For Each Dr1 As DataRow In DtEliminados.Rows - If TmpDT.FiltraParametros($"CveVentaDetalle = {Dr1("CveVentaDetalle")}").Rows.Count = 0 Then - If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then - OcurrioError = True - End If - End If - Next - Else - OcurrioError = True - End If + Dim DtEliminados As DataTable = TmpDT.FiltraParametros("EliminarDB = True AND CveVentaDetalle > 0", "", {"CveVentaDetalle"}) + + For Each Dr1 As DataRow In DtEliminados.Rows + If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then + OcurrioError = True + End If + Next End If - 'OcurrioError = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, 1, ObjBancos, ObjVentas) + 'RECARGA LOS DATOS + If ObjVentas.GetVentaDetalle(CveVenta) Then + TmpDT = ObjVentas.DtResultados.Copy() + ObjFactura.DtDetalle = TmpDT + Else + OcurrioError = True + End If + + 'GUARDA USADOS + If Not ObjVentas.EliminarUsados(CveVenta) Then + OcurrioError = True + End If + + If TmpDTRecepcionUsados IsNot Nothing Then + For Each drow As DataRow In TmpDTRecepcionUsados.Rows + If Not ObjVentas.AddVentaUsado(CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero) Then + OcurrioError = True + Exit For + End If + Next + End If + + 'GUARDAR AJUSTES' + If Not ObjAcum.EliminarGarantiasDetalle(CveVenta) Then + OcurrioError = True + End If + + If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then + For Each Dr As DataRow In TmpDTAjustes.Rows + If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero, + Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero, + Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime()) Then + ErrorList.Add("Ocurrió un error al agregar la garantia detalle.") + End If + Next + End If + + 'GUARDAR POLIZA VIRTUAL + If Not ObjAcum.EliminarPolizaVirtual(CveVenta) Then + OcurrioError = True + End If + + If TmpDTPolizaVirtual IsNot Nothing Then + For Each drow As DataRow In TmpDTPolizaVirtual.Rows + If ObjAcum.AddPolizaVirtual(CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal, + drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString), + drow("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero) Then + Else + OcurrioError = True + Exit For + End If + Next + End If 'Actualizo impuestos locales If Not OcurrioError Then @@ -1856,7 +1927,7 @@ Partial Class PV Else ObjVentas.Commit() If ObjAC IsNot Nothing Then ObjAC.Commit() - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:="BtnRefrescarPagina();") + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:="document.location.href=""/Ventas/PV.aspx"";") End If ObjVentas.Dispose() @@ -2695,7 +2766,7 @@ Partial Class PV TmpDT.Rows.Remove(DbRow) - GvPS.DataSource = TmpDT + GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False") DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2") GvPS.DataBind() CargaGVInv(DtInv) @@ -2751,7 +2822,7 @@ Partial Class PV TmpDT = resultados.CopyToDataTable CalculaTotalesVenta() - GvPS.DataSource = TmpDT + GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False") GvPS.DataBind() UpPS.Update() @@ -2857,7 +2928,7 @@ Partial Class PV GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> "" GvInv.Columns(6).Visible = DtTemporal.MAX("FechaCaducidad", "FechaCaducidad <> ''") <> "" - GvInv.DataSource = DtTemporal + GvInv.DataSource = DtTemporal.FiltraParametros("EliminarDB = False") GvInv.DataBind() UpINV.Update() @@ -3806,6 +3877,9 @@ Partial Class PV TmpDT.Columns.Add("PUOriginal", GetType(Decimal)) TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer)) + TmpDT.Columns.Add("EliminarDB", GetType(Boolean)) + TmpDT.Columns("EliminarDB").DefaultValue = False + End Sub Private Sub CreaDTmpC() @@ -3878,7 +3952,7 @@ Partial Class PV Row("TiempoEntrega") = TiempoEntrega TmpDT.Rows.Add(Row) - GvPS.DataSource = TmpDT + GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False") GvPS.DataBind() DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2") @@ -3999,7 +4073,7 @@ Partial Class PV Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False, - Optional ConsecPSPadre As Integer = -1) As Integer + Optional ConsecPSPadre As Integer = -1, Optional EliminarDB As Boolean = False) As Integer Dim Retorno As Integer = -1 If Not CvePS > 0 Then @@ -4170,6 +4244,8 @@ Partial Class PV Row("ConsecPSPadre") = ConsecPSPadre End If + Row("EliminarDB") = EliminarDB + If UsuarioActual.CveEmpresa = 119 Then If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA @@ -4477,8 +4553,8 @@ Partial Class PV Else If Me.CveVentaDetalle > 0 Then For Each Gvr As GridViewRow In GvPS.Rows - Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True" - Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True" + Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False" + Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False" Next End If UpVenta.Update() @@ -4530,7 +4606,12 @@ Partial Class PV If ListaPSCargo.Count > 0 Then CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo) End If - + ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then + EliminarUsados() + Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False) + If ListaPSCargo.Count > 0 Then + CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo) + End If End If Return True @@ -4662,6 +4743,7 @@ Partial Class PV #Region "CALCULA TOTALES" Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True) + Dim TmpDT = Me.TmpDT.FiltraParametros("EliminarDB = False", Orderby:="Consec") Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal @@ -4715,9 +4797,7 @@ Partial Class PV 'JJMQ 20160506: Se agrego para la validacion de pago de contado. 'CVImporteContado.ValueToCompare = Total.ToString - Dim view As DataView = New DataView(TmpDT) - view.Sort = "Consec" - GvPS.DataSource = view + GvPS.DataSource = TmpDT GvPS.DataBind() 'RECARGA GV INVENTARIO @@ -6325,7 +6405,7 @@ Partial Class PV Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2) Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero() - Dim FechaUsado As DateTime = TxtFechaAjuste.Text.ToDateTime() + Dim FechaUsado As DateTime = If(TxtFechaAjuste.Text.ToDateTime() < MinFecha, Now, TxtFechaAjuste.Text.ToDateTime()) Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero() Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero() Dim TipoPoliza As Integer = 1 'VENTA @@ -6376,6 +6456,7 @@ Partial Class PV Return Retorno End Function #End Region + #Region "U S A D O S" Private Sub CreaDTmpDTRecepcionUsados() @@ -6388,6 +6469,8 @@ Partial Class PV TmpDTRecepcionUsados.Columns.Add("PU", GetType(Double)) TmpDTRecepcionUsados.Columns.Add("CveBCIUsado", GetType(Integer)) TmpDTRecepcionUsados.Columns.Add("CveModeloAuto", GetType(Integer)) + TmpDTRecepcionUsados.Columns.Add("EliminarDB", GetType(Boolean)) + TmpDTRecepcionUsados.Columns("EliminarDB").DefaultValue = False End Sub @@ -6453,7 +6536,7 @@ Partial Class PV ' Exit Sub 'End If - For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").Rows + For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})").Rows Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal @@ -6485,7 +6568,7 @@ Partial Class PV Next TmpDT.AcceptChanges() If TotalCargos > 0 Then ' cuando se entrega más valor de usados, que los cargos hechos, se descuenta sobre el PU del producto de venta - For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND CvePS={CvePS}").Rows + For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}").Rows Dim PUAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal Dim PUActual As Decimal = PUAnterior - (TotalCargos / Dr("Cantidad").ToString.ToDecimal) @@ -6522,8 +6605,8 @@ Partial Class PV CalculaTotalesVenta() End Sub - Private Function CalculaUsados(Consec As Integer) As List(Of Integer) - If Modalidad = "U" Then + Private Function CalculaUsados(Consec As Integer, Optional LimpiarUsados As Boolean = True) As List(Of Integer) + If Modalidad = "U" AndAlso LimpiarUsados Then EliminarUsados(Consec) End If @@ -6556,6 +6639,8 @@ Partial Class PV DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer)) DTPSTemp.Columns.Add("SubProyecto", GetType(String)) DTPSTemp.Columns.Add("ConsecPSPadre", GetType(Integer)) + DTPSTemp.Columns.Add("EliminarDB", GetType(Boolean)) + DTPSTemp.Columns("EliminarDB").DefaultValue = False Dim ObjProductosServicios As New ClsProductosServicios() For Each DrowPartidas As DataRow In TmpDT.Select($"Consec = {Consec}") @@ -6628,7 +6713,7 @@ Partial Class PV Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString, drowPsTamaños("CveClasificacion").ToString.ToEntero, drowPsTamaños("Clasificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero, drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero, - drowPsTamaños("SubProyecto").ToString, EsCargo:=True, ConsecPSPadre:=drowPsTamaños("ConsecPSPadre").ToString.ToEntero) + drowPsTamaños("SubProyecto").ToString, EsCargo:=True, ConsecPSPadre:=drowPsTamaños("ConsecPSPadre").ToString.ToEntero, EliminarDB:=CBool(drowPsTamaños("EliminarDB").ToString())) If Consec > 0 Then ListaPScargo.Add(drowPsTamaños("CvePS").ToString.ToEntero) End If @@ -6655,6 +6740,25 @@ Partial Class PV Next Next + TmpDT.AcceptChanges() + TmpDTRecepcionUsados.AcceptChanges() + End Sub + Private Sub EliminarUsados() + + 'ELIMINAR EL USADO EXTRAS + For Each drow As DataRow In TmpDT.Select("EsCargo = True") + drow("EliminarDB") = True + Next + + 'ELIMINAR LOS USADOS QUE SE MANDAN A RECEPCION + For Each drow As DataRow In TmpDT.Select("EsCargo = True") + For Each RowRecepcionUsados As DataRow In TmpDTRecepcionUsados.Rows + If (RowRecepcionUsados("CvePSRelacionado").ToString() = drow("CvePS").ToString()) Then + RowRecepcionUsados.Delete() + End If + Next + Next + TmpDT.AcceptChanges() TmpDTRecepcionUsados.AcceptChanges() End Sub diff --git a/Ventas/PopUpBuscarFolio.aspx.vb b/Ventas/PopUpBuscarFolio.aspx.vb index dc21afb62..f5dc1d44e 100644 --- a/Ventas/PopUpBuscarFolio.aspx.vb +++ b/Ventas/PopUpBuscarFolio.aspx.vb @@ -7,7 +7,7 @@ Partial Class PopUpBuscarFolio Private ReadOnly Property Ruta As String Get - Return AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Return ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" End Get End Property @@ -159,8 +159,8 @@ Partial Class PopUpBuscarFolio e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right Dim Liga As String = String.Format("", e.Row.DBCampo("CveVenta")) - If UsuarioActual.CveEmpresa = 140 AndAlso e.Row.DBCampo("TipoDocto").Contiene("Rem") Then - Liga = String.Format("", e.Row.DBCampo("CveVenta")) + If UsuarioActual.CveEmpresa = 140 AndAlso e.Row.DBCampo("TipoDocto").Contiene("Rem") Then + Liga = String.Format("", e.Row.DBCampo("CveVenta")) End If e.Row.FCLiteral("LtlTipo").Text = String.Format("", Liga, e.Row.DBCampo("TipoDocto")) @@ -172,13 +172,15 @@ Partial Class PopUpBuscarFolio e.Row.FCLiteral("LtlSucursal").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("SubProyecto")) e.Row.FCLiteral("LtlEstatus").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("EstatusFactura")) e.Row.FCLiteral("LtlPedidoContrato").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("PedidoContrato")) + If IO.File.Exists($"{Ruta}XML\{e.Row.DBCampo("TipoDocto")}\{e.Row.DBCampo("Folio")}.xml") Then - e.Row.FCLiteral("LtlXML").Text = String.Format("", UsuarioActual.CveEmpresa, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio")) + e.Row.FCLiteral("LtlXML").Text = String.Format("", e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio")) Else e.Row.FCLiteral("LtlXML").Text = "
    " End If + If IO.File.Exists($"{Ruta}PDF\{e.Row.DBCampo("TipoDocto")}\{e.Row.DBCampo("Folio")}.pdf") Then - e.Row.FCLiteral("LtlPDF").Text = String.Format("", UsuarioActual.CveEmpresa, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio")) + e.Row.FCLiteral("LtlPDF").Text = String.Format("", e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio")) Else e.Row.FCLiteral("LtlPDF").Text = "
    " End If diff --git a/Ventas/PopUpImprimir.aspx.vb b/Ventas/PopUpImprimir.aspx.vb index 90720a9ae..bf9706395 100644 --- a/Ventas/PopUpImprimir.aspx.vb +++ b/Ventas/PopUpImprimir.aspx.vb @@ -64,7 +64,7 @@ Partial Class PopUpImprimir RegistraScript("$get('tdContenido').style.height='520px'") Else - Dim Path As String = AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\" & Ext & "\" & CveVenta & "." & Ext + Dim Path As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\" & Ext & "\" & CveVenta & "." & Ext Dim Archivo As New System.IO.FileInfo(Path) If Archivo.Exists Then diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 009f97d13..3bf35821a 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -2281,7 +2281,7 @@ Partial Class ProductosyServicios Dim Archivo = "" Dim DirectorioTemporal = "" - Dim DirectorioDestino = $"{AppDomain.CurrentDomain.BaseDirectory}Empresas\{UsuarioActual.CveEmpresa}\Ecommerce\Productos\Imagenes\" + Dim DirectorioDestino = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\Ecommerce\Productos\Imagenes\" If Not Directory.Exists(DirectorioDestino) Then Directory.CreateDirectory(DirectorioDestino) End If @@ -2316,7 +2316,7 @@ Partial Class ProductosyServicios If (CveImagenActivoFijo > 0) Then Dim ObjEcommerce As New ClsECommerce If ObjEcommerce.ProductosImagenesRemove(CveImagenActivoFijo, UsuarioActual.CveEmpresa) Then - File.Delete(String.Format("{0}Empresas\{1}\{2}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, ObjEcommerce.DtResultados.Rows(0)("URL"))) + File.Delete(String.Format("{0}Empresas\{1}\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, ObjEcommerce.DtResultados.Rows(0)("URL"))) CargarGaleriaImagenesEcommerce() RegistraScript("initcarusel();") End If diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb index 95092920d..fcef61fbb 100644 --- a/Ventas/RepPS.aspx.vb +++ b/Ventas/RepPS.aspx.vb @@ -2,13 +2,13 @@ Option Strict On Imports Extensiones -Imports System.Data -Imports Microsoft.Reporting.WebForms - -Partial Class Ventas_RepPS - Inherits ClsPaginas - -#Region "P R O P I E D A D E S" +Imports System.Data +Imports Microsoft.Reporting.WebForms + +Partial Class Ventas_RepPS + Inherits ClsPaginas + +#Region "P R O P I E D A D E S" Private Property DtReporte As DataTable Get Return DirectCast(ViewState("DtReporte"), DataTable) @@ -16,25 +16,25 @@ Partial Class Ventas_RepPS Set(value As DataTable) ViewState("DtReporte") = value End Set - End Property -#End Region - + End Property +#End Region + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - CargaDatosIniciales() - CargaCombos() + If Not IsPostBack Then + CargaDatosIniciales() + CargaCombos() CargaDatos() End If - End Sub - Private Sub CargaDatosIniciales() - txtFechaI.Text = $"01/{Now.Month}/{Now.Year}" - txtFechaF.Text = Now.ToString("dd/MM/yyyy") - End Sub - - Private Sub CargaCombos() - CargaTipoCentroCosto() - End Sub - + End Sub + Private Sub CargaDatosIniciales() + txtFechaI.Text = $"01/{Now.Month}/{Now.Year}" + txtFechaF.Text = Now.ToString("dd/MM/yyyy") + End Sub + + Private Sub CargaCombos() + CargaTipoCentroCosto() + End Sub + Private Sub CargaTipoCentroCosto() If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then @@ -66,23 +66,23 @@ Partial Class Ventas_RepPS ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then LblSubProyecto.InnerText = "Sucursal:" End If - End Sub - - Private Sub CargaDatos() - - Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero() - Dim Grupo As Integer = DdlGrupo.SelectedValue.ToEntero() - Dim CvePS As Integer = -1 - Dim CveMoneda As Integer = -1 - Dim TC As Integer = 1 + End Sub + + Private Sub CargaDatos() + + Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero() + Dim Grupo As Integer = DdlGrupo.SelectedValue.ToEntero() + Dim CvePS As Integer = -1 + Dim CveMoneda As Integer = -1 + Dim TC As Integer = 1 Dim TCEspecifico As Decimal = -1 Dim FechaI, FechaF As DateTime FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha) - FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) - + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) + Dim ObjVentas As New ClsVentas() - If ObjVentas.GetRepPSEcono(CveSubProyecto, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then - DtReporte = ObjVentas.DtResultados.Copy() + If ObjVentas.GetRepPSEcono(CveSubProyecto, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then + DtReporte = ObjVentas.DtResultados.Copy() GvDatos.DataSource = DtReporte Else GvDatos.DataSource = Nothing @@ -92,28 +92,28 @@ Partial Class Ventas_RepPS GvDatos.DataBind() UPDatos.Update() - End Sub + End Sub Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - Select Case e.Row.DBCampo("Orden").ToString.ToEntero() - Case 4 - e.Row.CssClass = "Totales" - Case 3 - e.Row.CssClass = "SubTotales2" - Case 2 - e.Row.CssClass = "SubTotales" - Case 1 - e.Row.CssClass = "SubTotalesB" - Case 0 - e.Row.CssClass = "Texto" + If e.Row.RowType = DataControlRowType.DataRow Then + Select Case e.Row.DBCampo("Orden").ToString.ToEntero() + Case 4 + e.Row.CssClass = "Totales" + Case 3 + e.Row.CssClass = "SubTotales2" + Case 2 + e.Row.CssClass = "SubTotales" + Case 1 + e.Row.CssClass = "SubTotalesB" + Case 0 + e.Row.CssClass = "Texto" End Select End If - End Sub - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) - CargaDatos() - End Sub - - + End Sub + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub + + #Region " IMPRIMIR " Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click If GvDatos.Rows.Count > 0 Then @@ -128,10 +128,10 @@ Partial Class Ventas_RepPS Private Sub GenerarPDF() Dim FechaI, FechaF As Date FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha) - FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) If DtReporte IsNot Nothing AndAlso DtReporte.Rows.Count > 0 Then Dim SbParametros As New StringBuilder - SbParametros.AppendFormat("Sucursal:{0}", DdlSubProyecto.SelectedItem.Text) + SbParametros.AppendFormat("Sucursal:{0}", DdlSubProyecto.SelectedItem.Text) SbParametros.AppendFormat(", Orden:{0}", DdlGrupo.SelectedItem.Text) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -147,20 +147,20 @@ Partial Class Ventas_RepPS params.Add(New ReportParameter("LogoPath", logouri)) Else params.Add(New ReportParameter("LogoPath", "")) - End If - params.Add(New ReportParameter("Parametros", SbParametros.ToString())) - - If System.IO.File.Exists($"{Server.MapPath("/")}/Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc") Then - ImprimirPDF($"Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS") - Else - ImprimirPDF($"Empresas/Grales/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS") + End If + params.Add(New ReportParameter("Parametros", SbParametros.ToString())) + + If System.IO.File.Exists($"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc") Then + ImprimirPDF($"Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS") + Else + ImprimirPDF($"Empresas/Grales/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS") End If Else Alert("No hay información para mostrar.", TipoMensaje.MsgAdvertencia) End If - End Sub - + End Sub + #End Region - -End Class + +End Class diff --git a/Ventas/RepRecuperacion.aspx.vb b/Ventas/RepRecuperacion.aspx.vb index ab5d4b57b..5ca328ee7 100644 --- a/Ventas/RepRecuperacion.aspx.vb +++ b/Ventas/RepRecuperacion.aspx.vb @@ -92,8 +92,8 @@ Partial Class Ventas_RepRecuperacion 'Carga Bancos' DdlBanco.DataSource = GlobalDTBancos().FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}") - DdlBanco.DataBind() - DdlBanco.Items.Insert(0, New ListItem("Todos", "-1")) + DdlBanco.DataBind() + DdlBanco.Items.Insert(0, New ListItem("Todos", "-1")) DdlBanco.Items.Add(New ListItem("Empresa", "0")) 'Carga Clasificacion Cliente' @@ -179,7 +179,7 @@ Partial Class Ventas_RepRecuperacion #Region "SELECTED INDEX CHANGE" Protected Sub DdlBanco_SelectedIndexChanged(sender As Object, e As EventArgs) - DdlCuentaBancaria.Items.Clear() + DdlCuentaBancaria.Items.Clear() DdlCuentaBancaria.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros($"CveBanco = {DdlBanco.SelectedValue.ToEntero}") DdlCuentaBancaria.Items.Insert(0, New ListItem("Todos", "-1")) DdlCuentaBancaria.DataBind() @@ -214,7 +214,7 @@ Partial Class Ventas_RepRecuperacion If DdlResponsable.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Responsable: {0}", DdlResponsable.SelectedItem.Text) Dim RutaPDF As String - Dim Ruta As String = $"{AppDomain.CurrentDomain.BaseDirectory}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" RutaPDF = $"{Ruta}\Formatos\RepRecuperacion.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/RepRecuperacion.rdlc" diff --git a/Ventas/RepRecuperacionDetalle.aspx.vb b/Ventas/RepRecuperacionDetalle.aspx.vb index 4f2027ccc..fd8ccd5a9 100644 --- a/Ventas/RepRecuperacionDetalle.aspx.vb +++ b/Ventas/RepRecuperacionDetalle.aspx.vb @@ -296,7 +296,7 @@ Partial Class Ventas_RepRecuperacionDetalle If DdlClienteSucursal.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Cliente Sucursal: {0}", DdlClienteSucursal.SelectedItem.Text) Dim RutaPDF As String - Dim Ruta As String = $"{AppDomain.CurrentDomain.BaseDirectory}Empresas\{UsuarioActual.CveEmpresa}\" + Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\" RutaPDF = $"{Ruta}\Formatos\RepRecuperacionDetalle.rdlc" If Not File.Exists(RutaPDF) Then RutaPDF = "Empresas/Grales/Formatos/RepRecuperacionDetalle.rdlc" diff --git a/Ventas/ReporteDetalle.aspx.cs b/Ventas/ReporteDetalle.aspx.cs index 2b4086f33..7b17bb50c 100644 --- a/Ventas/ReporteDetalle.aspx.cs +++ b/Ventas/ReporteDetalle.aspx.cs @@ -122,11 +122,11 @@ public partial class Ventas_ReporteDetalle : ClsPaginas Hashtable UrlParametros = Parametros(ModExtensiones.Decripta(Request["Op"].ToString())); if (Request["Mod"] != null && Request["Mod"].ToString().Equals("Editar")) { - Directorio1 = AppDomain.CurrentDomain.BaseDirectory + string.Format(@"Empresas\{0}\Formatos\Factura.mrt", UrlParametros["CVEEMPRESA"].ToString()); + Directorio1 = ModExtensiones.DirectorioBaseEmpresas + string.Format(@"Empresas\{0}\Formatos\Factura.mrt", UrlParametros["CVEEMPRESA"].ToString()); } else { - Directorio1 = AppDomain.CurrentDomain.BaseDirectory + @"Empresas\Grales\Formatos\Factura.mrt"; + Directorio1 = ModExtensiones.DirectorioBaseEmpresas + @"Empresas\Grales\Formatos\Factura.mrt"; } CargaFactura(Directorio1, UrlParametros); SmdDesigner.Report = Reporte; @@ -300,7 +300,7 @@ public partial class Ventas_ReporteDetalle : ClsPaginas { Hashtable UrlParametros = Parametros(ModExtensiones.Decripta(Request["Op"].ToString())); CveEmpresa = UrlParametros["CVEEMPRESA"].ToString().ToEntero(); - string DirBase = AppDomain.CurrentDomain.BaseDirectory + string.Format(@"Empresas\{0}\Formatos\", CveEmpresa); + string DirBase = ModExtensiones.DirectorioBaseEmpresas + string.Format(@"Empresas\{0}\Formatos\", CveEmpresa); if (!System.IO.Directory.Exists(DirBase)) { System.IO.Directory.CreateDirectory(DirBase); diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 3c15df375..fe284e7fa 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -4130,8 +4130,14 @@ Agregar
    --%>
    - Agendar + Agendar
    + + + @@ -4140,6 +4146,7 @@ + @@ -4163,7 +4170,7 @@ Descripción - + diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 2c262bbc5..e828f93c6 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -61,7 +61,7 @@ Partial Class Ventas End Property Private Property CveFactura As Integer Get - Return ViewState("CveFactura").ToString.ToEntero + Return ViewState("CveFactura").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveFactura") = value @@ -70,7 +70,7 @@ Partial Class Ventas Private Property idCuentaContabilizacion As Integer Get - Return ViewState("idCuentaContabilizacion").ToString.ToEntero + Return ViewState("idCuentaContabilizacion").ToString().ToEntero() End Get Set(value As Integer) ViewState("idCuentaContabilizacion") = value @@ -163,7 +163,7 @@ Partial Class Ventas Private Property IdPoliza As Integer Get - Return ViewState("IdPoliza").ToString.ToEntero + Return ViewState("IdPoliza").ToString().ToEntero() End Get Set(value As Integer) ViewState("IdPoliza") = value @@ -171,7 +171,7 @@ Partial Class Ventas End Property Private Property CveAlmacenDevolucion As Integer Get - Return ViewState("CveAlmacenDevolucion").ToString.ToEntero + Return ViewState("CveAlmacenDevolucion").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveAlmacenDevolucion") = value @@ -180,7 +180,7 @@ Partial Class Ventas Private Property EraCotizacion As Integer Get - Return ViewState("EraCotizacion").ToString.ToEntero + Return ViewState("EraCotizacion").ToString().ToEntero() End Get Set(value As Integer) ViewState("EraCotizacion") = value @@ -188,7 +188,7 @@ Partial Class Ventas End Property Private Property FacturaMateriales As Integer Get - Return ViewState("FacturaMateriales").ToString.ToEntero + Return ViewState("FacturaMateriales").ToString().ToEntero() End Get Set(value As Integer) ViewState("FacturaMateriales") = value @@ -442,12 +442,12 @@ Partial Class Ventas End Property Private ReadOnly Property CveCliente As Integer Get - Return ViewState("CveCliente").ToString.ToEntero + Return ViewState("CveCliente").ToString().ToEntero() End Get End Property Private ReadOnly Property CveClienteAnterior As Integer Get - Return ViewState("CveClienteAnterior").ToString.ToEntero + Return ViewState("CveClienteAnterior").ToString().ToEntero() End Get End Property @@ -456,7 +456,7 @@ Partial Class Ventas If ViewState("CveClienteSucursal") Is Nothing Then Return -1 Else - Return ViewState("CveClienteSucursal").ToString.ToEntero + Return ViewState("CveClienteSucursal").ToString().ToEntero() End If End Get Set(value As Integer) @@ -468,7 +468,7 @@ Partial Class Ventas If ViewState("CveAnticipo") Is Nothing Then Return -1 Else - Return ViewState("CveAnticipo").ToString.ToEntero + Return ViewState("CveAnticipo").ToString().ToEntero() End If End Get Set(value As Integer) @@ -478,7 +478,7 @@ Partial Class Ventas Private Property CveUsuarioActual As Integer Get - Return ViewState("CveUsuarioActual").ToString.ToEntero + Return ViewState("CveUsuarioActual").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveUsuarioActual") = value @@ -486,27 +486,27 @@ Partial Class Ventas End Property Private ReadOnly Property Mail As String Get - Return ViewState("Mail").ToString + Return ViewState("Mail").ToString() End Get End Property Private ReadOnly Property MailCC As String Get - Return ViewState("MailCC").ToString + Return ViewState("MailCC").ToString() End Get End Property Private ReadOnly Property CveVenta As Integer Get - Return ViewState("CveVenta").ToString.ToEntero + Return ViewState("CveVenta").ToString().ToEntero() End Get End Property Private ReadOnly Property CveSubProyectoVenta As Integer Get - Return If(IsNothing(ViewState("CveSubProyectoVenta")), -1, ViewState("CveSubProyectoVenta").ToString.ToEntero) + Return If(IsNothing(ViewState("CveSubProyectoVenta")), -1, ViewState("CveSubProyectoVenta").ToString().ToEntero()) End Get End Property Private Property CveVentaPadre As Integer Get - Return If(IsNothing(ViewState("CveVentaPadre")), -1, ViewState("CveVentaPadre").ToString.ToEntero) + Return If(IsNothing(ViewState("CveVentaPadre")), -1, ViewState("CveVentaPadre").ToString().ToEntero()) End Get Set(value As Integer) ViewState("CveVentaPadre") = value @@ -514,7 +514,7 @@ Partial Class Ventas End Property Private Property CveEstatusFacturaPadre As Integer Get - Return If(IsNothing(ViewState("CveEstatusFacturaPadre")), -1, ViewState("CveEstatusFacturaPadre").ToString.ToEntero) + Return If(IsNothing(ViewState("CveEstatusFacturaPadre")), -1, ViewState("CveEstatusFacturaPadre").ToString().ToEntero()) End Get Set(value As Integer) ViewState("CveEstatusFacturaPadre") = value @@ -522,7 +522,7 @@ Partial Class Ventas End Property Private Property CveMovimientoDetalle As Integer Get - Return If(IsNothing(ViewState("CveMovimientoDetalle")), -1, ViewState("CveMovimientoDetalle").ToString.ToEntero) + Return If(IsNothing(ViewState("CveMovimientoDetalle")), -1, ViewState("CveMovimientoDetalle").ToString().ToEntero()) End Get Set(value As Integer) ViewState("CveMovimientoDetalle") = value @@ -530,13 +530,13 @@ Partial Class Ventas End Property Private ReadOnly Property CveDevolucion As Integer Get - Return ViewState("CveDevolucion").ToString.ToEntero + Return ViewState("CveDevolucion").ToString().ToEntero() End Get End Property Private Property CveVentaRelacion As Integer Get - Return If(IsNothing(ViewState("CveVentaRelacion")), -1, ViewState("CveVentaRelacion").ToString.ToEntero) + Return If(IsNothing(ViewState("CveVentaRelacion")), -1, ViewState("CveVentaRelacion").ToString().ToEntero()) End Get Set(value As Integer) ViewState("CveVentaRelacion") = value @@ -545,7 +545,7 @@ Partial Class Ventas Private Property ImporteRelacion As Double Get - Return If(IsNothing(ViewState("ImporteRelacion")), 0, ViewState("ImporteRelacion").ToString.ToDouble) + Return If(IsNothing(ViewState("ImporteRelacion")), 0, ViewState("ImporteRelacion").ToString().ToDouble) End Get Set(value As Double) ViewState("ImporteRelacion") = value @@ -554,7 +554,7 @@ Partial Class Ventas Private Property IsTotalxConcepto As Boolean Get - Return If(IsNothing(ViewState("IsTotalxConcepto")), False, CBool(ViewState("IsTotalxConcepto").ToString)) + Return If(IsNothing(ViewState("IsTotalxConcepto")), False, CBool(ViewState("IsTotalxConcepto").ToString())) End Get Set(value As Boolean) ViewState("IsTotalxConcepto") = value @@ -562,27 +562,27 @@ Partial Class Ventas End Property Private ReadOnly Property CveAlmacenTransitorio As Integer Get - Return ViewState("CveAlmacenTransitorio").ToString.ToEntero + Return ViewState("CveAlmacenTransitorio").ToString().ToEntero() End Get End Property Private ReadOnly Property NuevaFactura As Integer Get - Return ViewState("NuevaFactura").ToString.ToEntero + Return ViewState("NuevaFactura").ToString().ToEntero() End Get End Property Private ReadOnly Property VentaFolio As String Get - Return ViewState("VentaFolio").ToString + Return ViewState("VentaFolio").ToString() End Get End Property Private ReadOnly Property SelloCancelacion As String Get - Return ViewState("SelloCancelacion").ToString + Return ViewState("SelloCancelacion").ToString() End Get End Property Private ReadOnly Property FechaCancelacion As DateTime Get - Return ViewState("FechaCancelacion").ToString.ToDateTime + Return ViewState("FechaCancelacion").ToString().ToDateTime End Get End Property Private ReadOnly Property EstablecioFolio As Boolean @@ -592,22 +592,22 @@ Partial Class Ventas End Property Private ReadOnly Property FolioFiscal As String Get - Return ViewState("FolioFiscal").ToString + Return ViewState("FolioFiscal").ToString() End Get End Property Private ReadOnly Property Ruta As String Get - Return AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\" + Return UsuarioActual.Empresa.Ruta End Get End Property Private ReadOnly Property RutaPruebas As String Get - Return AppDomain.CurrentDomain.BaseDirectory & "Empresas\1\" + Return String.Format("{0}Empresas/1/", ModExtensiones.DirectorioBaseEmpresas) End Get End Property Private ReadOnly Property TipoCambio As Decimal Get - Return ViewState("TipoCambio").ToString.ToDecimal + Return ViewState("TipoCambio").ToString().ToDecimal End Get End Property Private ReadOnly Property ProcesoCorrecto As Boolean @@ -628,167 +628,167 @@ Partial Class Ventas 'Folios Private ReadOnly Property CveFolio As Integer Get - Return ViewState("CveFolio").ToString.ToEntero + Return ViewState("CveFolio").ToString().ToEntero() End Get End Property Private ReadOnly Property NumAprobacion As Long Get - Return CLng(ViewState("NumAprobacion").ToString) + Return CLng(ViewState("NumAprobacion").ToString()) End Get End Property Private ReadOnly Property FechaAprobacion As Date Get - Return ViewState("FechaAprobacion").ToString.ToDate + Return ViewState("FechaAprobacion").ToString().ToDate End Get End Property Private ReadOnly Property FolioActual As String Get - Return ViewState("FolioActual").ToString + Return ViewState("FolioActual").ToString() End Get End Property 'Sucursal Private ReadOnly Property Serie As String Get - Return ViewState("Serie").ToString + Return ViewState("Serie").ToString() End Get End Property Private ReadOnly Property Folio As Integer Get - Return ViewState("Folio").ToString.ToEntero + Return ViewState("Folio").ToString().ToEntero() End Get End Property Private ReadOnly Property FormatoFactura As String Get - Return ViewState("FormatoFactura").ToString + Return ViewState("FormatoFactura").ToString() End Get End Property Private ReadOnly Property TipoFormato As String Get - Return ViewState("TipoFormato").ToString + Return ViewState("TipoFormato").ToString() End Get End Property Private ReadOnly Property IVA As Decimal Get - Return ViewState("IVA").ToString.ToDecimal + Return ViewState("IVA").ToString().ToDecimal End Get End Property 'Private ReadOnly Property SubProyectoPorcentajeIVA As Decimal ' Get - ' Return ViewState("SubProyectoPorcentajeIVA").ToString.ToDecimal + ' Return ViewState("SubProyectoPorcentajeIVA").ToString().ToDecimal ' End Get 'End Property Private ReadOnly Property ClienteRetIVA As Decimal Get - Return ViewState("ClienteRetIVA").ToString.ToDecimal + Return ViewState("ClienteRetIVA").ToString().ToDecimal End Get End Property Private ReadOnly Property ClienteRetISR As Decimal Get - Return ViewState("ClienteRetISR").ToString.ToDecimal + Return ViewState("ClienteRetISR").ToString().ToDecimal End Get End Property Private ReadOnly Property ClienteDesglosaIEPS As Boolean Get - Return CType(ViewState("ClienteDesglosaIEPS").ToString, Boolean) + Return CType(ViewState("ClienteDesglosaIEPS").ToString(), Boolean) End Get End Property 'Cliente Private ReadOnly Property NombreCliente As String Get - Return ViewState("NombreCliente").ToString + Return ViewState("NombreCliente").ToString() End Get End Property Private ReadOnly Property Vendedor As String Get - Return ViewState("Vendedor").ToString + Return ViewState("Vendedor").ToString() End Get End Property Private ReadOnly Property CtaContable As String Get - Return ViewState("CtaContable").ToString + Return ViewState("CtaContable").ToString() End Get End Property Private ReadOnly Property IdCtaContClientes As Integer Get - Return ViewState("IdCtaContClientes").ToString.ToEntero + Return ViewState("IdCtaContClientes").ToString().ToEntero() End Get End Property Private ReadOnly Property CveCuentaClientes As Integer Get - Return ViewState("CveCuentaClientes").ToString.ToEntero + Return ViewState("CveCuentaClientes").ToString().ToEntero() End Get End Property Private ReadOnly Property IdCtaContMonedaExtranjera As Integer Get - Return ViewState("IdCtaContMonedaExtranjera").ToString.ToEntero + Return ViewState("IdCtaContMonedaExtranjera").ToString().ToEntero() End Get End Property Private ReadOnly Property IdCtaContComplementaria As Integer Get - Return ViewState("IdCtaContComplementaria").ToString.ToEntero + Return ViewState("IdCtaContComplementaria").ToString().ToEntero() End Get End Property Private ReadOnly Property IdCtaContAnticipos As Integer Get - Return ViewState("IdCtaContAnticipos").ToString.ToEntero + Return ViewState("IdCtaContAnticipos").ToString().ToEntero() End Get End Property Private ReadOnly Property CveCuentaAnticipos As Integer Get - Return ViewState("CveCuentaAnticipos").ToString.ToEntero + Return ViewState("CveCuentaAnticipos").ToString().ToEntero() End Get End Property Private ReadOnly Property IdCtaContRetIVA As Integer Get - Return ViewState("IdCtaContRetIVA").ToString.ToEntero + Return ViewState("IdCtaContRetIVA").ToString().ToEntero() End Get End Property Private ReadOnly Property CveCuentaRetIVA As Integer Get - Return ViewState("CveCuentaRetIVA").ToString.ToEntero + Return ViewState("CveCuentaRetIVA").ToString().ToEntero() End Get End Property Private ReadOnly Property IdCtaContRetISR As Integer Get - Return ViewState("IdCtaContRetISR").ToString.ToEntero + Return ViewState("IdCtaContRetISR").ToString().ToEntero() End Get End Property Private ReadOnly Property CveCuentaRetISR As Integer Get - Return ViewState("CveCuentaRetISR").ToString.ToEntero + Return ViewState("CveCuentaRetISR").ToString().ToEntero() End Get End Property Private ReadOnly Property CodCliente As String Get - Return ViewState("CodCliente").ToString + Return ViewState("CodCliente").ToString() End Get End Property Private ReadOnly Property CliNoExt As String Get - Return ViewState("CliNoExt").ToString + Return ViewState("CliNoExt").ToString() End Get End Property Private ReadOnly Property CliNoInt As String Get - Return ViewState("CliNoInt").ToString + Return ViewState("CliNoInt").ToString() End Get End Property Private ReadOnly Property CliLocalidad As String Get - Return ViewState("CliLocalidad").ToString + Return ViewState("CliLocalidad").ToString() End Get End Property Private ReadOnly Property CliPais As String Get - Return ViewState("CliPais").ToString + Return ViewState("CliPais").ToString() End Get End Property Private ReadOnly Property SucCalle As String Get - Return ViewState("SucCalle").ToString + Return ViewState("SucCalle").ToString() End Get End Property Private ReadOnly Property CliCorreoCot As String @@ -796,93 +796,93 @@ Partial Class Ventas If ViewState("CliCorreoCot") Is Nothing Then Return "" Else - Return ViewState("CliCorreoCot").ToString + Return ViewState("CliCorreoCot").ToString() End If End Get End Property Private ReadOnly Property SucNoExt As String Get - Return ViewState("SucNoExt").ToString + Return ViewState("SucNoExt").ToString() End Get End Property Private ReadOnly Property SucNoInt As String Get - Return ViewState("SucNoInt").ToString + Return ViewState("SucNoInt").ToString() End Get End Property Private ReadOnly Property SucColonia As String Get - Return ViewState("SucColonia").ToString + Return ViewState("SucColonia").ToString() End Get End Property Private ReadOnly Property SucLocalidad As String Get - Return ViewState("SucLocalidad").ToString + Return ViewState("SucLocalidad").ToString() End Get End Property Private ReadOnly Property SucMunicipio As String Get - Return ViewState("SucMunicipio").ToString + Return ViewState("SucMunicipio").ToString() End Get End Property Private ReadOnly Property SucEstado As String Get - Return ViewState("SucEstado").ToString + Return ViewState("SucEstado").ToString() End Get End Property Private ReadOnly Property SucPais As String Get - Return ViewState("SucPais").ToString + Return ViewState("SucPais").ToString() End Get End Property Private ReadOnly Property SucCP As String Get - Return ViewState("SucCP").ToString + Return ViewState("SucCP").ToString() End Get End Property Private ReadOnly Property MatCalle As String Get - Return ViewState("MatCalle").ToString + Return ViewState("MatCalle").ToString() End Get End Property Private ReadOnly Property MatNoExt As String Get - Return ViewState("MatNoExt").ToString + Return ViewState("MatNoExt").ToString() End Get End Property Private ReadOnly Property MatNoInt As String Get - Return ViewState("MatNoInt").ToString + Return ViewState("MatNoInt").ToString() End Get End Property Private ReadOnly Property MatColonia As String Get - Return ViewState("MatColonia").ToString + Return ViewState("MatColonia").ToString() End Get End Property Private ReadOnly Property MatLocalidad As String Get - Return ViewState("MatLocalidad").ToString + Return ViewState("MatLocalidad").ToString() End Get End Property Private ReadOnly Property MatMunicipio As String Get - Return ViewState("MatMunicipio").ToString + Return ViewState("MatMunicipio").ToString() End Get End Property Private ReadOnly Property MatEstado As String Get - Return ViewState("MatEstado").ToString + Return ViewState("MatEstado").ToString() End Get End Property Private ReadOnly Property MatPais As String Get - Return ViewState("MatPais").ToString + Return ViewState("MatPais").ToString() End Get End Property Private ReadOnly Property MatCP As String Get - Return ViewState("MatCP").ToString + Return ViewState("MatCP").ToString() End Get End Property Private Property ImprimeNombreSucursal As Boolean @@ -930,17 +930,17 @@ Partial Class Ventas End Property Private ReadOnly Property CveOS As Integer Get - Return ViewState("CveOS").ToString.ToEntero + Return ViewState("CveOS").ToString().ToEntero() End Get End Property Private ReadOnly Property SaldoVenta As Decimal Get - Return If(IsNothing(ViewState("SaldoVenta")), 0, ViewState("SaldoVenta").ToString.ToDecimal) + Return If(IsNothing(ViewState("SaldoVenta")), 0, ViewState("SaldoVenta").ToString().ToDecimal) End Get End Property Private Property CvePSAmortizacion As Integer Get - Return ViewState("CvePSAmortizacion").ToString.ToEntero + Return ViewState("CvePSAmortizacion").ToString().ToEntero() End Get Set(value As Integer) @@ -960,7 +960,7 @@ Partial Class Ventas Private Property CvePrePoliza As Integer Get - Return ViewState("CvePrePoliza").ToString.ToEntero + Return ViewState("CvePrePoliza").ToString().ToEntero() End Get Set(value As Integer) ViewState("CvePrePoliza") = value @@ -973,7 +973,7 @@ Partial Class Ventas End Property Private Property CveVentaFacturada As Integer Get - Return ViewState("CveVentaFacturada").ToString.ToEntero + Return ViewState("CveVentaFacturada").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveVentaFacturada") = value @@ -987,7 +987,7 @@ Partial Class Ventas 'Estimaciones Private Property CveContrato As Integer Get - Return ViewState("CveContrato").ToString.ToEntero + Return ViewState("CveContrato").ToString().ToEntero() End Get Set(value As Integer) @@ -996,7 +996,7 @@ Partial Class Ventas End Property Private Property CvePedido As Integer Get - Return ViewState("CvePedido").ToString.ToEntero + Return ViewState("CvePedido").ToString().ToEntero() End Get Set(value As Integer) @@ -1005,7 +1005,7 @@ Partial Class Ventas End Property Private Property CvePedido2 As Integer Get - Return ViewState("CvePedido2").ToString.ToEntero + Return ViewState("CvePedido2").ToString().ToEntero() End Get Set(value As Integer) @@ -1014,7 +1014,7 @@ Partial Class Ventas End Property Private Property TipoContrato As Integer Get - Return ViewState("TipoContrato").ToString.ToEntero + Return ViewState("TipoContrato").ToString().ToEntero() End Get Set(value As Integer) @@ -1023,7 +1023,7 @@ Partial Class Ventas End Property Private Property Opcion As String Get - Return ViewState("Opcion").ToString + Return ViewState("Opcion").ToString() End Get Set(value As String) @@ -1043,7 +1043,7 @@ Partial Class Ventas 'Presupuesto Private Property CvePresupuesto As Integer Get - Return ViewState("CvePresupuesto").ToString.ToEntero + Return ViewState("CvePresupuesto").ToString().ToEntero() End Get Set(value As Integer) ViewState("CvePresupuesto") = value @@ -1051,7 +1051,7 @@ Partial Class Ventas End Property Private Property TotalOtrosConceptos As Decimal Get - Return ViewState("TotalOtrosConceptos").ToString.ToDecimal + Return ViewState("TotalOtrosConceptos").ToString().ToDecimal End Get Set(value As Decimal) ViewState("TotalOtrosConceptos") = value @@ -1059,7 +1059,7 @@ Partial Class Ventas End Property Private Property TipoCambioFactura As Decimal Get - Return ViewState("TipoCambioFactura").ToString.ToDecimal + Return ViewState("TipoCambioFactura").ToString().ToDecimal End Get Set(value As Decimal) ViewState("TipoCambioFactura") = value @@ -1076,7 +1076,7 @@ Partial Class Ventas End Property Private Property DevolucionAlmacen As Integer Get - Return ViewState("DevolucionAlmacen").ToString.ToEntero + Return ViewState("DevolucionAlmacen").ToString().ToEntero() End Get Set(value As Integer) ViewState("DevolucionAlmacen") = value @@ -1092,12 +1092,12 @@ Partial Class Ventas End Property Private ReadOnly Property TipoDoctoDevolucion As String Get - Return ViewState("TipoDoctoDevolucion").ToString + Return ViewState("TipoDoctoDevolucion").ToString() End Get End Property Private Property PlazoCobranza As Integer Get - Return ViewState("PlazoCobranza").ToString.ToEntero + Return ViewState("PlazoCobranza").ToString().ToEntero() End Get Set(value As Integer) ViewState("PlazoCobranza") = value @@ -1105,7 +1105,7 @@ Partial Class Ventas End Property Private Property PlazoCobranzaRemision As Integer Get - Return ViewState("PlazoCobranzaRemision").ToString.ToEntero + Return ViewState("PlazoCobranzaRemision").ToString().ToEntero() End Get Set(value As Integer) ViewState("PlazoCobranzaRemision") = value @@ -1115,7 +1115,7 @@ Partial Class Ventas 'CvePAC Private Property CvePAC As Integer Get - Return ViewState("CvePAC").ToString.ToEntero + Return ViewState("CvePAC").ToString().ToEntero() End Get Set(value As Integer) ViewState("CvePAC") = value @@ -1141,7 +1141,7 @@ Partial Class Ventas End Property Private Property SaldoVentaDevolucion As Decimal Get - Return ViewState("SaldoVentaDevolucion").ToString.ToDecimal + Return ViewState("SaldoVentaDevolucion").ToString().ToDecimal End Get Set(value As Decimal) ViewState("SaldoVentaDevolucion") = value @@ -1166,7 +1166,7 @@ Partial Class Ventas End Property Private Property PorcentajeIVA As Decimal Get - Return ViewState("PorcentajeIVA").ToString.ToDecimal + Return ViewState("PorcentajeIVA").ToString().ToDecimal End Get Set(value As Decimal) ViewState("PorcentajeIVA") = value @@ -1212,7 +1212,7 @@ Partial Class Ventas Private Property CveCorte As Integer Get - Return ViewState("CveCorte").ToString.ToEntero + Return ViewState("CveCorte").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveCorte") = value @@ -1221,7 +1221,7 @@ Partial Class Ventas Private Property Entrega As String Get - Return ViewState("Entrega").ToString + Return ViewState("Entrega").ToString() End Get Set(value As String) ViewState("Entrega") = value @@ -1230,7 +1230,7 @@ Partial Class Ventas Private Property Vigencia As String Get - Return ViewState("Vigencia").ToString + Return ViewState("Vigencia").ToString() End Get Set(value As String) ViewState("Vigencia") = value @@ -1239,7 +1239,7 @@ Partial Class Ventas Private Property DineroCaja As Double Get - Return ViewState("DineroCaja").ToString.ToDouble + Return ViewState("DineroCaja").ToString().ToDouble End Get Set(value As Double) ViewState("DineroCaja") = value @@ -1248,7 +1248,7 @@ Partial Class Ventas Private ReadOnly Property CveCicloComercial As Integer Get - Return ViewState("CveCicloComercial").ToString.ToEntero + Return ViewState("CveCicloComercial").ToString().ToEntero() End Get End Property @@ -1265,7 +1265,7 @@ Partial Class Ventas End Property Private Property NumeroContrato As String Get - Return ViewState("NumeroContrato").ToString + Return ViewState("NumeroContrato").ToString() End Get Set(value As String) ViewState("NumeroContrato") = value @@ -1273,7 +1273,7 @@ Partial Class Ventas End Property Private Property DescripcionContrato As String Get - Return ViewState("DescripcionContrato").ToString + Return ViewState("DescripcionContrato").ToString() End Get Set(value As String) ViewState("DescripcionContrato") = value @@ -1281,7 +1281,7 @@ Partial Class Ventas End Property Private Property NumeroLicitacion As String Get - Return ViewState("NumeroLicitacion").ToString + Return ViewState("NumeroLicitacion").ToString() End Get Set(value As String) ViewState("NumeroLicitacion") = value @@ -1289,7 +1289,7 @@ Partial Class Ventas End Property Private Property CveAlmacenExistenciasContrato As Integer Get - Return ViewState("CveAlmacenExistenciasContrato").ToString.ToEntero + Return ViewState("CveAlmacenExistenciasContrato").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveAlmacenExistenciasContrato") = value @@ -1297,7 +1297,7 @@ Partial Class Ventas End Property Private Property CveAlmacenOrigenContrato As Integer Get - Return ViewState("CveAlmacenOrigenContrato").ToString.ToEntero + Return ViewState("CveAlmacenOrigenContrato").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveAlmacenOrigenContrato") = value @@ -1392,7 +1392,7 @@ Partial Class Ventas #Region " PROPIEDADES NUEVAS " Private Property CveOC As Integer Get - Return ViewState("CveOC").ToString.ToEntero + Return ViewState("CveOC").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveOC") = value @@ -1411,7 +1411,7 @@ Partial Class Ventas Private Property EnviarCorreoCliente As Boolean Get - Return CBool(ViewState("EnviarCorreoCliente").ToString) + Return CBool(ViewState("EnviarCorreoCliente").ToString()) End Get Set(value As Boolean) ViewState("EnviarCorreoCliente") = value @@ -1419,7 +1419,7 @@ Partial Class Ventas End Property Private Property EstatusCliente As Boolean Get - Return CBool(ViewState("EstatusCliente").ToString) + Return CBool(ViewState("EstatusCliente").ToString()) End Get Set(value As Boolean) ViewState("EstatusCliente") = value @@ -1427,7 +1427,7 @@ Partial Class Ventas End Property Private Property CveMetodoPagoCliente As Integer Get - Return ViewState("CveMetodoPagoCliente").ToString.ToEntero + Return ViewState("CveMetodoPagoCliente").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveMetodoPagoCliente") = value @@ -1435,7 +1435,7 @@ Partial Class Ventas End Property Private Property Modalidad As String Get - Return ViewState("Modalidad").ToString + Return ViewState("Modalidad").ToString() End Get Set(value As String) ViewState("Modalidad") = value @@ -1443,7 +1443,7 @@ Partial Class Ventas End Property Private Property Index As Integer Get - Return ViewState("Index").ToString.ToEntero + Return ViewState("Index").ToString().ToEntero() End Get Set(value As Integer) ViewState("Index") = value @@ -1451,7 +1451,7 @@ Partial Class Ventas End Property Private Property TotAnt As Decimal Get - Return ViewState("TotAnt").ToString.ToDecimal + Return ViewState("TotAnt").ToString().ToDecimal End Get Set(value As Decimal) ViewState("TotAnt") = value @@ -1459,7 +1459,7 @@ Partial Class Ventas End Property Private Property TotalOriginal As Double Get - Return ViewState("TotalOriginal").ToString.ToDouble + Return ViewState("TotalOriginal").ToString().ToDouble End Get Set(value As Double) ViewState("TotalOriginal") = value @@ -1468,7 +1468,7 @@ Partial Class Ventas Private Property AplicaCancelarRemision As Boolean Get - Return CBool(ViewState("AplicaCancelarRemision").ToString) + Return CBool(ViewState("AplicaCancelarRemision").ToString()) End Get Set(value As Boolean) ViewState("AplicaCancelarRemision") = value @@ -1476,7 +1476,7 @@ Partial Class Ventas End Property Private Property TipoVentaSucursal As Integer Get - Return ViewState("TipoVentaSucursal").ToString.ToEntero + Return ViewState("TipoVentaSucursal").ToString().ToEntero() End Get Set(value As Integer) ViewState("TipoVentaSucursal") = value @@ -1493,7 +1493,7 @@ Partial Class Ventas End Property Private Property EditoRemision As Boolean Get - Return CBool(ViewState("EditoRemision").ToString) + Return CBool(ViewState("EditoRemision").ToString()) End Get Set(value As Boolean) ViewState("EditoRemision") = value @@ -1501,7 +1501,7 @@ Partial Class Ventas End Property Private Property AplicaNC As Boolean Get - Return CBool(ViewState("AplicaNC").ToString) + Return CBool(ViewState("AplicaNC").ToString()) End Get Set(value As Boolean) ViewState("AplicaNC") = value @@ -1517,7 +1517,7 @@ Partial Class Ventas End Property Private Property AplicaNCMasiva As Boolean Get - Return CBool(ViewState("AplicaNCMasiva").ToString) + Return CBool(ViewState("AplicaNCMasiva").ToString()) End Get Set(value As Boolean) ViewState("AplicaNCMasiva") = value @@ -1525,7 +1525,7 @@ Partial Class Ventas End Property Private Property RefacturacionGeneroNC As Boolean Get - Return CBool(ViewState("RefacturacionGeneroNC").ToString) + Return CBool(ViewState("RefacturacionGeneroNC").ToString()) End Get Set(value As Boolean) ViewState("RefacturacionGeneroNC") = value @@ -1533,7 +1533,7 @@ Partial Class Ventas End Property Private Property ModalidadEdicion As Boolean Get - Return CBool(ViewState("ModalidadEdicion").ToString) + Return CBool(ViewState("ModalidadEdicion").ToString()) End Get Set(value As Boolean) ViewState("ModalidadEdicion") = value @@ -1541,7 +1541,7 @@ Partial Class Ventas End Property Private Property ConversionRemision As String Get - Return ViewState("ConversionRemision").ToString + Return ViewState("ConversionRemision").ToString() End Get Set(value As String) ViewState("ConversionRemision") = value @@ -1549,7 +1549,7 @@ Partial Class Ventas End Property Private Property TipoCambioRemision As Decimal Get - Return ViewState("TipoCambioRemision").ToString.ToDecimal + Return ViewState("TipoCambioRemision").ToString().ToDecimal End Get Set(value As Decimal) ViewState("TipoCambioRemision") = value @@ -1557,7 +1557,7 @@ Partial Class Ventas End Property Private Property TieneContrato As Boolean Get - Return CBool(ViewState("TieneContrato").ToString) + Return CBool(ViewState("TieneContrato").ToString()) End Get Set(value As Boolean) ViewState("TieneContrato") = value @@ -1565,7 +1565,7 @@ Partial Class Ventas End Property Private Property CveOrdenCompraContrato As Integer Get - Return ViewState("CveOrdenCompraContrato").ToString.ToEntero + Return ViewState("CveOrdenCompraContrato").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveOrdenCompraContrato") = value @@ -1582,7 +1582,7 @@ Partial Class Ventas End Property Private Property RequiereOC As Boolean Get - Return CBool(ViewState("RequiereOC").ToString) + Return CBool(ViewState("RequiereOC").ToString()) End Get Set(value As Boolean) ViewState("RequiereOC") = value @@ -1590,7 +1590,7 @@ Partial Class Ventas End Property Private Property PorcentajeCredito As Decimal Get - Return ViewState("PorcentajeCredito").ToString.ToDecimal + Return ViewState("PorcentajeCredito").ToString().ToDecimal End Get Set(value As Decimal) ViewState("PorcentajeCredito") = value @@ -1598,7 +1598,7 @@ Partial Class Ventas End Property Private Property CvePedidoA As Integer Get - Return ViewState("CvePedidoA").ToString.ToEntero + Return ViewState("CvePedidoA").ToString().ToEntero() End Get Set(value As Integer) ViewState("CvePedidoA") = value @@ -1607,7 +1607,7 @@ Partial Class Ventas Private Property CveEmpresaCRM As Integer Get - Return ViewState("CveEmpresaCRM").ToString.ToEntero + Return ViewState("CveEmpresaCRM").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveEmpresaCRM") = value @@ -1616,7 +1616,7 @@ Partial Class Ventas Private Property CveAcercamientoCRM As Integer Get - Return ViewState("CveAcercamientoCRM").ToString.ToEntero + Return ViewState("CveAcercamientoCRM").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveAcercamientoCRM") = value @@ -1642,7 +1642,7 @@ Partial Class Ventas Private Property CveEstatus As Integer Get - Return ViewState("CveEstatus").ToString.ToEntero + Return ViewState("CveEstatus").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveEstatus") = value @@ -1650,7 +1650,7 @@ Partial Class Ventas End Property Private Property DiasCredito As Integer Get - Return ViewState("DiasCredito").ToString.ToEntero + Return ViewState("DiasCredito").ToString().ToEntero() End Get Set(value As Integer) ViewState("DiasCredito") = value @@ -1658,7 +1658,7 @@ Partial Class Ventas End Property Private Property EsDiasCreditoFijo As Boolean Get - Return CBool(ViewState("EsDiasCreditoFijo").ToString) + Return CBool(ViewState("EsDiasCreditoFijo").ToString()) End Get Set(value As Boolean) ViewState("EsDiasCreditoFijo") = value @@ -1666,7 +1666,7 @@ Partial Class Ventas End Property Private Property VentaSaldoAlmacen As Decimal Get - Return ViewState("VentaSaldoAlmacen").ToString.ToDecimal + Return ViewState("VentaSaldoAlmacen").ToString().ToDecimal End Get Set(value As Decimal) ViewState("VentaSaldoAlmacen") = value @@ -1682,7 +1682,7 @@ Partial Class Ventas End Property Private Property SeCancelaRemisionProceso As Boolean Get - Return CBool(ViewState("SeCancelaRemisionProceso").ToString) + Return CBool(ViewState("SeCancelaRemisionProceso").ToString()) End Get Set(value As Boolean) ViewState("SeCancelaRemisionProceso") = value @@ -1691,7 +1691,7 @@ Partial Class Ventas Private Property CvePrecioLista As Integer Get - Return ViewState("CvePrecioLista").ToString.ToEntero + Return ViewState("CvePrecioLista").ToString().ToEntero() End Get Set(value As Integer) ViewState("CvePrecioLista") = value @@ -1707,7 +1707,7 @@ Partial Class Ventas If ViewState("ClienteEsDistribuidor") Is Nothing Then Return False Else - Return Boolean.Parse(ViewState("ClienteEsDistribuidor").ToString) + Return Boolean.Parse(ViewState("ClienteEsDistribuidor").ToString()) End If End Get Set(value As Boolean) @@ -1840,7 +1840,7 @@ Partial Class Ventas DdlTipoComprobante.Items.Insert(DdlTipoComprobante.Items.Count, New ListItem("Pedido", "Pd2")) - If UsuarioActual.Empresa.Funcionalidad(344).ToString = "1" Then + If UsuarioActual.Empresa.Funcionalidad(344).ToString() = "1" Then DdlTipoComprobante.Items.Insert(DdlTipoComprobante.Items.Count, New ListItem("NC de Remisión", "RNC")) DivBtnRemNC.Visible = True DivTxtRemNC.Visible = True @@ -1857,7 +1857,7 @@ Partial Class Ventas TxtOrdenCompra.Attributes.Add("onblur", "BuscarOCRegistrada();") End If - If UsuarioActual.Empresa.Funcionalidad(561).ToString = "1" Then + If UsuarioActual.Empresa.Funcionalidad(561).ToString() = "1" Then thPoliza.Visible = True thPoliza2.Visible = True End If @@ -1870,8 +1870,8 @@ Partial Class Ventas CvePresupuesto = 0 'MODALIDADES - If Request("Op") IsNot Nothing AndAlso Request("Op").ToString <> "" Then - Opcion = Request("Op").ToString + If Request("Op") IsNot Nothing AndAlso Request("Op").ToString() <> "" Then + Opcion = Request("Op").ToString() LblTitulo.Text = "Registro de Cotizaciones" TrTipo.Visible = False TabAlmacen.Visible = False @@ -1984,14 +1984,14 @@ Partial Class Ventas End If 'Carga cliente - If Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero > 0 AndAlso Request("CveFactura") Is Nothing Then + If Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero() > 0 AndAlso Request("CveFactura") Is Nothing Then ViewState("CveCliente") = Request("CveCliente") HdnCveCliente.Value = Request("CveCliente") CargaCliente(CveCliente) VerificarContrato(True) - ElseIf Request("CveFactura") IsNot Nothing AndAlso IsNumeric(Request("CveFactura")) AndAlso Request("CveFactura").ToEntero > 0 AndAlso Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero > 0 Then + ElseIf Request("CveFactura") IsNot Nothing AndAlso IsNumeric(Request("CveFactura")) AndAlso Request("CveFactura").ToEntero() > 0 AndAlso Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero() > 0 Then ViewState("CveCliente") = Request("CveCliente") - ViewState("CveFactura") = Request("CveFactura").ToEntero + ViewState("CveFactura") = Request("CveFactura").ToEntero() Dim RFC As String = CargaFactura(CveFactura) CargaCliente(CveCliente) Else @@ -2000,14 +2000,14 @@ Partial Class Ventas End If 'Carga empresa CRM - If Request("CveEmpresaCRM") IsNot Nothing AndAlso IsNumeric(Request("CveEmpresaCRM")) AndAlso Request("CveEmpresaCRM").ToEntero > 0 Then + If Request("CveEmpresaCRM") IsNot Nothing AndAlso IsNumeric(Request("CveEmpresaCRM")) AndAlso Request("CveEmpresaCRM").ToEntero() > 0 Then ViewState("CveEmpresaCRM") = Request("CveEmpresaCRM") CargaEmpresaCRM(CveEmpresaCRM) Else ViewState("CveEmpresaCRM") = -1 End If - If Request("CveAcercamientoCRM") IsNot Nothing AndAlso IsNumeric(Request("CveAcercamientoCRM")) AndAlso Request("CveAcercamientoCRM").ToEntero > 0 Then + If Request("CveAcercamientoCRM") IsNot Nothing AndAlso IsNumeric(Request("CveAcercamientoCRM")) AndAlso Request("CveAcercamientoCRM").ToEntero() > 0 Then ViewState("CveAcercamientoCRM") = Request("CveAcercamientoCRM") Else ViewState("CveAcercamientoCRM") = -1 @@ -2029,7 +2029,7 @@ Partial Class Ventas 'Carga Venta - If Request("CveVenta") IsNot Nothing AndAlso IsNumeric(Request("CveVenta")) AndAlso Request("CveVenta").ToEntero > 0 Then + If Request("CveVenta") IsNot Nothing AndAlso IsNumeric(Request("CveVenta")) AndAlso Request("CveVenta").ToEntero() > 0 Then ViewState("CveVenta") = Request("CveVenta") If CargaVenta() Then @@ -2096,12 +2096,12 @@ Partial Class Ventas End If Else - If Request("CveOS") IsNot Nothing AndAlso IsNumeric(Request("CveOS")) AndAlso Request("CveOS").ToEntero > 0 Then + If Request("CveOS") IsNot Nothing AndAlso IsNumeric(Request("CveOS")) AndAlso Request("CveOS").ToEntero() > 0 Then ViewState("CveOS") = Request("CveOS") CargaOS(CveOS) Else 'Modalidad Devoluciones y Refacturacion - If Request("CveDevolucion") IsNot Nothing AndAlso IsNumeric(Request("CveDevolucion")) AndAlso Request("CveDevolucion").ToEntero > 0 Then + If Request("CveDevolucion") IsNot Nothing AndAlso IsNumeric(Request("CveDevolucion")) AndAlso Request("CveDevolucion").ToEntero() > 0 Then ViewState("CveDevolucion") = Request("CveDevolucion") ViewState("CveVenta") = Request("CveDevolucion") ViewState("NuevaFactura") = Request("NuevaFactura") @@ -2109,7 +2109,7 @@ Partial Class Ventas trNCFactura.Visible = True DdlNCFactura.DataSource = Nothing DdlNCFactura.DataBind() - CargaNC(IfNull(Request("CveDevolucion"), "-1").ToString.ToEntero) + CargaNC(IfNull(Request("CveDevolucion"), "-1").ToString().ToEntero()) DdlNCFactura.SelectedValueExist(CveDevolucion) If NuevaFactura = 0 Then @@ -2177,16 +2177,16 @@ Partial Class Ventas TrAlmacenAsignado.Visible = True End If - Dim CveAlmacenDestino As Integer = DtContratos.FiltroPrimeroValor("CveAlmacenDestino", $"CveContrato = {If(DdlContratosModal.Items.Count > 0, DdlContratosModal.SelectedValue, "0")}").ToEntero + Dim CveAlmacenDestino As Integer = DtContratos.FiltroPrimeroValor("CveAlmacenDestino", $"CveContrato = {If(DdlContratosModal.Items.Count > 0, DdlContratosModal.SelectedValue, "0")}").ToEntero() If CveAlmacenDestino > 0 Then DdlAlmacenAsignado.Items.Clear() - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero} And CveTipoAlmacen In (4,10)") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} And CveTipoAlmacen In (4,10)") DdlAlmacenAsignado.DataBind() - DdlAlmacenAsignado.Items.Insert(0, New ListItem(DtContratos.FiltroPrimeroValor("Almacen", $"CveContrato = {DdlContratosModal.SelectedValue}"), CveAlmacenDestino.ToString)) - DdlAlmacenAsignado.SelectedValue = CveAlmacenDestino.ToString + DdlAlmacenAsignado.Items.Insert(0, New ListItem(DtContratos.FiltroPrimeroValor("Almacen", $"CveContrato = {DdlContratosModal.SelectedValue}"), CveAlmacenDestino.ToString())) + DdlAlmacenAsignado.SelectedValue = CveAlmacenDestino.ToString() Else DdlAlmacenAsignado.Items.Clear() - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero} AND CveTipoAlmacen IN (10)") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} AND CveTipoAlmacen IN (10)") DdlAlmacenAsignado.DataBind() End If UpParametros.Update() @@ -2204,7 +2204,7 @@ Partial Class Ventas End If 'Modalidad Contrato - If Request("CveContrato") IsNot Nothing AndAlso IsNumeric(Request("CveContrato")) AndAlso Request("CveContrato").ToEntero > 0 AndAlso Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").Contiene("0", "1") Then + If Request("CveContrato") IsNot Nothing AndAlso IsNumeric(Request("CveContrato")) AndAlso Request("CveContrato").ToEntero() > 0 AndAlso Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").Contiene("0", "1") Then TrAlmacenOrigen.Visible = False If DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then TrAlmacenAsignado.Visible = True @@ -2212,8 +2212,8 @@ Partial Class Ventas End If UPCondicionesPago.Visible = False RequiereAlmacenDestino = True - CveContrato = Request("CveContrato").ToEntero - TipoContrato = Request("Tipo").ToEntero + CveContrato = Request("CveContrato").ToEntero() + TipoContrato = Request("Tipo").ToEntero() 'DESACTIVA CAMBIO DE CLIENTE HlCliente.Attributes.Remove("class") @@ -2225,17 +2225,17 @@ Partial Class Ventas End If 'Modalidad CveCicloComercial - If Request("CveCicloComercial") IsNot Nothing AndAlso IsNumeric(Request("CveCicloComercial")) AndAlso Request("CveCicloComercial").ToEntero > 0 Then - ViewState("CveCicloComercial") = Request("CveCicloComercial").ToEntero + If Request("CveCicloComercial") IsNot Nothing AndAlso IsNumeric(Request("CveCicloComercial")) AndAlso Request("CveCicloComercial").ToEntero() > 0 Then + ViewState("CveCicloComercial") = Request("CveCicloComercial").ToEntero() CargaCicloComercialURL() UpParametros.Update() End If 'Modalidad Devolucion Pedido **REVISAR SI SE USA - If Request("CveContrato") IsNot Nothing AndAlso IsNumeric(Request("CveContrato")) AndAlso Request("CveContrato").ToEntero > 0 AndAlso Request("CvePedido") IsNot Nothing AndAlso IsNumeric(Request("CvePedido")) AndAlso Request("CvePedido").ToEntero > 0 AndAlso Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero = 2 Then - CveContrato = Request("CveContrato").ToEntero - CvePedido = Request("CvePedido").ToEntero - TipoContrato = Request("Tipo").ToEntero + If Request("CveContrato") IsNot Nothing AndAlso IsNumeric(Request("CveContrato")) AndAlso Request("CveContrato").ToEntero() > 0 AndAlso Request("CvePedido") IsNot Nothing AndAlso IsNumeric(Request("CvePedido")) AndAlso Request("CvePedido").ToEntero() > 0 AndAlso Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero() = 2 Then + CveContrato = Request("CveContrato").ToEntero() + CvePedido = Request("CvePedido").ToEntero() + TipoContrato = Request("Tipo").ToEntero() ''REQUIERE DEVOLUCION 'DdlDevolucionAlmacen.SelectedValue = "1" @@ -2246,10 +2246,10 @@ Partial Class Ventas End If 'MODALIDAD DEVOLUCION PEDIDO NUEVO - If Request("DevPed") IsNot Nothing AndAlso IsNumeric(Request("DevPed")) AndAlso Request("DevPed").ToEntero > 0 AndAlso Request("MovInv") IsNot Nothing AndAlso IsNumeric(Request("MovInv")) AndAlso Request("MovInv").ToEntero > 0 Then + If Request("DevPed") IsNot Nothing AndAlso IsNumeric(Request("DevPed")) AndAlso Request("DevPed").ToEntero() > 0 AndAlso Request("MovInv") IsNot Nothing AndAlso IsNumeric(Request("MovInv")) AndAlso Request("MovInv").ToEntero() > 0 Then ViewState("CveVenta") = Request("DevPed") ViewState("MovInv") = Request("MovInv") - ViewState("CveMovimientoDetalle") = IfNull(Request("CveMovimientoDetalle"), "-1").ToString.ToEntero + ViewState("CveMovimientoDetalle") = IfNull(Request("CveMovimientoDetalle"), "-1").ToString().ToEntero() DdlTipoComprobante.Items.Insert(5, New ListItem("Devolución de perdido", "DPe")) DdlTipoComprobante.SelectedValue = "DPe" DdlTipoComprobante.Enabled = False @@ -2267,8 +2267,8 @@ Partial Class Ventas DdlTipoComprobante_SelectedIndexChanged(sender, Nothing) 'Carga CvePresupuesto - If Request("CvePresupuesto") IsNot Nothing AndAlso IsNumeric(Request("CvePresupuesto")) AndAlso Request("CvePresupuesto").ToEntero > 0 Then - CvePresupuesto = Request("CvePresupuesto").ToEntero + If Request("CvePresupuesto") IsNot Nothing AndAlso IsNumeric(Request("CvePresupuesto")) AndAlso Request("CvePresupuesto").ToEntero() > 0 Then + CvePresupuesto = Request("CvePresupuesto").ToEntero() 'DdlEstatus.Enabled = False End If @@ -2291,16 +2291,16 @@ Partial Class Ventas End If 'CARGA PARA FACTURAR - ViewState("CveRemision") = IfNull(Request("CveRemision").ToEntero, 0) - ViewState("CveCotizacion") = IfNull(Request("CveCotizacion").ToEntero, 0) + ViewState("CveRemision") = IfNull(Request("CveRemision").ToEntero(), 0) + ViewState("CveCotizacion") = IfNull(Request("CveCotizacion").ToEntero(), 0) - If ViewState("CveCotizacion").ToString.ToEntero > 0 Then + If ViewState("CveCotizacion").ToString().ToEntero() > 0 Then EsCreaApartirDe = True End If - If ViewState("CveRemision").ToString.ToEntero > 0 Or ViewState("CveCotizacion").ToString.ToEntero > 0 Then + If ViewState("CveRemision").ToString().ToEntero() > 0 Or ViewState("CveCotizacion").ToString().ToEntero() > 0 Then 'ViewState("CveRemision") = Request("CveRemision") - 'Dim CveRemision As Integer = ViewState("CveRemision").ToString.ToEntero + 'Dim CveRemision As Integer = ViewState("CveRemision").ToString().ToEntero() CargaVenta() @@ -2340,8 +2340,8 @@ Partial Class Ventas 'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE If UsuarioActual.CveVendedor > 0 Then - If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString) - If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then + If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero() > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) + If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False End If 'multiples vendedores visible @@ -2350,7 +2350,7 @@ Partial Class Ventas End If End If - If UsuarioActual.Empresa.Funcionalidad(301).ToEntero > 0 Then + If UsuarioActual.Empresa.Funcionalidad(301).ToEntero() > 0 Then TxtFecha.Enabled = False ImgFecha.Visible = False End If @@ -2530,20 +2530,20 @@ Partial Class Ventas CargaMetodosPSModal() 'CARGA VALORES DE ORDEN DE PRODUCCION - Dim CveOrdenProduccion = IfNull(Request("CveOrdenProduccion"), "-1").ToString.ToEntero + Dim CveOrdenProduccion = IfNull(Request("CveOrdenProduccion"), "-1").ToString().ToEntero() If CveOrdenProduccion > 0 And Not CveVenta > 0 Then DdlOrdenProduccion.SelectedValueExist(CveOrdenProduccion) - If DdlOrdenProduccion.SelectedValue.ToEntero > 0 Then + If DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then DdlTipoComprobante.SelectedValue = "Rem" DdlMoneda.SelectedValue = "2" Dim ObjCGame As New ClsCGame - If ObjCGame.GetAvance(DdlOrdenProduccion.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + If ObjCGame.GetAvance(DdlOrdenProduccion.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then For Each dt As DataRow In ObjCGame.DtResultados.Rows - If dt("Avance").ToString.ToEntero > 0 Then - AgregarProductoServicio(dt("Avance").ToString.ToDecimal, 29472, "No Aplica", 19588, "Ingresos por comercializadora", 308366, "Ventas", dt("Datos").ToString, dt("PU").ToString.ToDecimal, 0, - DdlProyecto.SelectedValue.ToEntero, DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text) - 'AddPS(dt("Avance").ToString.ToDouble, 29472, "No Aplica", 19588, "Ingresos por comercializadora", 308366, "Ventas", dt("Datos").ToString, dt("PU").ToString.ToDouble, 0, 0, 0, 1, 0, True, - ' "", DdlProyecto.SelectedValue.ToEntero, DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text, 2, HdnTipoInv.Value.ToEntero) + If dt("Avance").ToString().ToEntero() > 0 Then + AgregarProductoServicio(dt("Avance").ToString().ToDecimal, 29472, "No Aplica", 19588, "Ingresos por comercializadora", 308366, "Ventas", dt("Datos").ToString(), dt("PU").ToString().ToDecimal, 0, + DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text) + 'AddPS(dt("Avance").ToString().ToDouble, 29472, "No Aplica", 19588, "Ingresos por comercializadora", 308366, "Ventas", dt("Datos").ToString(), dt("PU").ToString().ToDouble, 0, 0, 0, 1, 0, True, + ' "", DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text, 2, HdnTipoInv.Value.ToEntero()) End If Next GvPS.DataSource = TmpDT @@ -2560,7 +2560,7 @@ Partial Class Ventas End If - If Request("CveVenta") IsNot Nothing AndAlso IsNumeric(Request("CveVenta")) AndAlso Request("CveVenta").ToEntero = -1 AndAlso UsuarioActual.CveTipoDocumento.Length = 3 Then + If Request("CveVenta") IsNot Nothing AndAlso IsNumeric(Request("CveVenta")) AndAlso Request("CveVenta").ToEntero() = -1 AndAlso UsuarioActual.CveTipoDocumento.Length = 3 Then CargaDdlSubProyectos() UpParametros.Update() DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento) @@ -2574,7 +2574,7 @@ Partial Class Ventas CargaRestriccionesCreditoCliente(CveVenta:=Me.CveVenta) End If - If Not CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(403).ToString = "1" Then + If Not CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(403).ToString() = "1" Then If (DdlTipoComprobante.Items.FindByValue("Ing") IsNot Nothing) Then DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) End If @@ -2582,7 +2582,7 @@ Partial Class Ventas - If UsuarioActual.Empresa.Funcionalidad(558).ToEntero = 1 Then + If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 Then DivMesesSinIntereses.Visible = True DivDdlCuentaTarjetaCredito.Attributes.Add("class", "col-md-4") @@ -2591,6 +2591,7 @@ Partial Class Ventas TrPedido.Visible = False ' TrKilometrajeTxt.Visible = True End If + LtlTareaNueva.Text = String.Format(" Tarea", CveVenta) End If @@ -2715,7 +2716,7 @@ Partial Class Ventas If ObjPVenta.GetVta_Cortes("-1", "-1", UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, 0) Then If ObjPVenta.DtResultados.Rows.Count > 0 Then - Total = ObjPVenta.DtResultados(0)("ImporteInicial").ToString.ToDouble + ObjPVenta.DtResultados(0)("VentasEfectivo").ToString.ToDouble + ObjPVenta.DtResultados(0)("Propina").ToString.ToDouble + ObjPVenta.DtResultados(0)("Ingresado").ToString.ToDouble - ObjPVenta.DtResultados(0)("Retirado").ToString.ToDouble + Total = ObjPVenta.DtResultados(0)("ImporteInicial").ToString().ToDouble + ObjPVenta.DtResultados(0)("VentasEfectivo").ToString().ToDouble + ObjPVenta.DtResultados(0)("Propina").ToString().ToDouble + ObjPVenta.DtResultados(0)("Ingresado").ToString().ToDouble - ObjPVenta.DtResultados(0)("Retirado").ToString().ToDouble DineroCaja = Total LblEfectivoEsperado.Text = Total.FormatoNumero(2) @@ -2726,27 +2727,27 @@ Partial Class Ventas Dim Dr1 = Dt.NewRow Dr1("Descripcion") = "Fondo de Caja" - Dr1("Importe") = ObjPVenta.DtResultados(0)("ImporteInicial").ToString.ToDouble + Dr1("Importe") = ObjPVenta.DtResultados(0)("ImporteInicial").ToString().ToDouble Dt.Rows.Add(Dr1) Dim Dr2 = Dt.NewRow Dr2("Descripcion") = "Ventas en Efectivo" - Dr2("Importe") = ObjPVenta.DtResultados(0)("VentasEfectivo").ToString.ToDouble + Dr2("Importe") = ObjPVenta.DtResultados(0)("VentasEfectivo").ToString().ToDouble Dt.Rows.Add(Dr2) Dim Dr3 = Dt.NewRow Dr3("Descripcion") = "Propinas" - Dr3("Importe") = ObjPVenta.DtResultados(0)("Propina").ToString.ToDouble + Dr3("Importe") = ObjPVenta.DtResultados(0)("Propina").ToString().ToDouble Dt.Rows.Add(Dr3) Dim Dr4 = Dt.NewRow Dr4("Descripcion") = "Entradas" - Dr4("Importe") = ObjPVenta.DtResultados(0)("Ingresado").ToString.ToDouble + Dr4("Importe") = ObjPVenta.DtResultados(0)("Ingresado").ToString().ToDouble Dt.Rows.Add(Dr4) Dim Dr5 = Dt.NewRow Dr5("Descripcion") = "Salidas" - Dr5("Importe") = ObjPVenta.DtResultados(0)("Retirado").ToString.ToDouble + Dr5("Importe") = ObjPVenta.DtResultados(0)("Retirado").ToString().ToDouble Dt.Rows.Add(Dr5) Dim Dr6 = Dt.NewRow @@ -2803,8 +2804,8 @@ Partial Class Ventas End Sub Private Sub BtnAceptarIE_Click(sender As Object, e As EventArgs) Handles BtnAceptarIE.Click Dim ObjPVenta As New ClsPuntoVenta - If TxtCantidadIE.Text.ToEntero > 0 Then - If ObjPVenta.AddVta_MovimientosCajas(CveCorte, UsuarioActual.CveUsuario, TxtCantidadIE.Text.ToDouble, TxtDescripcionIE.Text, HdnTipoMovimiento.Value.ToEntero, Now) Then + If TxtCantidadIE.Text.ToEntero() > 0 Then + If ObjPVenta.AddVta_MovimientosCajas(CveCorte, UsuarioActual.CveUsuario, TxtCantidadIE.Text.ToDouble, TxtDescripcionIE.Text, HdnTipoMovimiento.Value.ToEntero(), Now) Then TxtCantidadIE.Text = "" TxtDescripcionIE.Text = "" RegistraScript("$('#DivIngresoEgreso').modal('hide')", "divingresoegreso") @@ -2953,16 +2954,16 @@ Partial Class Ventas Exit Sub End If - LbContratoImporteTotal.Text = DrContrato("ImporteTotal").ToString.FormatoNumero - LbContratoImporteMinimo.Text = DrContrato("ImporteMin").ToString.FormatoNumero - LbContratoImporteMaximo.Text = DrContrato("ImporteMax").ToString.FormatoNumero - LtContratoImporteSaldo.Text = DrContrato("ImporteSaldo").ToString.FormatoNumero + LbContratoImporteTotal.Text = DrContrato("ImporteTotal").ToString().FormatoNumero + LbContratoImporteMinimo.Text = DrContrato("ImporteMin").ToString().FormatoNumero + LbContratoImporteMaximo.Text = DrContrato("ImporteMax").ToString().FormatoNumero + LtContratoImporteSaldo.Text = DrContrato("ImporteSaldo").ToString().FormatoNumero Dim ObjContrato As New ClsContratos Dim NoId As Integer = 0 - If ObjContrato.GetContratosDetalle(DdlContratosModal.SelectedValue.ToEntero) Then + If ObjContrato.GetContratosDetalle(DdlContratosModal.SelectedValue.ToEntero()) Then 'SI ES CONTRATO DE CONSIGNACION DE VENTA AGARRA LAS EXISTENCIAS DEL ALMACEN CreaConsignacionSerieDetalle() @@ -2970,9 +2971,9 @@ Partial Class Ventas CveAlmacenOrigenContrato = -1 GvContratoDetalles.Columns(8).Visible = False - If DrContrato("CveContratoTipo").ToString.Contiene("27") Then - CveAlmacenExistenciasContrato = If(DrContrato("CveAlmacenDestino").ToString.ToEntero > 0, DrContrato("CveAlmacenDestino").ToString.ToEntero, -1) - CveAlmacenOrigenContrato = If(DrContrato("CveAlmacenOrigen").ToString.ToEntero > 0, DrContrato("CveAlmacenOrigen").ToString.ToEntero, -1) + If DrContrato("CveContratoTipo").ToString().Contiene("27") Then + CveAlmacenExistenciasContrato = If(DrContrato("CveAlmacenDestino").ToString().ToEntero() > 0, DrContrato("CveAlmacenDestino").ToString().ToEntero(), -1) + CveAlmacenOrigenContrato = If(DrContrato("CveAlmacenOrigen").ToString().ToEntero() > 0, DrContrato("CveAlmacenOrigen").ToString().ToEntero(), -1) End If NoId = ObjContrato.DtResultados.FiltraParametros("NoIdentificacion <> ''").Rows.Count 'PARA SABER SI ALGUN DETALLE TIENE ESTE CAMPO Y HACER VISIBLE LA COLUMNA @@ -2983,39 +2984,39 @@ Partial Class Ventas GvContratoDetalles.DataBind() UpContratos.Update() - NumeroContrato = DrContrato("NumeroContrato").ToString - DescripcionContrato = DrContrato("DescripcionContrato").ToString - NumeroLicitacion = DrContrato("NumeroLicitacion").ToString.Trim + NumeroContrato = DrContrato("NumeroContrato").ToString() + DescripcionContrato = DrContrato("DescripcionContrato").ToString() + NumeroLicitacion = DrContrato("NumeroLicitacion").ToString().Trim DdlVendedor.SelectedValueExist(DrContrato("CveVendedor")) - If DrContrato("CveSucursalCliente").ToString.ToEntero > 0 Then + If DrContrato("CveSucursalCliente").ToString().ToEntero() > 0 Then DdlSucursalCliente.SelectedValueExist(DrContrato("CveSucursalCliente")) DdlSucursalCliente_SelectedIndexChanged(DdlSucursalCliente, EventArgs.Empty) DdlSucursalCliente.Enabled = False DdlSucursalCliente.Attributes.Add("disabled", "") End If - Dim CveAlmacenDestino As Integer = DrContrato("CveAlmacenDestino").ToString.ToEntero + Dim CveAlmacenDestino As Integer = DrContrato("CveAlmacenDestino").ToString().ToEntero() If CveAlmacenDestino > 0 Then DdlAlmacenAsignado.Items.Clear() - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero} And CveTipoAlmacen IN (4, 10)") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} And CveTipoAlmacen IN (4, 10)") DdlAlmacenAsignado.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlAlmacenAsignado.Items.Insert(1, New ListItem(DrContrato("Almacen").ToString, CveAlmacenDestino.ToString)) - DdlAlmacenAsignado.SelectedValueExist(CveAlmacenDestino.ToString) + DdlAlmacenAsignado.Items.Insert(1, New ListItem(DrContrato("Almacen").ToString(), CveAlmacenDestino.ToString())) + DdlAlmacenAsignado.SelectedValueExist(CveAlmacenDestino.ToString()) DdlAlmacenAsignado.DataBind() Else DdlAlmacenAsignado.Items.Clear() - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero} And CveTipoAlmacen In (4,10)") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} And CveTipoAlmacen In (4,10)") DdlAlmacenAsignado.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlAlmacenAsignado.SelectedValueExist(CveAlmacenDestino.ToString) + DdlAlmacenAsignado.SelectedValueExist(CveAlmacenDestino.ToString()) DdlAlmacenAsignado.DataBind() End If If DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero}") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}") DdlAlmacenAsignado.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlAlmacenAsignado.SelectedValueExist(CveAlmacenDestino.ToString) + DdlAlmacenAsignado.SelectedValueExist(CveAlmacenDestino.ToString()) DdlAlmacenAsignado.DataBind() End If @@ -3035,15 +3036,15 @@ Partial Class Ventas Next Dim EsValido = True For Each Dr As DataRow In TmpDT.Rows - Dim CantidadActual = Dr("Cantidad").ToString.ToDouble + Dim CantidadActual = Dr("Cantidad").ToString().ToDouble Dim CantidadDispo = 0.0 Dim CantidadAsignada = 0.0 For Each gvr As GridViewRow In GvContratoDetalles.Rows - If gvr.DataKey("CvePS").ToEntero = Dr("CvePS").ToString.ToEntero Then - CantidadDispo = gvr.DataKey("Cantidad").ToString.ToDouble - gvr.FCTextBox("TxtCant").Text.ToDouble + If gvr.DataKey("CvePS").ToEntero() = Dr("CvePS").ToString().ToEntero() Then + CantidadDispo = gvr.DataKey("Cantidad").ToString().ToDouble - gvr.FCTextBox("TxtCant").Text.ToDouble If CantidadDispo = 0 Then Continue For CantidadAsignada = If(CantidadDispo > CantidadActual, CantidadActual, CantidadDispo) - gvr.FCTextBox("TxtCant").Text = (gvr.FCTextBox("TxtCant").Text.ToDouble + CantidadAsignada).ToString + gvr.FCTextBox("TxtCant").Text = (gvr.FCTextBox("TxtCant").Text.ToDouble + CantidadAsignada).ToString() CantidadActual = CantidadActual - CantidadAsignada If CantidadActual = 0 Then @@ -3079,7 +3080,7 @@ Partial Class Ventas DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot")) End If - Select Case RBLTipoContrato.SelectedValue.ToEntero + Select Case RBLTipoContrato.SelectedValue.ToEntero() Case 1 DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido", "Ped")) DdlTipoComprobante.SelectedValue = "Ped" @@ -3117,11 +3118,11 @@ Partial Class Ventas 'End If - Dim DrContrato As DataRow = DtContratos.FiltroPrimero($"CveContrato = {DdlContratosModal.SelectedValue.ToEntero}") + Dim DrContrato As DataRow = DtContratos.FiltroPrimero($"CveContrato = {DdlContratosModal.SelectedValue.ToEntero()}") Dim ps As New ClsInventarios - CveContrato = DdlContratosModal.SelectedValue.ToEntero - AplicaGastoContrato = If(DrContrato("CveContratoTipo").ToString.Contiene("9", "10", "13"), True, False) 'Arrendamiento, Servicios De Impresion, Financiamiento + CveContrato = DdlContratosModal.SelectedValue.ToEntero() + AplicaGastoContrato = If(DrContrato("CveContratoTipo").ToString().Contiene("9", "10", "13"), True, False) 'Arrendamiento, Servicios De Impresion, Financiamiento 'VALIDA IMPORTE DEL CONTRATO Dim SeleccionadoContrato = 0.0 '(From row As GridViewRow In GvContratoDetalles.Rows.Cast(Of GridViewRow)() Select row.FCLabel("LtlTotal").Text.ToDecimal).Sum @@ -3133,17 +3134,17 @@ Partial Class Ventas TxtRetIVA.Text = "0" For Each Row As GridViewRow In GvContratoDetalles.Rows - If Row.FCTextBox("TxtCant").Text.ToEntero > 0 Then + If Row.FCTextBox("TxtCant").Text.ToEntero() > 0 Then 'VALIDA EXISTENCIAS DE ALMACÉN - 'Dim DrPS = GlobalDTProductosServicios(CveEmpresa:=UsuarioActual.CveEmpresa, CvePS:=Row.DataKey("CvePS").ToEntero).FiltroPrimero("") - Dim DrPS = GlobalDTPS(CveEmpresa:=UsuarioActual.CveEmpresa, CvePS:=Row.DataKey("CvePS").ToEntero).FiltroPrimero("") + 'Dim DrPS = GlobalDTProductosServicios(CveEmpresa:=UsuarioActual.CveEmpresa, CvePS:=Row.DataKey("CvePS").ToEntero()).FiltroPrimero("") + Dim DrPS = GlobalDTPS(CveEmpresa:=UsuarioActual.CveEmpresa, CvePS:=Row.DataKey("CvePS").ToEntero()).FiltroPrimero("") If DrPS IsNot Nothing Then - Dim CveTipoPS As Integer = DrPS("CveTipoPS").ToString.ToEntero - Dim CveTipoInv As Integer = DrPS("Inv_CveMetodoInventario").ToString.ToEntero - Dim existencia As Decimal = ps.GetExistenciasPS(Row.DataKey("CvePS").ToEntero, Row.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) - If (existencia < Row.FCTextBox("TxtCant").Text.ToEntero AndAlso CveTipoPS <> 1) AndAlso UsuarioActual.CveEmpresa.Contiene(72, 80) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ped") Then ' And DdlContratosModal.SelectedValue.ToEntero <> 196 Then + Dim CveTipoPS As Integer = DrPS("CveTipoPS").ToString().ToEntero() + Dim CveTipoInv As Integer = DrPS("Inv_CveMetodoInventario").ToString().ToEntero() + Dim existencia As Decimal = ps.GetExistenciasPS(Row.DataKey("CvePS").ToEntero(), Row.DataKey("CveUM").ToEntero(), UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) + If (existencia < Row.FCTextBox("TxtCant").Text.ToEntero() AndAlso CveTipoPS <> 1) AndAlso UsuarioActual.CveEmpresa.Contiene(72, 80) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ped") Then ' And DdlContratosModal.SelectedValue.ToEntero() <> 196 Then Alert("No cuenta con la cantidad suficiente en inventario para el producto:
    " + Row.FCLiteral("LtlPS").Text + ".", TipoMensaje.MsgAdvertencia) TmpDT.Clear() GvPS.DataSource = Nothing @@ -3151,13 +3152,13 @@ Partial Class Ventas UpPS.Update() Exit Sub Else - SeleccionadoContrato += Row.FCTextBox("TxtCant").Text.ToEntero * Row.FCLiteral("LtlPU").Text.ToDouble - AgregarProductoServicio(Row.FCTextBox("TxtCant").Text.ToEntero, Row.DataKey("CveUM").ToEntero, Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero, - Row.DataKey("Clasificacion"), Row.DataKey("CvePS").ToEntero, Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDecimal, 0, - DrContrato("CveProyecto").ToString.ToEntero, DrContrato("ProyectoContrato").ToString, DrContrato("CveSubProyecto").ToString.ToEntero, DrContrato("SubProyectoContrato").ToString, CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero) - 'AddPS(Row.FCTextBox("TxtCant").Text.ToEntero, Row.DataKey("CveUM").ToEntero, Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero, Row.DataKey("Clasificacion"), - ' Row.DataKey("CvePS").ToEntero, Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDouble, If(Row.DataKey("IVA").ToDouble = -1, ViewState("IVA").ToString.ToDouble, Row.DataKey("IVA").ToDouble), 0, 0, 1, 0, True, "", - ' DrContrato("CveProyecto").ToString.ToEntero, DrContrato("ProyectoContrato").ToString, DrContrato("CveSubProyecto").ToString.ToEntero, DrContrato("SubProyectoContrato").ToString, CveTipoPS, CveTipoInv, CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero, CodigoPS:=Row.FCLiteral("LtlPS").Text) + SeleccionadoContrato += Row.FCTextBox("TxtCant").Text.ToEntero() * Row.FCLiteral("LtlPU").Text.ToDouble + AgregarProductoServicio(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(), + Row.DataKey("Clasificacion"), Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDecimal, 0, + DrContrato("CveProyecto").ToString().ToEntero(), DrContrato("ProyectoContrato").ToString(), DrContrato("CveSubProyecto").ToString().ToEntero(), DrContrato("SubProyectoContrato").ToString(), CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero()) + 'AddPS(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(), Row.DataKey("Clasificacion"), + ' Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDouble, If(Row.DataKey("IVA").ToDouble = -1, ViewState("IVA").ToString().ToDouble, Row.DataKey("IVA").ToDouble), 0, 0, 1, 0, True, "", + ' DrContrato("CveProyecto").ToString().ToEntero(), DrContrato("ProyectoContrato").ToString(), DrContrato("CveSubProyecto").ToString().ToEntero(), DrContrato("SubProyectoContrato").ToString(), CveTipoPS, CveTipoInv, CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero(), CodigoPS:=Row.FCLiteral("LtlPS").Text) End If Else Alert("El producto presenta una inconsistencia en su información", TipoMensaje.MsgError) @@ -3206,8 +3207,8 @@ Partial Class Ventas If Not CveCicloComercial > 0 Then 'SI EL IMPORTE MAX O EL IMPORTE FIJO DEL CONTRATO FLEXIBLE ES CERO, NO HAY LIMITE - If Not (DrContrato("Importe").ToString.ToDouble = 0 And DrContrato("ImporteMax").ToString.ToDouble = 0) Then - If DdlTipoComprobante.SelectedValue = "Ing" And (DrContrato("ModalidadDetalle").ToString = "1" Or DrContrato("ImporteMax").ToString.ToDouble > 0) AndAlso (DrContrato("ImporteTotal").ToString.ToDouble - DrContrato("Avance").ToString.ToDouble) < (SeleccionadoContrato) Then + If Not (DrContrato("Importe").ToString().ToDouble = 0 And DrContrato("ImporteMax").ToString().ToDouble = 0) Then + If DdlTipoComprobante.SelectedValue = "Ing" And (DrContrato("ModalidadDetalle").ToString() = "1" Or DrContrato("ImporteMax").ToString().ToDouble > 0) AndAlso (DrContrato("ImporteTotal").ToString().ToDouble - DrContrato("Avance").ToString().ToDouble) < (SeleccionadoContrato) Then Alert("Se excede el importe límite del contrato. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) TmpDT.Clear() GvPS.DataSource = Nothing @@ -3247,9 +3248,9 @@ Partial Class Ventas 'Cargamos los datos del Cliente DtContratos = ObjContratos.DtResultados - ViewState("CveCliente") = ObjContratos.DtResultados(0)("CveCliente").ToString.ToEntero - CorreoNotificacionPedDev = ObjContratos.DtResultados(0)("CorreoNotificacionPedDev").ToString - HdnCveCliente.Value = ObjContratos.DtResultados(0)("CveCliente").ToString + ViewState("CveCliente") = ObjContratos.DtResultados(0)("CveCliente").ToString().ToEntero() + CorreoNotificacionPedDev = ObjContratos.DtResultados(0)("CorreoNotificacionPedDev").ToString() + HdnCveCliente.Value = ObjContratos.DtResultados(0)("CveCliente").ToString() CargaCliente(CveCliente) DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido", "Ped")) DdlTipoComprobante.SelectedValue = "Ped" @@ -3257,17 +3258,17 @@ Partial Class Ventas DdlAlmacenAsignado.Enabled = False DdlSubProyectoDatos.SelectedValueExist(ObjContratos.DtResultados(0)("CveSubProyecto")) - AplicaGastoContrato = If(ObjContratos.DtResultados(0)("CveContratoTipo").ToString.Contiene("9", "10", "13"), True, False) 'Arrendamiento, Servicios De Impresion, Financiamiento + AplicaGastoContrato = If(ObjContratos.DtResultados(0)("CveContratoTipo").ToString().Contiene("9", "10", "13"), True, False) 'Arrendamiento, Servicios De Impresion, Financiamiento If TipoContrato = 1 Then 'Cargamos los datos del Contrato RblOpcionContrato.SelectedValue = "2" BtnIniciarContrato_Click(Nothing, Nothing) - DdlContratosModal.SelectedValue = CveContrato.ToString + DdlContratosModal.SelectedValue = CveContrato.ToString() DdlContratosModal_SelectedIndexChanged(Nothing, Nothing) ElseIf TipoContrato = 0 Then 'Mostramos los almacenes - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero} {If(DdlTipoComprobante.SelectedValue = "Ped", "", "AND CveTipoAlmacen IN (4,10)")}") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} {If(DdlTipoComprobante.SelectedValue = "Ped", "", "AND CveTipoAlmacen IN (4,10)")}") DdlAlmacenAsignado.DataBind() DdlAlmacenAsignado.Enabled = True TrAlmacenAsignado.Visible = True @@ -3279,19 +3280,19 @@ Partial Class Ventas End If If ObjContratos.CveAlmacen > 0 Then - If (DdlAlmacenAsignado.Items.FindByValue(ObjContratos.CveAlmacen.ToString) Is Nothing) Then - Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", ObjContratos.CveAlmacen.ToString)) + If (DdlAlmacenAsignado.Items.FindByValue(ObjContratos.CveAlmacen.ToString()) Is Nothing) Then + Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", ObjContratos.CveAlmacen.ToString())) If dr IsNot Nothing Then - DdlAlmacenAsignado.Items.Insert(0, New ListItem(dr("Almacen").ToString, dr("CveAlmacen").ToString)) + DdlAlmacenAsignado.Items.Insert(0, New ListItem(dr("Almacen").ToString(), dr("CveAlmacen").ToString())) End If End If - DdlAlmacenAsignado.SelectedValue = ObjContratos.CveAlmacen.ToString + DdlAlmacenAsignado.SelectedValue = ObjContratos.CveAlmacen.ToString() DdlAlmacenAsignado.Enabled = False Else If (DdlAlmacenAsignado.Items.FindByValue("89") Is Nothing) Then Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", "89")) If dr IsNot Nothing Then - DdlAlmacenAsignado.Items.Insert(0, New ListItem(dr("Almacen").ToString, dr("CveAlmacen").ToString)) ' lo genera Obj.SelectedValue = Valor.ToString + DdlAlmacenAsignado.Items.Insert(0, New ListItem(dr("Almacen").ToString(), dr("CveAlmacen").ToString())) ' lo genera Obj.SelectedValue = Valor.ToString() DdlAlmacenAsignado.Enabled = False End If End If @@ -3301,13 +3302,13 @@ Partial Class Ventas If ObjContratos.CveAlmacenOrigen > 0 AndAlso TipoContrato = 0 Then DdlAlmacenOrigen.Visible = True RequiereAlmacenOrigen = True - If (DdlAlmacenOrigen.Items.FindByValue(ObjContratos.CveAlmacenOrigen.ToString) Is Nothing) Then - Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", ObjContratos.CveAlmacenOrigen.ToString)) + If (DdlAlmacenOrigen.Items.FindByValue(ObjContratos.CveAlmacenOrigen.ToString()) Is Nothing) Then + Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", ObjContratos.CveAlmacenOrigen.ToString())) If dr IsNot Nothing Then - DdlAlmacenOrigen.Items.Insert(0, New ListItem(dr("Almacen").ToString, dr("CveAlmacen").ToString)) + DdlAlmacenOrigen.Items.Insert(0, New ListItem(dr("Almacen").ToString(), dr("CveAlmacen").ToString())) End If End If - DdlAlmacenOrigen.SelectedValue = ObjContratos.CveAlmacenOrigen.ToString + DdlAlmacenOrigen.SelectedValue = ObjContratos.CveAlmacenOrigen.ToString() DdlAlmacenOrigen.Enabled = False End If @@ -3342,16 +3343,16 @@ Partial Class Ventas End Sub Private Sub GuardarContratoAvanceEstimaciones(ObjContrato As ClsContratos, factura As Modelos.Factura, ErrorList As List(Of String), Multiplicador As Integer, Optional CrearAvance As Boolean = False) - If (factura.CveContrato > 0 AndAlso ((DdlContratosModal.Items.Count > 0 AndAlso factura.CveContrato = DdlContratosModal.SelectedValue.ToEntero) OrElse DdlFiltroContrato.SelectedValue.ToEntero > 0 OrElse CrearAvance)) Or ContratoOC Then + If (factura.CveContrato > 0 AndAlso ((DdlContratosModal.Items.Count > 0 AndAlso factura.CveContrato = DdlContratosModal.SelectedValue.ToEntero()) OrElse DdlFiltroContrato.SelectedValue.ToEntero() > 0 OrElse CrearAvance)) Or ContratoOC Then Dim CveEstimacion As Integer = -1 If ObjContrato.AddEstimaciones(factura.CveContrato, factura.Fecha, -1, factura.CveVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - CveEstimacion = ObjContrato.DtResultados(0)("CveEstimacion").ToString.ToEntero + CveEstimacion = ObjContrato.DtResultados(0)("CveEstimacion").ToString().ToEntero() For Each row As DataRow In TmpDT.Rows - If row("CveContratoDetalle").ToString.ToEntero > 0 Then - If Not ObjContrato.AddContratosAvance(row("CveContratoDetalle").ToString.ToEntero, row("Cantidad").ToString.ToEntero * Multiplicador, factura.Fecha, UsuarioActual.CveUsuario, CveEstimacion:=CveEstimacion) Then + If row("CveContratoDetalle").ToString().ToEntero() > 0 Then + If Not ObjContrato.AddContratosAvance(row("CveContratoDetalle").ToString().ToEntero(), row("Cantidad").ToString().ToEntero() * Multiplicador, factura.Fecha, UsuarioActual.CveUsuario, CveEstimacion:=CveEstimacion) Then ErrorList.Add("Ocurrió un error al agregar los avances") End If End If @@ -3385,7 +3386,7 @@ Partial Class Ventas End If 'CONSIGNACION DE VENTA - If CveAlmacenExistenciasContrato > 0 And e.Row.DBCampo("Inv_CveMetodoInventario").ToString.ToEntero = 5 Then + If CveAlmacenExistenciasContrato > 0 And e.Row.DBCampo("Inv_CveMetodoInventario").ToString().ToEntero() = 5 Then GvContratoDetalles.Columns(8).Visible = True e.Row.FCButton("BtnSerieConsignacion").Visible = True e.Row.FCButton("BtnSerieConsignacion").CommandArgument = $"{e.Row.DBCampo("CveContratoDetalle")}°{e.Row.DBCampo("CvePS")}°{e.Row.DBCampo("CveUM")}°{e.Row.DBCampo("CodigoPS")}°{e.Row.DBCampo("Cantidad")}°{LimitaCantidadSerieLote}" @@ -3393,21 +3394,21 @@ Partial Class Ventas End If ''Si viene de una OC Sin Facturar y tiene contrato - 'If TieneContrato AndAlso ContratosConOC IsNot Nothing AndAlso ContratosConOC.ToString.Length > 0 Then - ' e.Row.FCTextBox("TxtCant").Text = e.Row.DBCampo("CantidadOC").ToString + 'If TieneContrato AndAlso ContratosConOC IsNot Nothing AndAlso ContratosConOC.ToString().Length > 0 Then + ' e.Row.FCTextBox("TxtCant").Text = e.Row.DBCampo("CantidadOC").ToString() 'End If End If End Sub Private Sub BtnCalcularTotalesContrato_Click(sender As Object, e As EventArgs) Handles BtnCalcularTotalesContrato.Click For Each row As GridViewRow In GvContratoDetalles.Rows - row.FCLiteral("LtlTotal").Text = (row.FCLiteral("LtlCantDisp").Text.ToEntero * row.FCTextBox("TxtCant").Text.ToDouble).FormatoNumero(2) + row.FCLiteral("LtlTotal").Text = (row.FCLiteral("LtlCantDisp").Text.ToEntero() * row.FCTextBox("TxtCant").Text.ToDouble).FormatoNumero(2) Next UpContratos.Update() End Sub Private Sub DdlContratoModalSelectIndex() - If Not DdlContratosModal.SelectedValue.ToEntero > 0 Then + If Not DdlContratosModal.SelectedValue.ToEntero() > 0 Then GvContratoDetalles.DataBind() UpContratos.Update() Exit Sub @@ -3444,7 +3445,7 @@ Partial Class Ventas LnkActualizarOrdenProduccion.Visible = True DdlOrdenProduccion.DataSource = ObjCGame.DtResultados.FiltraParametros($"CveVenta = {CveVenta} OR CveVenta IS NULL") If ObjCGame.DtResultados.FiltraParametros($"CveVenta = {CveVenta}").Rows.Count > 0 Then - CveOrdenProduccion = ObjCGame.DtResultados.FiltraParametros($"CveVenta = {CveVenta}").Rows(0)("CveOrdenProduccion").ToString + CveOrdenProduccion = ObjCGame.DtResultados.FiltraParametros($"CveVenta = {CveVenta}").Rows(0)("CveOrdenProduccion").ToString() End If End If DdlOrdenProduccion.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -3479,7 +3480,7 @@ Partial Class Ventas If OS.GetOrdenesServicios(CveOS, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then - HdnCveCliente.Value = OS.CveCliente.ToString + HdnCveCliente.Value = OS.CveCliente.ToString() ViewState("CveCliente") = OS.CveCliente CargaCliente(CveCliente) @@ -3487,8 +3488,8 @@ Partial Class Ventas Dim Cons As Integer = 1 For Each dr As DataRow In OS.DtResultados.FiltraParametros("SeFacturara = 1 ").Rows - AgregarProductoServicio(dr("Cantidad").ToString.ToDecimal, dr("CveUM").ToString.ToEntero, dr("UM").ToString, -1, "", dr("CvePS").ToString.ToEntero, "", dr("Obs").ToString, dr("PU").ToString.ToDecimal, 0, -1, "", - dr("CveSubProyecto").ToString.ToEntero, dr("SubProyecto").ToString) + AgregarProductoServicio(dr("Cantidad").ToString().ToDecimal, dr("CveUM").ToString().ToEntero(), dr("UM").ToString(), -1, "", dr("CvePS").ToString().ToEntero(), "", dr("Obs").ToString(), dr("PU").ToString().ToDecimal, 0, -1, "", + dr("CveSubProyecto").ToString().ToEntero(), dr("SubProyecto").ToString()) 'Dim drt As DataRow = TmpDT.NewRow 'drt("Consec") = Cons @@ -3510,7 +3511,7 @@ Partial Class Ventas End If For Each Row As DataRow In DtDetalle.Rows - If OS.GetDetalleMateriales(Row("CveOSDetalle").ToString.ToEntero, CveOS) Then + If OS.GetDetalleMateriales(Row("CveOSDetalle").ToString().ToEntero(), CveOS) Then If OS.DtResultados.FiltraParametros("SeFacturara = 1").Rows.Count > 0 Then Alert("Hay materiales en la Orden de Servicio, ¿Desea facturar los materiales?", TipoMensaje.MsgConfirmacion, "BtnMateriales()") End If @@ -3538,8 +3539,8 @@ Partial Class Ventas Dim Retorno As Boolean = False 'CARGA PARA FACTURACION - Dim CveRemision As Integer = IfNull(ViewState("CveRemision"), 0).ToString.ToEntero - Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString.ToEntero + Dim CveRemision As Integer = IfNull(ViewState("CveRemision"), 0).ToString().ToEntero() + Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() Dim CveVenta As Integer = Me.CveVenta CveVenta = If(CveRemision > 0, CveRemision, CveVenta) CveVenta = If(CveCotizacion > 0, CveCotizacion, CveVenta) @@ -3553,25 +3554,25 @@ Partial Class Ventas If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0) - Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString.ToEntero - HdnCveVenta.Value = CveVenta.ToString + Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString().ToEntero() + HdnCveVenta.Value = CveVenta.ToString() Dim DtUsados As DataTable = Nothing If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then Dim ObjUsados As New ClsVentas - If ObjUsados.GetVentasUsados(CveVenta, DdlSubProyectoDatos.SelectedValue.ToEntero(), DbRowVenta("Fecha").ToString.ToDateTime, UsuarioActual.CveEmpresa) Then + If ObjUsados.GetVentasUsados(CveVenta, DdlSubProyectoDatos.SelectedValue.ToEntero(), DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then DtUsados = ObjUsados.DtResultados End If ObjUsados.Dispose() End If - ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString.ToEntero + ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero() - Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString.ToEntero + Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero() 'CargaEncabezado If Not (CveRemision > 0 Or CveCotizacion > 0) Then - DdlTipoComprobante.SelectedValue = DbRowVenta("TipoDocto").ToString + DdlTipoComprobante.SelectedValue = DbRowVenta("TipoDocto").ToString() If UsuarioActual.TienePermisoProceso(274) Then TrAntEspecial.Visible = DdlTipoComprobante.SelectedValue = "Ant" @@ -3579,15 +3580,15 @@ Partial Class Ventas If TrAntEspecial.Visible Then ChkAntEspecial.Enabled = False - ChkAntEspecial.Checked = If(DbRowVenta("AnticipoEspecial").ToString = "True", True, False) + ChkAntEspecial.Checked = If(DbRowVenta("AnticipoEspecial").ToString() = "True", True, False) End If CargaEstatusFactura(DdlTipoComprobante.SelectedValue) - CveEstatus = DbRowVenta("CveEstatusFactura").ToString.ToEntero - LbEstatus.Text = DbRowVenta("EstatusFactura").ToString - ViewState("SaldoVenta") = DbRowVenta("Saldo").ToString - AplicaCancelarRemision = CBool(DbRowVenta("AplicaCancelarRemision").ToString) + CveEstatus = DbRowVenta("CveEstatusFactura").ToString().ToEntero() + LbEstatus.Text = DbRowVenta("EstatusFactura").ToString() + ViewState("SaldoVenta") = DbRowVenta("Saldo").ToString() + AplicaCancelarRemision = CBool(DbRowVenta("AplicaCancelarRemision").ToString()) If AplicaCancelarRemision AndAlso CveEstatus.Contiene(2, 3) AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then DivCanRem.Visible = True - VentaSaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString.ToDecimal + VentaSaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal If CveEstatus = 5 Then LbCancelarDocumento.Enabled = False 'If CveEstatus = 20 Then @@ -3602,10 +3603,10 @@ Partial Class Ventas End If End If - If DbRowVenta("CveVentaRelacionada").ToString.ToEntero > 0 Then + If DbRowVenta("CveVentaRelacionada").ToString().ToEntero() > 0 Then TrRefacturadaa.Visible = True HplRefacturadaEn.NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", DbRowVenta("CveVentaRelacionada")) - HplRefacturadaEn.Text = DbRowVenta("SerieFolioRelacionada").ToString + HplRefacturadaEn.Text = DbRowVenta("SerieFolioRelacionada").ToString() LblAlertRefacInv.Visible = True End If @@ -3617,7 +3618,7 @@ Partial Class Ventas 'If UsuarioActual.CveEmpresa = 119 And Not UsuarioActual.CveUsuario.Contiene(100, 1703) Then '[IPP] AD y Jesus de JAM ' 'si es del mes anterior no permita cancelar ' If Not DdlTipoComprobante.SelectedValue.Contiene("Rem") Then - ' If DbRowVenta("Fecha").ToString.ToDate <= Now.AddMonths(-1).LastDayOfMonth Then + ' If DbRowVenta("Fecha").ToString().ToDate <= Now.AddMonths(-1).LastDayOfMonth Then ' LbCancelarDocumento.Visible = False ' End If ' End If @@ -3642,7 +3643,7 @@ Partial Class Ventas If DdlTipoComprobante.SelectedValue.Contiene("Egs", "Ing", "Ant", "Dev") AndAlso LblFolioFiscal.Text.Trim = "" Then HplFolioFiscalModal.Visible = True - Select Case DbRowVenta("TipoDocto").ToString + Select Case DbRowVenta("TipoDocto").ToString() Case "Ing" Trsaldo.Visible = True HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) @@ -3665,7 +3666,7 @@ Partial Class Ventas HplDownXML.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", DbRowVenta("SerieFolio"), DbRowVenta("TipoDocto")))) Case "Egs" HplDownXML.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", DbRowVenta("SerieFolio"), DbRowVenta("TipoDocto")))) - HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString + HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString() Trsaldo.Visible = True HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) @@ -3683,15 +3684,15 @@ Partial Class Ventas If UsuarioActual.CveEmpresa = 80 Then LtlImprimir.Text = String.Format("
  • Imprimir
  • ", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=0", CveVenta))) End If - DiasCredito = DbRowVenta("DiasCredito").ToString.ToEntero - EsDiasCreditoFijo = CBool(DbRowVenta("EsDiasCreditoFijo").ToString) + DiasCredito = DbRowVenta("DiasCredito").ToString().ToEntero() + EsDiasCreditoFijo = CBool(DbRowVenta("EsDiasCreditoFijo").ToString()) Case "OP" TdOrdenPago.Visible = True - DdlOrdenPago.SelectedValue = DbRowVenta("Num3").ToString + DdlOrdenPago.SelectedValue = DbRowVenta("Num3").ToString() DdlOrdenPago.Enabled = False Case "Cot" - TxtAtencionA.Text = DbRowVenta("AtencionA").ToString - TxtFechaVencimientoCotizacion.Text = DbRowVenta("Vigencia").ToString + TxtAtencionA.Text = DbRowVenta("AtencionA").ToString() + TxtFechaVencimientoCotizacion.Text = DbRowVenta("Vigencia").ToString() PnlImprimir.Visible = True HLOrdendeCompra.Visible = True HLOrdendeCompra.NavigateUrl = String.Format("/OC/OC.aspx?Tipo=Req&CveCotizacion={0}", CveVenta) @@ -3700,7 +3701,7 @@ Partial Class Ventas If ObjOS.GetCotizacionOS(CveVenta) Then If ObjOS.DtResultados.Rows.Count > 0 Then Dim DbRowOS As DataRow = ObjOS.DtResultados.Rows(0) - ViewState("CveOS") = DbRowOS("CveOS").ToString.ToEntero + ViewState("CveOS") = DbRowOS("CveOS").ToString().ToEntero() CargaOS(CveOS) End If @@ -3712,7 +3713,7 @@ Partial Class Ventas If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 145) Then PnlImprimir.Visible = True : LnkImprimir.OnClientClick = "javascript:ImprimirCotizacion();return false;" 'Deshabilitar impresión cuando no esté supervisada - If DbRowVenta("TipoEstatus").ToString.ToEntero = 2 Or UsuarioActual.Empresa.Funcionalidad(113) = "1" Then + If DbRowVenta("TipoEstatus").ToString().ToEntero() = 2 Or UsuarioActual.Empresa.Funcionalidad(113) = "1" Then PnlImprimir.Visible = True Else HplDownPDF.Visible = False @@ -3727,7 +3728,7 @@ Partial Class Ventas If Objeto.GetVendedores(UsuarioActual.CveEmpresa) Then Dim DTVendedores As New DataTable - DTVendedores = Objeto.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString)).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor)) + DTVendedores = Objeto.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor)) 'Verifico si es su supervisor asignado If DTVendedores.Rows.Count > 0 Then LkCotizacionAutorizar.Visible = True @@ -3737,7 +3738,7 @@ Partial Class Ventas Objeto.Dispose() End If - String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString) + String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString()) Case "Ant" @@ -3750,20 +3751,20 @@ Partial Class Ventas LblNCSaldoAnticipo.Visible = True ChkAplicaNCAnticipo.Visible = True ChkAplicaNCAnticipo.Checked = True - Me.SaldoAnticipo = DbRowVenta("SaldoAnticipo").ToString.ToDecimal + Me.SaldoAnticipo = DbRowVenta("SaldoAnticipo").ToString().ToDecimal If SaldoAnticipo > 0 Then InicializaDTAnticiposAmortizacion() ChkAplicaNCAnticipo.Enabled = False Else ChkAplicaNCAnticipo.Checked = False End If - 'If DbRowVenta("SaldoAnticipo").ToString.ToDouble <= 0 Then ChkAplicaNCAnticipo.Checked = False : ChkAplicaNCAnticipo.Enabled = False - LblNCSaldoAnticipo.Text = String.Format("Saldo Anticipo: $ {0}", DbRowVenta("SaldoAnticipo").ToString.ToDouble.FormatoNumero) + 'If DbRowVenta("SaldoAnticipo").ToString().ToDouble <= 0 Then ChkAplicaNCAnticipo.Checked = False : ChkAplicaNCAnticipo.Enabled = False + LblNCSaldoAnticipo.Text = String.Format("Saldo Anticipo: $ {0}", DbRowVenta("SaldoAnticipo").ToString().ToDouble.FormatoNumero) Case "Dev" DdlTipoComprobante.Items.Insert(0, New ListItem("Devolucion", "Dev")) HplDownXML.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", DbRowVenta("SerieFolio"), DbRowVenta("TipoDocto")))) - HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString - ViewState("CveDevolucion") = DbRowVenta("CveVentaPadre").ToString.ToEntero + HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString() + ViewState("CveDevolucion") = DbRowVenta("CveVentaPadre").ToString().ToEntero() Trsaldo.Visible = True HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) @@ -3776,30 +3777,30 @@ Partial Class Ventas Case "PA" BtnGenerarRemision.Visible = If(CveEstatus = 16, True, False) CvePedidoA = CveVenta - DiasCredito = DbRowVenta("DiasCredito").ToString.ToEntero - EsDiasCreditoFijo = CBool(DbRowVenta("EsDiasCreditoFijo").ToString) + DiasCredito = DbRowVenta("DiasCredito").ToString().ToEntero() + EsDiasCreditoFijo = CBool(DbRowVenta("EsDiasCreditoFijo").ToString()) Case "Pd2" CvePedido2 = CveVenta BtnGeneraAutorizacion.Visible = If(CveEstatus <> 21, True, False) BtnGenerarRemision.Visible = If(CveEstatus <> 21, True, False) End Select - DdlTipoComprobante.SelectedValue = DbRowVenta("TipoDocto").ToString + DdlTipoComprobante.SelectedValue = DbRowVenta("TipoDocto").ToString() End If 'contado 0, credito 1, terminal 2 - If DbRowVenta("CondicionesPago").ToString.ToEntero = 1 Then + If DbRowVenta("CondicionesPago").ToString().ToEntero() = 1 Then RBLPago.SelectedValue = "1" RBLPago_SelectedIndexChanged(Nothing, Nothing) UPCondicionesPago.Update() - ElseIf DbRowVenta("CondicionesPago").ToString.ToEntero = 0 Then + ElseIf DbRowVenta("CondicionesPago").ToString().ToEntero() = 0 Then RBLPago.SelectedValue = "2" RBLPago.Items(0).Enabled = False RBLPago_SelectedIndexChanged(Nothing, Nothing) UPCondicionesPago.Update() Else - DdlCuentasTerminal.SelectedValue = DbRowVenta("CveCuentaTerminal").ToString + DdlCuentasTerminal.SelectedValue = DbRowVenta("CveCuentaTerminal").ToString() RBLPago.SelectedValue = "3" RBLPago.Items(0).Enabled = False RBLPago_SelectedIndexChanged(Nothing, Nothing) @@ -3815,37 +3816,37 @@ Partial Class Ventas UpnTools.Update() DivEstatusFac.Visible = True - HdnCveCliente.Value = CveCliente.ToString + HdnCveCliente.Value = CveCliente.ToString() ViewState("CveCliente") = CveCliente - ViewState("CveEmpresaCRM") = DbRowVenta("CveEmpresaCRM").ToString.ToEntero - ViewState("CveAcercamientoCRM") = DbRowVenta("CveAcercamientoCRM").ToString.ToEntero - Entrega = DbRowVenta("Entrega").ToString - Vigencia = DbRowVenta("Vigencia").ToString.ToDate.ToShortDateString - HplSaldoAuxiliar.Text = DbRowVenta("Saldo").ToString.FormatoNumero(2) + ViewState("CveEmpresaCRM") = DbRowVenta("CveEmpresaCRM").ToString().ToEntero() + ViewState("CveAcercamientoCRM") = DbRowVenta("CveAcercamientoCRM").ToString().ToEntero() + Entrega = DbRowVenta("Entrega").ToString() + Vigencia = DbRowVenta("Vigencia").ToString().ToDate.ToShortDateString + HplSaldoAuxiliar.Text = DbRowVenta("Saldo").ToString().FormatoNumero(2) If Not HplSaldoAuxiliar.Text.ToDouble > 0 Then HplSaldoAuxiliar.Visible = False HplPagado.Visible = True - If ViewState("CveCotizacion") IsNot Nothing AndAlso ViewState("CveCotizacion").ToString.ToEntero > 0 AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then + If ViewState("CveCotizacion") IsNot Nothing AndAlso ViewState("CveCotizacion").ToString().ToEntero() > 0 AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then ImgAntiPend.Visible = True Else ImgAntiPend.Visible = False End If End If - HdnPagado.Value = DbRowVenta("Pagado").ToString - TxtTotal.Text = DbRowVenta("Total").ToString.FormatoNumero(2) - HdnVentaSaldo.Value = (SaldoVenta).ToString - CvePrePoliza = DbRowVenta("CvePrePoliza").ToString.ToEntero - CveVentaFacturada = DbRowVenta("CveVentaFacturada").ToString.ToEntero + HdnPagado.Value = DbRowVenta("Pagado").ToString() + TxtTotal.Text = DbRowVenta("Total").ToString().FormatoNumero(2) + HdnVentaSaldo.Value = (SaldoVenta).ToString() + CvePrePoliza = DbRowVenta("CvePrePoliza").ToString().ToEntero() + CveVentaFacturada = DbRowVenta("CveVentaFacturada").ToString().ToEntero() - CveVentaRelacion = DbRowVenta("CveVentaRelacion").ToString.ToEntero - ImporteRelacion = DbRowVenta("ImporteRelacion").ToString.ToDouble + CveVentaRelacion = DbRowVenta("CveVentaRelacion").ToString().ToEntero() + ImporteRelacion = DbRowVenta("ImporteRelacion").ToString().ToDouble - DdlMoneda.SelectedValue = DbRowVenta("CveMoneda").ToString + DdlMoneda.SelectedValue = DbRowVenta("CveMoneda").ToString() CambiaMoneda() - If DbRowVenta("TipoDocto").ToString = "Pd2" Then + If DbRowVenta("TipoDocto").ToString() = "Pd2" Then 'CANTIDAD FACTURADA If TmpDT.SUM("CantidadFacturadaPed2") > 0 Then GvPS.Columns(7).Visible = True @@ -3859,7 +3860,7 @@ Partial Class Ventas ''ACTIVA EDITAR ''SOLO LA PUEDE EDITAR USUATIOACTUAL-VENDEDOR | NO DEBE ESTAR FACTURADA - 'If (UsuarioActual.CveUsuario = DbRowVenta("CveUsuario").ToString.ToEntero Or UsuarioActual.CveVendedor = DdlVendedor.SelectedValue.ToEntero) And TmpDT.SUM("CantidadFacturadaCot") = 0 Then 'And TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") + 'If (UsuarioActual.CveUsuario = DbRowVenta("CveUsuario").ToString().ToEntero() Or UsuarioActual.CveVendedor = DdlVendedor.SelectedValue.ToEntero()) And TmpDT.SUM("CantidadFacturadaCot") = 0 Then 'And TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") ' BtnPermisoEditarCotizacion.Visible = True 'End If @@ -3878,35 +3879,35 @@ Partial Class Ventas CargaCliente(CveCliente, -1) 'Estatus activo, se requiere para cargar una factura en la que el cliente a sido eliminado End If - ViewState("CveAlmacenTransitorio") = DbRowVenta("CveAlmacenTraspasoDestino").ToString.ToEntero - DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString.ToEntero + ViewState("CveAlmacenTransitorio") = DbRowVenta("CveAlmacenTraspasoDestino").ToString().ToEntero() + DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero() 'sino esta cargada la información del metodo de pago que le corresponde, la recarga para que se le pueda asignar - If DdlMetodoPago33.SelectedValue <> DbRowVenta("CveMetodoPago33").ToString Then - CargaFormaPago(DbRowVenta("CveMetodoPago33").ToString.ToEntero) + If DdlMetodoPago33.SelectedValue <> DbRowVenta("CveMetodoPago33").ToString() Then + CargaFormaPago(DbRowVenta("CveMetodoPago33").ToString().ToEntero()) End If - DdlMetodoPago33.SelectedValueExist(DbRowVenta("CveMetodoPago33").ToString) - DdlFormaPago33.SelectedValueExist(DbRowVenta("CveFormaPago33").ToString.ToEntero) + DdlMetodoPago33.SelectedValueExist(DbRowVenta("CveMetodoPago33").ToString()) + DdlFormaPago33.SelectedValueExist(DbRowVenta("CveFormaPago33").ToString().ToEntero()) - If DdlFormaPago33.SelectedValue <> DbRowVenta("CveFormaPago33").ToString And DbRowVenta("CveFormaPago33").ToString <> "" Then + If DdlFormaPago33.SelectedValue <> DbRowVenta("CveFormaPago33").ToString() And DbRowVenta("CveFormaPago33").ToString() <> "" Then 'sino está seleccionada la asginada la debe de cargar Dim Nombre As String = GlobalDTVtaFormaPago().FiltroPrimeroValor("FormaPagoSAT", String.Format("CveFormaPago={0}", DbRowVenta("CveFormaPago33"))) - DdlFormaPago33.Items.Add(New ListItem(Nombre, DbRowVenta("CveFormaPago33").ToString)) - DdlFormaPago33.SelectedValueExist(DbRowVenta("CveFormaPago33").ToString.ToEntero) + DdlFormaPago33.Items.Add(New ListItem(Nombre, DbRowVenta("CveFormaPago33").ToString())) + DdlFormaPago33.SelectedValueExist(DbRowVenta("CveFormaPago33").ToString().ToEntero()) End If - DdlUsoCFDI.SelectedValueExist(DbRowVenta("CveUsoCFDI").ToString) + DdlUsoCFDI.SelectedValueExist(DbRowVenta("CveUsoCFDI").ToString()) If UsuarioActual.CveEmpresa = 126 Then CargaOrdenProduccion(2, CveVenta) - If DbRowVenta("CveTipoRelacion").ToString.ToEntero > 0 Then + If DbRowVenta("CveTipoRelacion").ToString().ToEntero() > 0 Then TrTipoRelacion.Visible = True - DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion").ToString.ToEntero) - HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString + DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion").ToString().ToEntero()) + HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString() End If - If DbRowVenta("Saldo").ToString.ToDouble < 0.01 Then - If ViewState("CveCotizacion") IsNot Nothing AndAlso ViewState("CveCotizacion").ToString.ToEntero > 0 AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then + If DbRowVenta("Saldo").ToString().ToDouble < 0.01 Then + If ViewState("CveCotizacion") IsNot Nothing AndAlso ViewState("CveCotizacion").ToString().ToEntero() > 0 AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then ImgAntiPend.Visible = True Else ImgAntiPend.Visible = False @@ -3919,21 +3920,21 @@ Partial Class Ventas LiComplementoPago.Visible = True - ViewState("FolioFiscal") = DbRowVenta("FolioFiscal").ToString - LblSerie.Text = DbRowVenta("Serie").ToString - ViewState("Serie") = DbRowVenta("Serie").ToString - ViewState("Folio") = DbRowVenta("Folio").ToString.ToEntero - TxtFolio.Text = DbRowVenta("Folio").ToString - 'TxtDocto.Text = DbRowVenta("Ref").ToString - 'TxtNumCtaPago.Text = DbRowVenta("NumeroCuenta").ToString - LblFolioFiscal.Text = DbRowVenta("FolioFiscal").ToString - TxtFecha.Text = DbRowVenta("Fecha").ToString - TxtSubTotal.Text = DbRowVenta("SubTotal").ToString.FormatoNumero(2) - LblDescuentos.Text = DbRowVenta("Descuento").ToString.FormatoNumero(2) - LblAmortizacion.Text = DbRowVenta("Amortizacion").ToString.FormatoNumero(2) + ViewState("FolioFiscal") = DbRowVenta("FolioFiscal").ToString() + LblSerie.Text = DbRowVenta("Serie").ToString() + ViewState("Serie") = DbRowVenta("Serie").ToString() + ViewState("Folio") = DbRowVenta("Folio").ToString().ToEntero() + TxtFolio.Text = DbRowVenta("Folio").ToString() + 'TxtDocto.Text = DbRowVenta("Ref").ToString() + 'TxtNumCtaPago.Text = DbRowVenta("NumeroCuenta").ToString() + LblFolioFiscal.Text = DbRowVenta("FolioFiscal").ToString() + TxtFecha.Text = DbRowVenta("Fecha").ToString() + TxtSubTotal.Text = DbRowVenta("SubTotal").ToString().FormatoNumero(2) + LblDescuentos.Text = DbRowVenta("Descuento").ToString().FormatoNumero(2) + LblAmortizacion.Text = DbRowVenta("Amortizacion").ToString().FormatoNumero(2) TxtSubTotal2.Text = (TxtSubTotal.Text.Replace(",", "").Trim.Trim.ToDouble - LblDescuentos.Text.Replace(",", "").Trim.Trim.ToDouble - LblAmortizacion.Text.Replace(",", "").Trim.Trim.ToDouble).FormatoNumero(2) - TxtIVA.Text = DbRowVenta("IVA").ToString.FormatoNumero(2) - TxtRetIVA.Text = DbRowVenta("RetIVA").ToString.FormatoNumero(2) + TxtIVA.Text = DbRowVenta("IVA").ToString().FormatoNumero(2) + TxtRetIVA.Text = DbRowVenta("RetIVA").ToString().FormatoNumero(2) If TxtRetIVA.Text.ToDecimal() > 0 Then TrRetIVA.Style.Add("display", "") UsuarioActual.Empresa.MostrarRetIVA = True @@ -3946,53 +3947,53 @@ Partial Class Ventas End If End If - TxtRetISR.Text = DbRowVenta("RetISR").ToString.FormatoNumero(2) - TxtIEPS.Text = DbRowVenta("IEPS").ToString.FormatoNumero(2) + TxtRetISR.Text = DbRowVenta("RetISR").ToString().FormatoNumero(2) + TxtIEPS.Text = DbRowVenta("IEPS").ToString().FormatoNumero(2) TrIEPS.Visible = TxtIEPS.Text.ToDouble > 0 - TxtTotal.Text = DbRowVenta("Total").ToString.FormatoNumero(2) - HdnTotalVenta.Value = DbRowVenta("Total").ToString.FormatoNumero(2) - TxtMotivoDescuento.Text = DbRowVenta("MotivoDescuento").ToString - TxtObsFact.Text = DbRowVenta("Observaciones").ToString - LblUsuario.Text = DbRowVenta("Nombre").ToString - LblFechaRegistro.Text = DbRowVenta("FechaIng").ToString.ToDate.ToShortDateString - LblSeTimbro.Text = DbRowVenta("SeTimbro").ToString - LblMail.Text = DbRowVenta("EnvioMail").ToString - TxtFechaPago.Text = DbRowVenta("FechaVencimiento").ToString + TxtTotal.Text = DbRowVenta("Total").ToString().FormatoNumero(2) + HdnTotalVenta.Value = DbRowVenta("Total").ToString().FormatoNumero(2) + TxtMotivoDescuento.Text = DbRowVenta("MotivoDescuento").ToString() + TxtObsFact.Text = DbRowVenta("Observaciones").ToString() + LblUsuario.Text = DbRowVenta("Nombre").ToString() + LblFechaRegistro.Text = DbRowVenta("FechaIng").ToString().ToDate.ToShortDateString + LblSeTimbro.Text = DbRowVenta("SeTimbro").ToString() + LblMail.Text = DbRowVenta("EnvioMail").ToString() + TxtFechaPago.Text = DbRowVenta("FechaVencimiento").ToString() TxtFechaVencimientoCotizacion.Text = Vigencia - TxtDet_OrdenCompra.Text = DbRowVenta("Det_OrdenCompra").ToString - TxtDet_FechaOrdenCompra.Text = DbRowVenta("Det_FechaOrdenCompra").ToString + TxtDet_OrdenCompra.Text = DbRowVenta("Det_OrdenCompra").ToString() + TxtDet_FechaOrdenCompra.Text = DbRowVenta("Det_FechaOrdenCompra").ToString() HdnIVAOriginal.Value = TxtIVA.Text - TxtPedidoContrato.Text = DbRowVenta("PedidoContrato").ToString + TxtPedidoContrato.Text = DbRowVenta("PedidoContrato").ToString() TxtPedidoContrato.Enabled = False - TxtKilometraje.Text = DbRowVenta("Kilometraje").ToString + TxtKilometraje.Text = DbRowVenta("Kilometraje").ToString() - HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString + HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString() HdnSubTotalDescuestos.Value = (TxtSubTotal.Text.Replace(",", "").ToDouble - LblDescuentos.Text.Replace(",", "").ToDouble - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble - TxtRetISR.Text.Replace(",", "").ToDouble).FormatoNumero(2) - 'DdlAmortizacionConceptos.SelectedValue = DbRowVenta("AnticipoPosicion").ToString - 'ChkAnticipoEnSubTotal.Checked = DbRowVenta("AnticipoEnSubTotal").ToString = "True" + 'DdlAmortizacionConceptos.SelectedValue = DbRowVenta("AnticipoPosicion").ToString() + 'ChkAnticipoEnSubTotal.Checked = DbRowVenta("AnticipoEnSubTotal").ToString() = "True" DdlTipoAmortizacionAnticipo.SelectedValueExist(DbRowVenta("CveTipoAmortizacionAnticipo")) DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion")) - 'HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString + 'HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString() 'HdnSubTotalDescuestos.Value = (TxtSubTotal.Text.Replace(",", "").ToDouble - LblDescuentos.Text.Replace(",", "").ToDouble - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble - TxtRetISR.Text.Replace(",", "").ToDouble).FormatoNumero(2) - 'DdlAmortizacionConceptos.SelectedValue = DbRowVenta("AnticipoPosicion").ToString - 'ChkAnticipoEnSubTotal.Checked = DbRowVenta("AnticipoEnSubTotal").ToString = "True" + 'DdlAmortizacionConceptos.SelectedValue = DbRowVenta("AnticipoPosicion").ToString() + 'ChkAnticipoEnSubTotal.Checked = DbRowVenta("AnticipoEnSubTotal").ToString() = "True" - If DbRowVenta("CveTipoRelacion").ToString.ToEntero > 0 Then + If DbRowVenta("CveTipoRelacion").ToString().ToEntero() > 0 Then TrTipoRelacion2.Visible = True - LblTipoRelacion.Text = DbRowVenta("TipoRelacion").ToString - HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString + LblTipoRelacion.Text = DbRowVenta("TipoRelacion").ToString() + HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString() End If - TxtOrdenCompra.Text = DbRowVenta("OrdenCompra").ToString + TxtOrdenCompra.Text = DbRowVenta("OrdenCompra").ToString() TxtOrdenCompra.Enabled = False - TxtObsAlmacen.Text = DbRowVenta("ObservacionesAlmacen").ToString - CvePAC = DbRowVenta("CvePAC").ToString.ToEntero + TxtObsAlmacen.Text = DbRowVenta("ObservacionesAlmacen").ToString() + CvePAC = DbRowVenta("CvePAC").ToString().ToEntero() - If DbRowVenta("Saldo").ToString.ToDecimal > 0 AndAlso UsuarioActual.TienePermisoProceso(204) AndAlso Not UsuarioActual.CveEmpresa.Contiene(119) Then + If DbRowVenta("Saldo").ToString().ToDecimal > 0 AndAlso UsuarioActual.TienePermisoProceso(204) AndAlso Not UsuarioActual.CveEmpresa.Contiene(119) Then TxtFechaSaldarVenta.Text = TxtFecha.Text CEFechaSaldarVenta.StartDate = TxtFecha.Text.ToDate HLSaldarVenta.Visible = True @@ -4004,9 +4005,9 @@ Partial Class Ventas End If 'Envio Direccion - If DbRowVenta("CveDireccionEnvio").ToString.ToEntero > 0 AndAlso DbRowVenta("CveDireccionEnvio").ToString IsNot Nothing Then + If DbRowVenta("CveDireccionEnvio").ToString().ToEntero() > 0 AndAlso DbRowVenta("CveDireccionEnvio").ToString() IsNot Nothing Then ChkDireccionEnvio.Checked = True - DdlDireccionEnvio.SelectedValueExist(DbRowVenta("CveDireccionEnvio").ToString.ToEntero) + DdlDireccionEnvio.SelectedValueExist(DbRowVenta("CveDireccionEnvio").ToString().ToEntero()) DdlDireccionEnvio.Enabled = False ChkDireccionEnvio.Enabled = False DdlDireccionEnvio.Visible = True @@ -4015,24 +4016,24 @@ Partial Class Ventas 'ESTATUS FACTURA If Not (CveRemision > 0 Or CveCotizacion > 0) Then - CveEstatus = DbRowVenta("CveEstatusFactura").ToString.ToEntero + CveEstatus = DbRowVenta("CveEstatusFactura").ToString().ToEntero() End If - TxtTipoCambio.Text = DbRowVenta("TipoCambio").ToString - If DbRowVenta("UltimasFluctuaciones").ToString <> "" Then - LblTCValuacion.Text = String.Format("Ult. Val:{0}", DbRowVenta("UltimasFluctuaciones").ToString) + TxtTipoCambio.Text = DbRowVenta("TipoCambio").ToString() + If DbRowVenta("UltimasFluctuaciones").ToString() <> "" Then + LblTCValuacion.Text = String.Format("Ult. Val:{0}", DbRowVenta("UltimasFluctuaciones").ToString()) LblTCValuacion.Visible = True End If - ViewState("SelloCancelacion") = DbRowVenta("SelloCancelacion").ToString - ViewState("FechaCancelacion") = DbRowVenta("FechaCancelacion").ToString.ToDateTime - TxtAtencionA.Text = DbRowVenta("AtencionA").ToString - TxtTelefonoGenerico.Text = DbRowVenta("TelefonoGenerico").ToString - CveVentaPadre = DbRowVenta("CveVentaPadre").ToString.ToEntero - SerieFolioPadre = DbRowVenta("SerieFolioPadre").ToString + ViewState("SelloCancelacion") = DbRowVenta("SelloCancelacion").ToString() + ViewState("FechaCancelacion") = DbRowVenta("FechaCancelacion").ToString().ToDateTime + TxtAtencionA.Text = DbRowVenta("AtencionA").ToString() + TxtTelefonoGenerico.Text = DbRowVenta("TelefonoGenerico").ToString() + CveVentaPadre = DbRowVenta("CveVentaPadre").ToString().ToEntero() + SerieFolioPadre = DbRowVenta("SerieFolioPadre").ToString() - If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then + If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False End If @@ -4048,40 +4049,40 @@ Partial Class Ventas End If - TxtFechaEjecucion.Text = DbRowVenta("FechaEjecucion").ToString.ToDateTime.ToString("dd/MM/yyyy") - 'DdlSucursalEjecucion.SelectedValueExist(DbRowVenta("CveSucursalEjecucion").ToString) - 'DdlSucursalCobranza.SelectedValueExist(DbRowVenta("CveSucursalCobranza").ToString) - DdlSucursalCliente.SelectedValueExist(DbRowVenta("CveClienteSucursal").ToString) - 'DdlSucursal.SelectedValueExist(DbRowVenta("CveSucursal").ToString) - 'DdlSubProyectoDatos.SelectedValueExist(DbRowVenta("CveSubProyecto").ToString) + TxtFechaEjecucion.Text = DbRowVenta("FechaEjecucion").ToString().ToDateTime.ToString("dd/MM/yyyy") + 'DdlSucursalEjecucion.SelectedValueExist(DbRowVenta("CveSucursalEjecucion").ToString()) + 'DdlSucursalCobranza.SelectedValueExist(DbRowVenta("CveSucursalCobranza").ToString()) + DdlSucursalCliente.SelectedValueExist(DbRowVenta("CveClienteSucursal").ToString()) + 'DdlSucursal.SelectedValueExist(DbRowVenta("CveSucursal").ToString()) + 'DdlSubProyectoDatos.SelectedValueExist(DbRowVenta("CveSubProyecto").ToString()) If DdlSubProyectoDatos.Items.Count = 0 Then DdlSubProyectoDatos.Items.Insert(0, New ListItem("Seleccione", "-1")) End If - DdlSubProyectoDatos.SelectedValueExistInsert(DbRowVenta("CveSubProyecto").ToString, DbRowVenta("SubProyecto").ToString) + DdlSubProyectoDatos.SelectedValueExistInsert(DbRowVenta("CveSubProyecto").ToString(), DbRowVenta("SubProyecto").ToString()) CargarAlmacenes() If DdlSubProyectoCobranza.Items.Count = 0 Then DdlSubProyectoCobranza.Items.Insert(0, New ListItem("Seleccione", "-1")) End If - DdlSubProyectoCobranza.SelectedValueExistInsert(DbRowVenta("CveSubProyectoCobranza").ToString, GlobalDTSubProyectos(-1, DbRowVenta("CveSubProyectoCobranza").ToString.ToEntero).FiltroPrimeroValor("SubProyecto").ToString) + DdlSubProyectoCobranza.SelectedValueExistInsert(DbRowVenta("CveSubProyectoCobranza").ToString(), GlobalDTSubProyectos(-1, DbRowVenta("CveSubProyectoCobranza").ToString().ToEntero()).FiltroPrimeroValor("SubProyecto").ToString()) If DdlSubProyectoEjecucion.Items.Count = 0 Then DdlSubProyectoEjecucion.Items.Insert(0, New ListItem("Seleccione", "-1")) End If - DdlSubProyectoEjecucion.SelectedValueExistInsert(DbRowVenta("CveSubProyectoEjecucion").ToString, GlobalDTSubProyectos(-1, DbRowVenta("CveSubProyectoEjecucion").ToString.ToEntero).FiltroPrimeroValor("SubProyecto").ToString) + DdlSubProyectoEjecucion.SelectedValueExistInsert(DbRowVenta("CveSubProyectoEjecucion").ToString(), GlobalDTSubProyectos(-1, DbRowVenta("CveSubProyectoEjecucion").ToString().ToEntero()).FiltroPrimeroValor("SubProyecto").ToString()) - CargaClienteSucursal(DbRowVenta("CveClienteSucursal").ToString.ToEntero) + CargaClienteSucursal(DbRowVenta("CveClienteSucursal").ToString().ToEntero()) - If DbRowVenta("CveContrato").ToString.ToEntero > 0 Then - CveContrato = DbRowVenta("CveContrato").ToString.ToEntero - NumeroContrato = DbRowVenta("NumeroContrato").ToString - DescripcionContrato = DbRowVenta("DescripcionContrato").ToString + If DbRowVenta("CveContrato").ToString().ToEntero() > 0 Then + CveContrato = DbRowVenta("CveContrato").ToString().ToEntero() + NumeroContrato = DbRowVenta("NumeroContrato").ToString() + DescripcionContrato = DbRowVenta("DescripcionContrato").ToString() DdlContrato.Visible = False HLContrato.Text = $"{DbRowVenta("NumeroContrato")} - {DbRowVenta("DescripcionContrato")}" HLContrato.NavigateUrl = $"/Contratos/Contrato.aspx?CveContrato={CveContrato}" 'trPresupuesto.Visible = True - 'HplPresupuesto.NavigateUrl = String.Format(" / Presupuestos / Presupuesto.aspx?CvePresupuesto={0}", DbRowVenta("CveContrato").ToString) + 'HplPresupuesto.NavigateUrl = String.Format(" / Presupuestos / Presupuesto.aspx?CvePresupuesto={0}", DbRowVenta("CveContrato").ToString()) Else NumeroContrato = "" DescripcionContrato = "" @@ -4089,34 +4090,34 @@ Partial Class Ventas 'DdlEstatus.Items.Remove(DdlEstatus.Items.FindByText("Cotización")) - If DbRowVenta("SeTimbro").ToString <> "No" Then + If DbRowVenta("SeTimbro").ToString() <> "No" Then HplDownXML.Visible = True 'If HLImprimir.Visible = False Then HplDownPDF.Visible = True 'End If ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" OrElse DdlTipoComprobante.SelectedValue = "Cot" Then - 'If drv("TipoEstatus").ToString.ToEntero = 2 AndAlso drv("TipoDocto").ToString = "Cot" Then + 'If drv("TipoEstatus").ToString().ToEntero() = 2 AndAlso drv("TipoDocto").ToString() = "Cot" Then ' ImgDownPDF.Visible = True 'Else HplDownPDF.Visible = False 'End If - ElseIf UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso DbRowVenta("SeTimbro").ToString = "No" AndAlso DbRowVenta("CveEstatusFactura").ToString = "2" AndAlso DbRowVenta("TipoDocto").ToString.Contiene("Ing", "Egs", "Dev", "Ant") Then + ElseIf UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso DbRowVenta("SeTimbro").ToString() = "No" AndAlso DbRowVenta("CveEstatusFactura").ToString() = "2" AndAlso DbRowVenta("TipoDocto").ToString().Contiene("Ing", "Egs", "Dev", "Ant") Then TrEmitir.Visible = True If TxtFecha.Text.ToDate < Now.AddDays(-3) Then TxtFecha.Enabled = True End If End If - If DbRowVenta("SeTimbro").ToString = "Si" Then + If DbRowVenta("SeTimbro").ToString() = "Si" Then TrEmitir.Visible = False End If 'CargaAcuseCancelacion - If DbRowVenta("CveEstatusFactura").ToString = "5" Then + If DbRowVenta("CveEstatusFactura").ToString() = "5" Then ImgDownCancelacion.Visible = True ImgDownCancelacion.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CAN&CVEVTA={0}", CveVenta))) End If - IdPoliza = DbRowVenta("IdPoliza").ToString.ToEntero + IdPoliza = DbRowVenta("IdPoliza").ToString().ToEntero() 'Carga si es Contabilizada If IdPoliza > 0 Then @@ -4135,14 +4136,14 @@ Partial Class Ventas End If End If - If DbRowVenta("IdPolizaCancelacion").ToString.ToEntero > 0 Then + If DbRowVenta("IdPolizaCancelacion").ToString().ToEntero() > 0 Then HPLContaCancelacion.Text = "Cancelación" HPLContaCancelacion.NavigateUrl = String.Format("/Contabilidad/RegPoliza.aspx?IdPoliza={0}", DbRowVenta("IdPolizaCancelacion")) trContabilizada.Visible = True End If - If UsuarioActual.Empresa.UsaOS AndAlso DbRowVenta("CveOS").ToString.ToEntero = 0 Then + If UsuarioActual.Empresa.UsaOS AndAlso DbRowVenta("CveOS").ToString().ToEntero() = 0 Then BtnGenerarOS.Visible = True BtnGenerarOS.OnClientClick = String.Format("javascriptwindow.location.href = '/OS/OrdenesServicios.aspx?CveVenta={0}'; return false;", CveVenta) ' BtnGenerarOS.OnClientClick = String.Format("/OS/OrdenesServicios.aspx?CveVenta={0}", CveVenta) @@ -4150,7 +4151,7 @@ Partial Class Ventas '[IPP] COMENTADO 12/MARZO/2018 -SABRA QUE SE QUERIA ESCONDER - 'If DbRowVenta("TipoDocto").ToString = "Rem" Then + 'If DbRowVenta("TipoDocto").ToString() = "Rem" Then ' GvPS.Columns(11).Visible = False ' GvPS.Columns(12).Visible = False 'End If @@ -4184,7 +4185,7 @@ Partial Class Ventas End If End If - DdlVendedor.SelectedValue = DbRowVenta("CveVendedor").ToString + DdlVendedor.SelectedValue = DbRowVenta("CveVendedor").ToString() DdlTipoComprobante.Enabled = False 'TxtDocto.Enabled = False @@ -4304,8 +4305,8 @@ Partial Class Ventas GvNC.DataBind() InicializaDTVentasNC() For Each Dr As DataRow In ObjVentas.DtResultados.Rows - If Dr("CveConceptoContable").ToString.ToEntero = 91 Then - CargaNCDT(Dr("CveVenta").ToString.ToEntero, Dr("Importe").ToString.ToDecimal, Dr("FolioFiscal").ToString, TC:=Dr("TipoCambio").ToString.ToDecimal) + If Dr("CveConceptoContable").ToString().ToEntero() = 91 Then + CargaNCDT(Dr("CveVenta").ToString().ToEntero(), Dr("Importe").ToString().ToDecimal, Dr("FolioFiscal").ToString(), TC:=Dr("TipoCambio").ToString().ToDecimal) End If Next End If @@ -4342,7 +4343,7 @@ Partial Class Ventas tdVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot") tdFechaVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot") - If DbRowVenta("TipoDocto").ToString = "Rem" Then + If DbRowVenta("TipoDocto").ToString() = "Rem" Then 'CANTIDAD FACTURADA If TmpDT.SUM("CantidadFacturadaRem") > 0 Then GvPS.Columns(6).Visible = True @@ -4365,7 +4366,7 @@ Partial Class Ventas BtnsFacturar.Visible = True 'ACTIVA CONVERSION DE MONEDA - If DdlMoneda.SelectedValue.ToEntero = 1 Then + If DdlMoneda.SelectedValue.ToEntero() = 1 Then TrConversionDolares.Visible = True ChkConvertirDolares.Enabled = True TxtTipoCambioDlls.Enabled = True @@ -4379,7 +4380,7 @@ Partial Class Ventas 'Si es Empresa de Acumuladores If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Si ya se surtió y recibió - If (DbRowVenta("SaldoAlmacen").ToString.ToDecimal > 0 And (DtUsados Is Nothing Or DtUsados.Rows.Count = 0)) OrElse (TmpDT.MAX("CveTipoPS") = "1") Then + If (DbRowVenta("SaldoAlmacen").ToString().ToDecimal > 0 And (DtUsados Is Nothing Or DtUsados.Rows.Count = 0)) OrElse (TmpDT.MAX("CveTipoPS") = "1") Then BtnsFacturar.Visible = True Else BtnsFacturar.Visible = False @@ -4388,7 +4389,7 @@ Partial Class Ventas End If - If DbRowVenta("TipoDocto").ToString.Contiene("Cot", "Pd2") Then + If DbRowVenta("TipoDocto").ToString().Contiene("Cot", "Pd2") Then 'CANTIDAD FACTURADA If TmpDT.SUM("CantidadFacturadaCot") > 0 Then GvPS.Columns(7).Visible = True @@ -4402,7 +4403,7 @@ Partial Class Ventas 'ACTIVA EDITAR 'SOLO LA PUEDE EDITAR USUATIOACTUAL-VENDEDOR | NO DEBE ESTAR FACTURADA - If (UsuarioActual.CveUsuario = DbRowVenta("CveUsuario").ToString.ToEntero Or UsuarioActual.CveVendedor = DdlVendedor.SelectedValue.ToEntero) And TmpDT.SUM("CantidadFacturadaCot") = 0 Then 'And TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") + If (UsuarioActual.CveUsuario = DbRowVenta("CveUsuario").ToString().ToEntero() Or UsuarioActual.CveVendedor = DdlVendedor.SelectedValue.ToEntero()) And TmpDT.SUM("CantidadFacturadaCot") = 0 Then 'And TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") BtnPermisoEditarCotizacion.Visible = True End If @@ -4437,7 +4438,7 @@ Partial Class Ventas End If End If - DdlTipoRetencion.SelectedValueExist(DbRowVenta("CveTipoRetencion").ToString) + DdlTipoRetencion.SelectedValueExist(DbRowVenta("CveTipoRetencion").ToString()) CargaPS(-1, DdlPS) @@ -4472,37 +4473,37 @@ Partial Class Ventas Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) 'CargaCliente - Dim CveCliente As Integer = drv("CveCliente").ToString.ToEntero + Dim CveCliente As Integer = drv("CveCliente").ToString().ToEntero() - HdnCveCliente.Value = CveCliente.ToString + HdnCveCliente.Value = CveCliente.ToString() ViewState("CveCliente") = CveCliente CargaCliente(CveCliente) 'Carga Detalle Sucursal - TxtFechaEjecucion.Text = drv("FechaEjecucion").ToString.ToDateTime.ToString("dd/MM/yyyy") - TxtFechaPago.Text = drv("FechaVencimiento").ToString.ToDateTime.ToString("dd/MM/yyyy") - 'DdlSucursalEjecucion.SelectedValueExist(drv("CveSucursalEjecucion").ToString) - 'DdlSucursalCobranza.SelectedValueExist(drv("CveSucursalCobranza").ToString) - DdlSucursalCliente.SelectedValueExist(drv("CveClienteSucursal").ToString) - 'DdlSucursal.SelectedValueExist(drv("CveSucursal").ToString) - DdlSubProyectoDatos.SelectedValueExist(drv("CveSubProyecto").ToString) - DdlSubProyectoEjecucion.SelectedValueExist(drv("CveSubProyectoEjecucion").ToString) - DdlSubProyectoCobranza.SelectedValueExist(drv("CveSubProyectoCobranza").ToString) + TxtFechaEjecucion.Text = drv("FechaEjecucion").ToString().ToDateTime.ToString("dd/MM/yyyy") + TxtFechaPago.Text = drv("FechaVencimiento").ToString().ToDateTime.ToString("dd/MM/yyyy") + 'DdlSucursalEjecucion.SelectedValueExist(drv("CveSucursalEjecucion").ToString()) + 'DdlSucursalCobranza.SelectedValueExist(drv("CveSucursalCobranza").ToString()) + DdlSucursalCliente.SelectedValueExist(drv("CveClienteSucursal").ToString()) + 'DdlSucursal.SelectedValueExist(drv("CveSucursal").ToString()) + DdlSubProyectoDatos.SelectedValueExist(drv("CveSubProyecto").ToString()) + DdlSubProyectoEjecucion.SelectedValueExist(drv("CveSubProyectoEjecucion").ToString()) + DdlSubProyectoCobranza.SelectedValueExist(drv("CveSubProyectoCobranza").ToString()) If CveDevolucion > 0 Then CambiaSucursalGeneral() End If - CargaClienteSucursal(drv("CveClienteSucursal").ToString.ToEntero) + CargaClienteSucursal(drv("CveClienteSucursal").ToString().ToEntero()) 'CargaDetalle If ObjVentas.GetVentaDetalle(CveVenta) Then For Each dr As DataRow In ObjVentas.DtResultados.Rows - AgregarProductoServicio(dr("Cantidad").ToString.ToDecimal, dr("CveUM").ToString.ToEntero, dr("UM").ToString, dr("CveClasificacion").ToString.ToEntero, dr("Clasificacion").ToString, - dr("CvePS").ToString.ToEntero, dr("PS").ToString, dr("Obs").ToString, dr("PU").ToString.ToDecimal, dr("Descuento").ToString.ToDecimal, - dr("CveProyecto").ToString.ToEntero, dr("Proyecto").ToString, dr("CveSubProyecto").ToString.ToEntero, dr("SubProyecto").ToString, - CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString.ToEntero, RegeneraIEPS:=False, SeActualiza:=True) + AgregarProductoServicio(dr("Cantidad").ToString().ToDecimal, dr("CveUM").ToString().ToEntero(), dr("UM").ToString(), dr("CveClasificacion").ToString().ToEntero(), dr("Clasificacion").ToString(), + dr("CvePS").ToString().ToEntero(), dr("PS").ToString(), dr("Obs").ToString(), dr("PU").ToString().ToDecimal, dr("Descuento").ToString().ToDecimal, + dr("CveProyecto").ToString().ToEntero(), dr("Proyecto").ToString(), dr("CveSubProyecto").ToString().ToEntero(), dr("SubProyecto").ToString(), + CveContratoDetalle:=dr("CveContratoDetalle").ToString().ToEntero(), CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(), RegeneraIEPS:=False, SeActualiza:=True) Next @@ -4529,48 +4530,48 @@ Partial Class Ventas End If 'Carga Totales - ViewState("TipoDoctoDevolucion") = drv("TipoDocto").ToString - TxtSubTotal.Text = drv("SubTotal").ToString.FormatoNumero(2) - LblDescuentos.Text = drv("Descuento").ToString.FormatoNumero(2) - LblAmortizacion.Text = drv("Amortizacion").ToString.FormatoNumero(2) + ViewState("TipoDoctoDevolucion") = drv("TipoDocto").ToString() + TxtSubTotal.Text = drv("SubTotal").ToString().FormatoNumero(2) + LblDescuentos.Text = drv("Descuento").ToString().FormatoNumero(2) + LblAmortizacion.Text = drv("Amortizacion").ToString().FormatoNumero(2) TxtSubTotal2.Text = (TxtSubTotal.Text.Replace(",", "").Trim.Trim.ToDouble - LblDescuentos.Text.Replace(",", "").Trim.Trim.ToDouble - LblAmortizacion.Text.Replace(",", "").Trim.Trim.ToDouble).FormatoNumero(2) - TxtIVA.Text = drv("IVA").ToString.FormatoNumero(2) - TxtRetIVA.Text = drv("RetIVA").ToString.FormatoNumero(2) + TxtIVA.Text = drv("IVA").ToString().FormatoNumero(2) + TxtRetIVA.Text = drv("RetIVA").ToString().FormatoNumero(2) If TxtRetIVA.Text.ToDecimal() > 0 Then TrRetIVA.Style.Add("display", "") UsuarioActual.Empresa.MostrarRetIVA = True End If - TxtRetISR.Text = drv("RetISR").ToString.FormatoNumero(2) - TxtTotal.Text = drv("Total").ToString.FormatoNumero(2) - TotalOriginal = Math.Round(drv("Total").ToString.ToDouble, 2) - HdnVentaSaldo.Value = drv("Total").ToString - TxtMotivoDescuento.Text = drv("MotivoDescuento").ToString - TxtObsFact.Text = drv("Observaciones").ToString - DdlMoneda.SelectedValue = drv("CveMoneda").ToString + TxtRetISR.Text = drv("RetISR").ToString().FormatoNumero(2) + TxtTotal.Text = drv("Total").ToString().FormatoNumero(2) + TotalOriginal = Math.Round(drv("Total").ToString().ToDouble, 2) + HdnVentaSaldo.Value = drv("Total").ToString() + TxtMotivoDescuento.Text = drv("MotivoDescuento").ToString() + TxtObsFact.Text = drv("Observaciones").ToString() + DdlMoneda.SelectedValue = drv("CveMoneda").ToString() CambiaMoneda() - TxtTipoCambio.Text = drv("TipoCambio").ToString - DdlVendedor.SelectedValue = drv("CveVendedor").ToString - CvePAC = drv("CvePAC").ToString.ToEntero + TxtTipoCambio.Text = drv("TipoCambio").ToString() + DdlVendedor.SelectedValue = drv("CveVendedor").ToString() + CvePAC = drv("CvePAC").ToString().ToEntero() - DdlUsoCFDI.SelectedValueExist(drv("CveUsoCFDI").ToString) - DdlMetodoPago33.SelectedValueExist(drv("CveMetodoPago33").ToString) - CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero) - DdlFormaPago33.SelectedValueExist(drv("CveFormaPago33").ToString) + DdlUsoCFDI.SelectedValueExist(drv("CveUsoCFDI").ToString()) + DdlMetodoPago33.SelectedValueExist(drv("CveMetodoPago33").ToString()) + CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) + DdlFormaPago33.SelectedValueExist(drv("CveFormaPago33").ToString()) - DdlTipoComprobante.SelectedValueExist(drv("TipoDocto").ToString) + DdlTipoComprobante.SelectedValueExist(drv("TipoDocto").ToString()) DdlTipoComprobante.Enabled = False HdnIVAOriginal.Value = TxtIVA.Text - HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString + HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString() HdnSubTotalDescuestos.Value = (TxtSubTotal.Text.Replace(",", "").ToDouble - LblDescuentos.Text.Replace(",", "").ToDouble - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble - TxtRetISR.Text.Replace(",", "").ToDouble).FormatoNumero(2) 'JJMQ 20160506: Se agrego para la validacion de pago de contado. 'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") - If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then + If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False End If - CveContrato = drv("CveContrato").ToString.ToEntero + CveContrato = drv("CveContrato").ToString().ToEntero() TabAlmacen.Enabled = False TabDetalleVentas.Enabled = False TabComplementos.Enabled = False @@ -4581,7 +4582,7 @@ Partial Class Ventas UpContado.Update() If CveDevolucion > 0 Then - HdnFolioFiscalNC.Value = drv("FolioFiscal").ToString + HdnFolioFiscalNC.Value = drv("FolioFiscal").ToString() 'CALCULA IMPUESTOS LOCALES CON LOS DATOS DEL CLIENTE AL MOMENTO DE LA NUEVA FACTURA NO LA VIEJA 'CalculaTotalesImpuestosLocales() 'CalculaTotales(CBool(ViewState("RetIVAFletes"))) @@ -4603,7 +4604,7 @@ Partial Class Ventas ' Dim ObjVenta As New ClsVentas If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then If ObjVentas.DtResultados.Rows.Count > 0 Then - TxtFechaPago.Text = ObjVentas.DtResultados(0)("FechaVencimiento").ToString.ToDate.ToShortDateString + TxtFechaPago.Text = ObjVentas.DtResultados(0)("FechaVencimiento").ToString().ToDate.ToShortDateString End If End If 'ObjVenta.Dispose() @@ -4633,7 +4634,7 @@ Partial Class Ventas DdlMetodoPago33.DataBind() DdlMetodoPago33.SelectedValue = "3" - CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero) + CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) 'End If @@ -4705,9 +4706,9 @@ Partial Class Ventas 'Dim dr As DataRow = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero($"CveSubProyecto = {If(DdlSubProyectoDatos.SelectedValue = "", "-1", DdlSubProyectoDatos.SelectedValue)}") 'si hay un proyecto relacionado con el subproyecto - If dr IsNot Nothing AndAlso dr("CveSubProyecto").ToString.ToEntero > 0 Then + If dr IsNot Nothing AndAlso dr("CveSubProyecto").ToString().ToEntero() > 0 Then DdlProyecto.SelectedValueExist(dr("CveProyecto")) - Retorno = dr("CveSubProyecto").ToString.ToEntero + Retorno = dr("CveSubProyecto").ToString().ToEntero() End If Return Retorno @@ -4720,14 +4721,14 @@ Partial Class Ventas Else Dim DTAlmacen As DataTable ddlAlmacen.Items.Clear() - DTAlmacen = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero}") + DTAlmacen = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}") ddlAlmacen.DataSource = DTAlmacen If DTAlmacen Is Nothing Or DTAlmacen.Rows.Count = 0 Then ddlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) ddlAlmacen.SelectedValue = "-1" End If ddlAlmacen.DataBind() - If GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero}").Rows.Count > 0 Then + If GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}").Rows.Count > 0 Then ddlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) End If End If @@ -4735,19 +4736,19 @@ Partial Class Ventas 'SI TIENE CONTRATO NO SE MUEVE If Not CveContrato > 0 Then DdlAlmacenAsignado.Items.Clear() - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero} AND CveTipoAlmacen IN (4,10)") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} AND CveTipoAlmacen IN (4,10)") DdlAlmacenAsignado.Items.Insert(0, New ListItem(" Seleccione ", "-1")) DdlAlmacenAsignado.SelectedValue = "-1" DdlAlmacenAsignado.DataBind() - DdlAlmacenAsignado.SelectedValueExist(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero}").ToString.ToEntero) + DdlAlmacenAsignado.SelectedValueExist(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}").ToString().ToEntero()) End If If CveContrato > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero}") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}") DdlAlmacenAsignado.Items.Insert(0, New ListItem(" Seleccione ", "-1")) DdlAlmacenAsignado.SelectedValue = "-1" DdlAlmacenAsignado.DataBind() - DdlAlmacenAsignado.SelectedValueExist(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString.ToEntero) + DdlAlmacenAsignado.SelectedValueExist(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()) End If UpINV.Update() @@ -4755,7 +4756,7 @@ Partial Class Ventas Private Sub CargaSubProyecto(Optional CveSubProyecto As Integer = -1) DdlSubProyecto.Items.Clear() DdlSubProyecto.SelectedValue = Nothing - If DdlProyecto.SelectedValue.ToEntero > 0 Then + If DdlProyecto.SelectedValue.ToEntero() > 0 Then DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) 'DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"}) End If @@ -4782,9 +4783,9 @@ Partial Class Ventas UpCliente.Visible = True UpEmpresaCRM.Visible = False Else - LblEmpresaCRM.Text = ObjCRM.DtResultados.Rows(0)("Empresa").ToString - LblRFCCRM.Text = ObjCRM.DtResultados.Rows(0)("RFC").ToString - LblMedioCaptacionCRM.Text = ObjCRM.DtResultados.Rows(0)("MedioCaptacion").ToString + LblEmpresaCRM.Text = ObjCRM.DtResultados.Rows(0)("Empresa").ToString() + LblRFCCRM.Text = ObjCRM.DtResultados.Rows(0)("RFC").ToString() + LblMedioCaptacionCRM.Text = ObjCRM.DtResultados.Rows(0)("MedioCaptacion").ToString() ChkEnviarFactura.Checked = False ChkEnviarFactura.Visible = False LblEnviarMail.Visible = False @@ -4794,7 +4795,7 @@ Partial Class Ventas UpEmpresaCRM.Visible = True End If - DdlVendedor.SelectedValueExist(ObjCRM.DtResultados.Rows(0)("CveVendedorAsignado").ToString) + DdlVendedor.SelectedValueExist(ObjCRM.DtResultados.Rows(0)("CveVendedorAsignado").ToString()) DdlVendedor.Enabled = False LbAgregar.Enabled = True End If @@ -4812,7 +4813,7 @@ Partial Class Ventas If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, Estatus, TipoCliente:=-1) Then If ObjCliente.DtResultados.Rows.Count > 0 Then TxtCodigo.Text = ObjCliente.Codigo - DdlFormaEntrega.SelectedValueExist(ObjCliente.DtResultados(0)("CveCondicionEntrega").ToString) + DdlFormaEntrega.SelectedValueExist(ObjCliente.DtResultados(0)("CveCondicionEntrega").ToString()) LblCliente.Text = String.Format("{1}", CveCliente, ObjCliente.Nombre) ViewState("NombreCliente") = ObjCliente.Nombre LtlCliente.Text = ObjCliente.Nombre @@ -4822,7 +4823,7 @@ Partial Class Ventas LnkAgregarCliente.Visible = False - ClienteEsDistribuidor = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("EsDistribuidor").ToString) + ClienteEsDistribuidor = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("EsDistribuidor").ToString()) If EstatusCliente = False And Not DdlTipoComprobante.SelectedValue.Contiene("Cot", "DPe") And (CveVenta <= 0 Or EsCreaApartirDe) Then Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia) @@ -4848,8 +4849,8 @@ Partial Class Ventas LblCP.Text = ObjCliente.CP LblRFC.Text = ObjCliente.RFC LblTelefono.Text = ObjCliente.Telefono - LblRetIVA.Text = ObjCliente.RetIVA.ToString.FormatoNumero(5) - LblRetISR.Text = ObjCliente.RetISR.ToString.FormatoNumero(5) + LblRetIVA.Text = ObjCliente.RetIVA.ToString().FormatoNumero(5) + LblRetISR.Text = ObjCliente.RetISR.ToString().FormatoNumero(5) If UsuarioActual.Empresa.MostrarRetISR AndAlso ObjCliente.RetISR > 0 Then ' TrRetISR.Style.Add("display", "none") TrRetISR.Visible = True @@ -4860,7 +4861,7 @@ Partial Class Ventas ViewState("ClienteRetISR") = ObjCliente.RetISR / 100 If CveVenta <= 0 Then - DdlTipoRetencion.SelectedValueExist(ObjCliente.DtResultados(0)("CveTipoRetencion").ToString) + DdlTipoRetencion.SelectedValueExist(ObjCliente.DtResultados(0)("CveTipoRetencion").ToString()) DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty) ViewState("RetIVAFletes") = ObjCliente.RetieneIVAFletes @@ -5025,17 +5026,17 @@ Partial Class Ventas 'SELECIONAMOS VENDEDOR - SI ESTA EN MODO EDICIÓN SE QUEDA EL VENDEDOR ORIGINAL If Not ModalidadEdicion Then - If ObjCliente.DtResultados(0)("CveVendedor").ToString.ToEntero > 0 Then - DdlVendedor.SelectedValueExist(ObjCliente.DtResultados(0)("CveVendedor").ToString.ToEntero) + If ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero() > 0 Then + DdlVendedor.SelectedValueExist(ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero()) End If 'SI EL CLIENTE NO TIENE VENDEDOR SELECCIONAMOS EL DEL USUARIO - If Not DdlVendedor.SelectedValue.ToEntero > 0 Then - DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString) + If Not DdlVendedor.SelectedValue.ToEntero() > 0 Then + DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) End If End If - If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then + If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False End If @@ -5210,10 +5211,10 @@ Partial Class Ventas 'RegistraScript("$('#DivDocsCliente').modal({ backdrop: 'static', keyboard: false });", "ModalArchivos") Dim Count = 0 For Each GvRow As GridViewRow In GvDocumentosCliente.Rows - If GvRow.DataKey("Orden").ToEntero = 1 Then + If GvRow.DataKey("Orden").ToEntero() = 1 Then IndexDocumentoCliente = Count - Documentacion = GvRow.DataKey("Documentacion").ToString - AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString + Documentacion = GvRow.DataKey("Documentacion").ToString() + AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString() Exit For End If Count = +1 @@ -5246,7 +5247,7 @@ Partial Class Ventas DdlTipoComprobante.SelectedValue = "PA" TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString 'si llegó por la opción de cotización no debe de restringuir - If IfNull(Request("Op"), "").ToString = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" + If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) @@ -5258,7 +5259,7 @@ Partial Class Ventas RBLPago.SelectedValue = "1" RBLPago_SelectedIndexChanged(Nothing, Nothing) UPCondicionesPago.Update() - Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero) + Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) If CreditoDispo > 0 Then TrCreditoDisponible.Visible = True @@ -5283,7 +5284,7 @@ Partial Class Ventas DdlTipoComprobante.SelectedValue = "PA" TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString 'si llegó por la opción de cotización no debe de restringuir - If IfNull(Request("Op"), "").ToString = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" + If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" 'quito remisión y factura DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) @@ -5338,7 +5339,7 @@ Partial Class Ventas DdlTipoComprobante.SelectedValue = "PA" TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString 'si llegó por la opción de cotización no debe de restringuir - If IfNull(Request("Op"), "").ToString = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" + If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) @@ -5350,18 +5351,18 @@ Partial Class Ventas End If End If UPPCreditoDisponible.Update() - ElseIf UsuarioActual.CveEmpresa.Contiene(119, 1) AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString.ToEntero > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then - Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero) + ElseIf UsuarioActual.CveEmpresa.Contiene(119, 1) AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then + Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) If CreditoDispo > 0 Then Dim Vta As New ClsVentas Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

    {0}", Vta.SerieVenta) Vta.Dispose() If Opcion > 0 Then - If ModalidadEdicion AndAlso ViewState("CveCliente").ToString.ToEntero <> ViewState("CveClienteAnterior").ToString.ToEntero And DdlTipoComprobante.SelectedValue = "Rem" And ViewState("CveClienteAnterior").ToString.ToEntero > 0 And LblRFC.Text.Trim <> "XAXX010101000" Then - ViewState("CveCliente") = ViewState("CveClienteAnterior").ToString.ToEntero + If ModalidadEdicion AndAlso ViewState("CveCliente").ToString().ToEntero() <> ViewState("CveClienteAnterior").ToString().ToEntero() And DdlTipoComprobante.SelectedValue = "Rem" And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000" Then + ViewState("CveCliente") = ViewState("CveClienteAnterior").ToString().ToEntero() - CargaCliente(ViewState("CveCliente").ToString.ToEntero) + CargaCliente(ViewState("CveCliente").ToString().ToEntero()) If Opcion > 0 Then If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) Else @@ -5390,7 +5391,7 @@ Partial Class Ventas BtnGenerarOS.Visible = False BtnEmitirImprimir.Visible = False BtnsFacturar.Visible = False - If ViewState("CveCliente").ToString.ToEntero <> ViewState("CveClienteAnterior").ToString.ToEntero Then + If ViewState("CveCliente").ToString().ToEntero() <> ViewState("CveClienteAnterior").ToString().ToEntero() Then If Opcion > 0 Then If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) Else @@ -5420,31 +5421,31 @@ 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 = ObjCliente.DtResultados.Rows(0)("Correo").ToString() If Correo.Trim.Length > 0 Then ViewState("Mail") = Correo End If - LblDireccion.Text = ObjCliente.DtResultados.Rows(0)("Direccion").ToString - LblColonia.Text = ObjCliente.DtResultados.Rows(0)("Colonia").ToString - LblCiudad.Text = ObjCliente.DtResultados.Rows(0)("Ciudad").ToString - LblEstado.Text = ObjCliente.DtResultados.Rows(0)("Estado").ToString - 'TxtNumCtaPago.Text = ObjCliente.DtResultados.Rows(0)("NumCtaPago").ToString - LblTelefono.Text = ObjCliente.DtResultados.Rows(0)("Telefono").ToString - LblCP.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString - ViewState("CliLocalidad") = ObjCliente.DtResultados.Rows(0)("Localidad").ToString - ViewState("CliPais") = ObjCliente.DtResultados.Rows(0)("Pais").ToString - ViewState("CliNoExt") = ObjCliente.DtResultados.Rows(0)("NoExt").ToString - ViewState("CliNoInt") = ObjCliente.DtResultados.Rows(0)("NoInt").ToString - DdlVendedor.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveVendedor").ToString) - ViewState("CveClienteSucursal") = ObjCliente.DtResultados(0)("CveClienteSucursal").ToString - ViewState("CliCorreoCot") = ObjCliente.DtResultados.Rows(0)("CorreoCotizacion").ToString + LblDireccion.Text = ObjCliente.DtResultados.Rows(0)("Direccion").ToString() + LblColonia.Text = ObjCliente.DtResultados.Rows(0)("Colonia").ToString() + LblCiudad.Text = ObjCliente.DtResultados.Rows(0)("Ciudad").ToString() + LblEstado.Text = ObjCliente.DtResultados.Rows(0)("Estado").ToString() + 'TxtNumCtaPago.Text = ObjCliente.DtResultados.Rows(0)("NumCtaPago").ToString() + LblTelefono.Text = ObjCliente.DtResultados.Rows(0)("Telefono").ToString() + LblCP.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString() + ViewState("CliLocalidad") = ObjCliente.DtResultados.Rows(0)("Localidad").ToString() + ViewState("CliPais") = ObjCliente.DtResultados.Rows(0)("Pais").ToString() + ViewState("CliNoExt") = ObjCliente.DtResultados.Rows(0)("NoExt").ToString() + ViewState("CliNoInt") = ObjCliente.DtResultados.Rows(0)("NoInt").ToString() + DdlVendedor.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveVendedor").ToString()) + ViewState("CveClienteSucursal") = ObjCliente.DtResultados(0)("CveClienteSucursal").ToString() + ViewState("CliCorreoCot") = ObjCliente.DtResultados.Rows(0)("CorreoCotizacion").ToString() - If ObjCliente.DtResultados.Rows(0)("Estatus").ToString <> "Activo" Then + If ObjCliente.DtResultados.Rows(0)("Estatus").ToString() <> "Activo" Then RBLPago.Items(0).Enabled = False Alert("La Sucursal/Departamento del cliente se encuentra inactivo", TipoMensaje.MsgAdvertencia) Else RBLPago.Items(0).Enabled = True - Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero, ObjVentas) + Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero(), ObjVentas) TrCreditoDisponible.Visible = True LblCreditoDisponible.Text = CreditoDispo.FormatoNumero @@ -5453,16 +5454,16 @@ Partial Class Ventas End If If CveVenta <= 0 Then - CveMetodoPagoCliente = ObjCliente.DtResultados.Rows(0)("CveMetodoPago").ToString.ToEntero + CveMetodoPagoCliente = ObjCliente.DtResultados.Rows(0)("CveMetodoPago").ToString().ToEntero() - DdlMetodoPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago33").ToString) + DdlMetodoPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago33").ToString()) DdlMetodoPago33_SelectedIndexChanged(DdlMetodoPago33, EventArgs.Empty) - DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString) - DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString) + DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString()) + DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString()) End If - If CveVenta < 0 Then TxtAtencionA.Text = ObjCliente.DtResultados.Rows(0)("Contacto").ToString + If CveVenta < 0 Then TxtAtencionA.Text = ObjCliente.DtResultados.Rows(0)("Contacto").ToString() End If Else Alert("No se pudieron cargar los datos de la sucursal", TipoMensaje.MsgAdvertencia) @@ -5477,7 +5478,7 @@ Partial Class Ventas LblEstado.Text = ObjCliente.Estado LblCP.Text = ObjCliente.CP LblTelefono.Text = ObjCliente.Telefono - DdlVendedor.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveVendedor").ToString) + DdlVendedor.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveVendedor").ToString()) ViewState("CliNoExt") = ObjCliente.NoExt ViewState("CliNoInt") = ObjCliente.NoInt PlazoCobranza = ObjCliente.PlazoCobranza @@ -5497,8 +5498,8 @@ Partial Class Ventas End If 'SI LA SUCURSAL DEL CLIENTE NO TIENE VENDEDOR SELECCIONAMOS EL DEL USUARIO - If Not DdlVendedor.SelectedValue.ToEntero > 0 Then - DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString) + If Not DdlVendedor.SelectedValue.ToEntero() > 0 Then + DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) End If 'SI LA VENTA YA ESTA REGISTRADA NO DEBE HABILITAR ACCIONES @@ -5526,11 +5527,11 @@ Partial Class Ventas If ObjVentasAplciar.DtResultados.Rows.Count > 0 Then If tCveSucursalCliente > 0 Then - Retorno = ObjVentasAplciar.DtResultados(0)("LimiteRestanteSucursal").ToString.ToDecimal - PorcentajeCredito = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoSucursal").ToString.ToDecimal + Retorno = ObjVentasAplciar.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal + PorcentajeCredito = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoSucursal").ToString().ToDecimal Else - Retorno = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString.ToDecimal - PorcentajeCredito = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString.ToDecimal + Retorno = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal + PorcentajeCredito = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal End If End If End If @@ -5569,9 +5570,9 @@ Partial Class Ventas End Sub Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost) - Objeto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(141).ToString = "1") + Objeto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1") - If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then + If Not UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1" Then Objeto.ddl.Items.Clear() 'Objeto.ddl.DataSource = GlobalDTProductosServicios(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, AplicaParaVenta:=1, Estatus:=1) Objeto.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, Estatus:=1, AplicaParaVenta:=1) @@ -5589,7 +5590,7 @@ Partial Class Ventas End If Objeto.Attributes.Add("data-cvesubproyecto", cvesubproyecto) - Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString) + Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString()) Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas") Objeto.ddlWS.Attributes.Add("data-Estatus", "1") End If @@ -5609,12 +5610,12 @@ Partial Class Ventas DTFacNC = ObjClientes.DtResultados Dim drvv As DataRow = DTFacNC.FiltroPrimero("") DTFacNC.Columns.Add("Factura", GetType(String), " Folio + ' - ' + Fecha + ' $' + Total") - HdnFolioFiscalNC.Value = drvv("FolioFiscal").ToString + HdnFolioFiscalNC.Value = drvv("FolioFiscal").ToString() If DTFacNC IsNot Nothing AndAlso DTFacNC.Rows.Count > 0 Then Me.CveEstatusRefacturacion = DTFacNC.Rows(0)("CveEstatusRefacturacion").ToString().ToEntero() - Me.DevolucionAlmacenNC = DTFacNC.Rows(0)("EsDevolucionVenta").ToString.ToEntero - Me.VentaSaldoAlmacenNC = DTFacNC.Rows(0)("SaldoAlmacen").ToString.ToDecimal + Me.DevolucionAlmacenNC = DTFacNC.Rows(0)("EsDevolucionVenta").ToString().ToEntero() + Me.VentaSaldoAlmacenNC = DTFacNC.Rows(0)("SaldoAlmacen").ToString().ToDecimal HdnRFCVenta.Value = DTFacNC.Rows(0)("ClienteRFC").ToString() End If Else @@ -5624,7 +5625,7 @@ Partial Class Ventas ObjClientes.Dispose() Me.ObjFacturaNC = Nothing - Me.ObjFacturaNC = New Modelos.Factura(UsuarioActual, pCveVenta, UsuarioActual.CveEmpresa, DirectorioServidor:=Server.MapPath("/"), EsCancelacion:=False) + Me.ObjFacturaNC = New Modelos.Factura(UsuarioActual, pCveVenta, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, EsCancelacion:=False) DdlNCFactura.DataSource = DTFacNC DdlNCFactura.DataBind() @@ -5679,7 +5680,7 @@ Partial Class Ventas #Region "GvPS" Protected Sub GvPS_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvPS.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.Attributes("id") = e.Row.RowIndex.ToString + e.Row.Attributes("id") = e.Row.RowIndex.ToString() If e.Row.RowIndex = 0 Then End If @@ -5687,14 +5688,14 @@ Partial Class Ventas If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then 'MODO EDICION - e.Row.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DBCampo("CvePS").ToEntero, -1, UsuarioActual.CveEmpresa) + e.Row.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DBCampo("CvePS").ToEntero(), -1, UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlUnidadMedida").DataBind() e.Row.FCDropDownList("DdlUnidadMedida").SelectedValueExist(e.Row.DBCampo("CveUM")) e.Row.FCDropDownList("DdlClasificacion").DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=1) e.Row.FCDropDownList("DdlClasificacion").DataBind() e.Row.FCDropDownList("DdlClasificacion").SelectedValue = e.Row.DBCampo("CveClasificacion") - CargaPS(e.Row.FCDropDownList("DdlClasificacion").SelectedValue.ToEntero, e.Row.FCDropDownLost("DdlPS")) + CargaPS(e.Row.FCDropDownList("DdlClasificacion").SelectedValue.ToEntero(), e.Row.FCDropDownLost("DdlPS")) e.Row.FCDropDownLost("DdlPS").SelectedText = e.Row.DBCampo("PS") e.Row.FCDropDownLost("DdlPS").SelectedValue = e.Row.DBCampo("CvePS") @@ -5705,20 +5706,20 @@ Partial Class Ventas e.Row.FCDropDownList("DdlProyecto").DataBind() e.Row.FCDropDownList("DdlProyecto").Items.Insert(0, New ListItem("Sin Proyecto Asignado", "-1")) - e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1, 1) + e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1, 1) 'e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa & " AND CveProyecto = '" & DdlProyecto.SelectedValue & "'") e.Row.FCDropDownList("DdlSubProyecto").DataBind() 'e.Row.FCDropDownList("DdlSubProyectoEdit").SelectedValue = e.Row.DBCampo("CveSubProyecto") e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem("Sin SubProyecto Asignado", "-1")) Else - Dim dr As DataRow = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, e.Row.DBCampo("CveSubProyecto").ToEntero, 1).FiltroPrimero("") + Dim dr As DataRow = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, e.Row.DBCampo("CveSubProyecto").ToEntero(), 1).FiltroPrimero("") If dr IsNot Nothing Then e.Row.FCDropDownList("DdlProyecto").DataSource = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1) e.Row.FCDropDownList("DdlProyecto").DataBind() - e.Row.FCDropDownList("DdlProyecto").SelectedValue = dr("CveProyecto").ToString + e.Row.FCDropDownList("DdlProyecto").SelectedValue = dr("CveProyecto").ToString() - e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, dr("CveProyecto").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, 1) + e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, dr("CveProyecto").ToString().ToEntero(), UsuarioActual.CveEmpresa, -1, 1) e.Row.FCDropDownList("DdlSubProyecto").DataBind() e.Row.FCDropDownList("DdlSubProyecto").SelectedValue = e.Row.DBCampo("CveSubProyecto") @@ -5787,7 +5788,7 @@ Partial Class Ventas End If 'CUANDO SE QUIERE FACTURAR UNA REMISIÓN NO PERMITE EDITAR SU PRECIO - If DtRemisionesPS IsNot Nothing AndAlso DtRemisionesPS.Rows.Count > 0 AndAlso (e.Row.DBCampo("CveVentaDetalle").ToEntero > 0 Or e.Row.DBCampo("CveVentaDetalleRemision").ToEntero > 0) Then + If DtRemisionesPS IsNot Nothing AndAlso DtRemisionesPS.Rows.Count > 0 AndAlso (e.Row.DBCampo("CveVentaDetalle").ToEntero() > 0 Or e.Row.DBCampo("CveVentaDetalleRemision").ToEntero() > 0) Then e.Row.FCTextBox("TxtPrecio").Enabled = False End If @@ -5892,7 +5893,7 @@ Partial Class Ventas e.Row.FCLiteral("LtCantidadFacturada").Text = e.Row.DBCampo("CantidadFacturadaPed2").ToDecimal.ToString("#,##0.##") End Select - 'If GvInv.Rows.Count > 0 AndAlso ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem" AndAlso e.Row.DataKey("CveVentaDetalle").ToString.ToEntero > 0 Then + 'If GvInv.Rows.Count > 0 AndAlso ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem" AndAlso e.Row.DataKey("CveVentaDetalle").ToString().ToEntero() > 0 Then ' e.Row.FCLinkButton("imgE").Enabled = False ' e.Row.FCLinkButton("imgE").ToolTip = "No se puede editar debido a que ya hay un movimiento de almacen." 'End If @@ -5932,19 +5933,19 @@ Partial Class Ventas End If If UsuarioActual.CveEmpresa = 140 Then - ObjDescuento = CalcularDescuentos(TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero, Cantidad, PU) + ObjDescuento = CalcularDescuentos(TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero(), Cantidad, PU) End If Dim CantidadOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Cantidad").ToDecimal() Dim DatarowPS As DataRow = Nothing - DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero).FiltroPrimero("") ' Estado = -1 + DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1 'verifica si tiene ventaminima - If Cantidad > 0 AndAlso DatarowPS("VentaMinima").ToString.ToDecimal > 0 AndAlso (DdlTipoComprobante.SelectedValue = "Rem" Or DdlTipoComprobante.SelectedValue = "Ing") Then + If Cantidad > 0 AndAlso DatarowPS("VentaMinima").ToString().ToDecimal > 0 AndAlso (DdlTipoComprobante.SelectedValue = "Rem" Or DdlTipoComprobante.SelectedValue = "Ing") Then 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... - If Cantidad Mod DatarowPS("VentaMinima").ToString.ToDecimal <> 0 Then - Alert(String.Format("El producto se vende solo en cantidades de {0}", DatarowPS("VentaMinima").ToString)) + If Cantidad Mod DatarowPS("VentaMinima").ToString().ToDecimal <> 0 Then + Alert(String.Format("El producto se vende solo en cantidades de {0}", DatarowPS("VentaMinima").ToString())) Exit Sub End If End If @@ -5953,11 +5954,11 @@ Partial Class Ventas 'si es remisión, ingreso, anticipo debe de considerar el preciominimo If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR - Dim CvePS As Integer = DatarowPS("CvePS").ToString.ToEntero - Dim CveUM As Integer = DatarowPS("CveUM").ToString.ToEntero - Dim CveTipoPS As Integer = DatarowPS("CveTipoPS").ToString.ToEntero + Dim CvePS As Integer = DatarowPS("CvePS").ToString().ToEntero() + Dim CveUM As Integer = DatarowPS("CveUM").ToString().ToEntero() + Dim CveTipoPS As Integer = DatarowPS("CveTipoPS").ToString().ToEntero() - CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToString.ToDecimal + CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToString().ToDecimal Dim ValidaExistencia As Boolean = True If (CantidadInventario > 0) OrElse (Cantidad <= CantidadOriginal) Then 'si ya hay algo surtido, que no valide existencia @@ -5969,10 +5970,10 @@ Partial Class Ventas Dim ObjInventarios As New ClsInventarios Dim Existencia As Decimal If ValidaExistencia Then - Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) + Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) End If - Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero, CveTipoAlmacen:=1) + Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, 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 Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1) @@ -5983,7 +5984,7 @@ Partial Class Ventas If UsuarioActual.CveEmpresa = 119 Then 'Dim CvePrecioLista As Integer = 38 Dim objPS As New ClsProductosServicios - If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) Then + If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero()) Then PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal 'If PrecioMinimo > 0 Then ' Costo = PrecioMinimo @@ -6013,7 +6014,7 @@ Partial Class Ventas Dim CostoMayor = 0.0D 'PRECIO MINIMO - If UsuarioActual.Empresa.Funcionalidad(129).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then + If UsuarioActual.Empresa.Funcionalidad(129).ToEntero() > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then '' NOTA. si tiene preciominimo, debe de validarlos e ignorar el costo, pero se debe de considerar el TC, para el costo If PrecioMinimo > 0 Then 'SI EL PRECIO ES MAYOR AL COSTO, SI PASA @@ -6023,7 +6024,7 @@ Partial Class Ventas Else CostoMenor = Costo + ((UsuarioActual.Empresa.Funcionalidad(129).ToDecimal / 100) * Costo) 'SI EL PRECIO ES MAYOR AL COSTO, SI PASA - If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= CostoMenor Then + If PU * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal) >= CostoMenor Then EsValido = True End If End If @@ -6032,10 +6033,10 @@ Partial Class Ventas End If 'PRECIO MAXIMO - If UsuarioActual.Empresa.Funcionalidad(133).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then + If UsuarioActual.Empresa.Funcionalidad(133).ToEntero() > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then CostoMayor = Costo + ((UsuarioActual.Empresa.Funcionalidad(133).ToDecimal / 100) * Costo) 'SI EL PRECIO ES MAYOR AL COSTO MAXIMO, SI PASA - If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) <= CostoMayor Then + If PU * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal) <= CostoMayor Then EsValidoMayor = True End If Else @@ -6046,7 +6047,7 @@ Partial Class Ventas ''SIRVE PARA VALIDAR PRECIOS DEBAJO DEL PRECIO MINIMO PERMITIDO 'If Not EsValido Then ' If DtPromociones.FiltraParametros($"CvePS = {CvePS}").Rows.Count > 0 Then - ' If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal Then + ' If PU * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal) >= DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal Then ' EsValido = True ' End If ' End If @@ -6056,15 +6057,15 @@ Partial Class Ventas Dim MensajeCosto As New StringBuilder Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) If Not EsValido Then - MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio menor de su Costo
    ", DatarowPS("PS").ToString) + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio menor de su Costo
    ", DatarowPS("PS").ToString()) If TienePermisoImportes Then MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
    ", Costo) - MensajeCosto.AppendFormat("El rango menor aceptado es: {0:#,###.00}% ${1}
    ", UsuarioActual.Empresa.Funcionalidad(129).ToEntero, CostoMenor) + MensajeCosto.AppendFormat("El rango menor aceptado es: {0:#,###.00}% ${1}
    ", UsuarioActual.Empresa.Funcionalidad(129).ToEntero(), CostoMenor) MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
    ", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) End If - Alert(String.Format(MensajeCosto.ToString), TipoMensaje.MsgAdvertencia) + Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) e.Cancel = True Exit Sub End If @@ -6074,10 +6075,10 @@ Partial Class Ventas MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
    ", HdnPS.Value) If TienePermisoImportes Then MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
    ", Costo) - MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
    ", UsuarioActual.Empresa.Funcionalidad(133).ToEntero, CostoMayor) + MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
    ", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
    ", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) End If - Alert(MensajeCosto.ToString, TipoMensaje.MsgAdvertencia) + Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) e.Cancel = True Exit Sub End If @@ -6088,24 +6089,24 @@ Partial Class Ventas - If TmpDT.Rows(e.RowIndex)("CvePS").ToString <> GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue Then + If TmpDT.Rows(e.RowIndex)("CvePS").ToString() <> GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue Then 'eliminar y cargar el ps *** Dim DdlUM As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida") Dim DdlCla As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlClasificacion") TmpDT.Rows.Remove(TmpDT.Rows(e.RowIndex)) CalculaUsados() - AgregarProductoServicio(Cantidad, DdlUM.SelectedValue.ToEntero, DdlUM.SelectedItem.Text, DdlCla.SelectedValue.ToEntero, DdlCla.SelectedItem.Text, - GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero, GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedText, + AgregarProductoServicio(Cantidad, DdlUM.SelectedValue.ToEntero(), DdlUM.SelectedItem.Text, DdlCla.SelectedValue.ToEntero(), DdlCla.SelectedItem.Text, + GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedText, GvPS.Rows(e.RowIndex).FCTextBox("TxtObsPS").Text.Trim, PU, ObjDescuento.ImporteDescuento, - GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedValue.ToEntero, GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedItem.Text, - GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedItem.Text, - CuentaPredial:=CuentaPredial, CveVentaDetalle:=GvPS.Rows(e.RowIndex).DataKey("CveVentaDetalle").ToString.ToEntero, SeActualiza:=True, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle) + GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedItem.Text, + GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedItem.Text, + CuentaPredial:=CuentaPredial, CveVentaDetalle:=GvPS.Rows(e.RowIndex).DataKey("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle) ' TmpDT.Rows(e.RowIndex)("CveUM") = Ddl.SelectedValue ' TmpDT.Rows(e.RowIndex)("UM") = Ddl.SelectedItem.Text - If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 Then + If UsuarioActual.Empresa.Funcionalidad(533).ToEntero() > 0 Then GvPS.EditIndex = -1 GvPS.DataSource = TmpDT @@ -6119,18 +6120,18 @@ Partial Class Ventas If Not ClienteDesglosaIEPS Then Dim DrPS As DataRow = Nothing - 'DrPS = GlobalDTProductosServicios(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero, Estatus:=-1).FiltroPrimero("") + 'DrPS = GlobalDTProductosServicios(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero(), Estatus:=-1).FiltroPrimero("") - DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero).FiltroPrimero("") + DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") - PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal) + 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) + TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + TmpDT.Rows(e.RowIndex)("PorcentajeIEPS").ToString().ToDecimal) Dim ClienteRetIVA = Me.ClienteRetIVA If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then @@ -6150,7 +6151,7 @@ Partial Class Ventas End If - TmpDT.Rows(e.RowIndex)("CveUM") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero + TmpDT.Rows(e.RowIndex)("CveUM") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero() TmpDT.Rows(e.RowIndex)("UM") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedItem.Text TmpDT.Rows(e.RowIndex)("Cantidad") = Cantidad TmpDT.Rows(e.RowIndex)("Obs") = GvPS.Rows(e.RowIndex).FCTextBox("TxtObsPS").Text.Trim @@ -6158,8 +6159,8 @@ Partial Class Ventas TmpDT.Rows(e.RowIndex)("PU") = PU TmpDT.Rows(e.RowIndex)("Descuento") = ObjDescuento.ImporteDescuento TmpDT.Rows(e.RowIndex)("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales) - TmpDT.Rows(e.RowIndex)("ImporteIVA") = (TmpDT.Rows(e.RowIndex)("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) - TmpDT.Rows(e.RowIndex)("ImporteIEPS") = (TmpDT.Rows(e.RowIndex)("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + TmpDT.Rows(e.RowIndex)("ImporteIVA") = (TmpDT.Rows(e.RowIndex)("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) + TmpDT.Rows(e.RowIndex)("ImporteIEPS") = (TmpDT.Rows(e.RowIndex)("PorcentajeIEPS").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) TmpDT.Rows(e.RowIndex)("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) TmpDT.Rows(e.RowIndex)("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) TmpDT.Rows(e.RowIndex)("PorcentajeRetIVA") = ClienteRetIVA @@ -6237,7 +6238,7 @@ Partial Class Ventas End If 'SERIE ALMACEN - If e.Row.DBCampo("CveTipoInvPS").ToEntero = 5 Then + If e.Row.DBCampo("CveTipoInvPS").ToEntero() = 5 Then If CveVenta > 0 Then e.Row.FCLiteral("LtlSerie").Visible = True Else @@ -6256,12 +6257,12 @@ Partial Class Ventas End If If e.Row.DBCampo("CvePS") = "" Then - e.Row.FCLiteral("LtlPS").Text = String.Format("Folio: {1} Fecha: {2} -- {3} -- {4}", e.Row.DBCampo("CveMovimiento"), e.Row.DBCampo("Folio"), e.Row.DBCampo("Fecha").ToString.ToDate.ToShortDateString, e.Row.DBCampo("Almacen").ToString, e.Row.DBCampo("Concepto").ToString) + e.Row.FCLiteral("LtlPS").Text = String.Format("Folio: {1} Fecha: {2} -- {3} -- {4}", e.Row.DBCampo("CveMovimiento"), e.Row.DBCampo("Folio"), e.Row.DBCampo("Fecha").ToString().ToDate.ToShortDateString, e.Row.DBCampo("Almacen").ToString(), e.Row.DBCampo("Concepto").ToString()) e.Row.FCCheckBox("cbInv").Visible = False e.Row.FCCheckBox("cbInv").Enabled = False - If e.Row.DataKey("Origen").ToEntero > 0 Then + If e.Row.DataKey("Origen").ToEntero() > 0 Then e.Row.BackColor = Drawing.Color.FromArgb(224, 130, 131) e.Row.ForeColor = Drawing.Color.White e.Row.Font.Bold = True @@ -6275,7 +6276,7 @@ Partial Class Ventas e.Row.FCCheckBox("cbInv").Enabled = True 'SI ES REMISION O VENTA DEBE SALIR DE ALMACEN - If UsuarioActual.TienePermisoProceso(157) AndAlso e.Row.DBCampo("CvePS").ToEntero > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso UsuarioActual.CveEmpresa <> 72 Then + If UsuarioActual.TienePermisoProceso(157) AndAlso e.Row.DBCampo("CvePS").ToEntero() > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso UsuarioActual.CveEmpresa <> 72 Then e.Row.FCCheckBox("cbInv").Checked = True e.Row.FCCheckBox("cbInv").Enabled = False End If @@ -6283,7 +6284,7 @@ Partial Class Ventas End If If (CveVenta > 0 And DdlTipoComprobante.SelectedValue <> "Cot") AndAlso Not AplicaDevolucion Then - If e.Row.DBCampo("CveConcepto").ToEntero = 3 Then CveAlmacenDevolucion = e.Row.DBCampo("CveAlmacen").ToEntero + If e.Row.DBCampo("CveConcepto").ToEntero() = 3 Then CveAlmacenDevolucion = e.Row.DBCampo("CveAlmacen").ToEntero() e.Row.FCCheckBox("cbInv").Visible = False End If @@ -6323,7 +6324,7 @@ Partial Class Ventas ' If GvInvNC.Rows.Count = 0 Then ' Try ' If Not IsNothing(DTFacNC) AndAlso DTFacNC.FiltraParametros(String.Format("CveVenta={0}", DdlNCFactura.SelectedValue)).Rows.Count > 0 Then - ' retorno = DTFacNC.FiltroPrimero(String.Format("CveVenta={0}", DdlNCFactura.SelectedValue))("SubTotal").ToString.ToDecimal + ' retorno = DTFacNC.FiltroPrimero(String.Format("CveVenta={0}", DdlNCFactura.SelectedValue))("SubTotal").ToString().ToDecimal ' End If ' Catch ex As Exception @@ -6332,7 +6333,7 @@ Partial Class Ventas ' For Each gvrow As GridViewRow In GvInvNC.Rows ' Dim txt As TextBox = gvrow.FCTextBox("Txtcantidad") ' If txt.Visible Then - ' retorno += txt.Text.ToDecimal * gvrow.DataKey("PU").ToString.ToDecimal + ' retorno += txt.Text.ToDecimal * gvrow.DataKey("PU").ToString().ToDecimal ' End If ' Next ' End If @@ -6461,9 +6462,9 @@ Partial Class Ventas DdlTipoComprobante.SelectedValue = "Ing" EraCotizacion = 1 - TxtFecha.Text = Now.ToString + TxtFecha.Text = Now.ToString() TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranza), Now.AddDays(PlazoCobranza)).ToShortDateString - TxtFechaEjecucion.Text = Now.ToString + TxtFechaEjecucion.Text = Now.ToString() 'debo de regenerar los folios, para facturar CargaFolios() @@ -6503,7 +6504,7 @@ Partial Class Ventas Dim ObjContrato As New ClsContratos If ObjContrato.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then If ObjContrato.DtResultados.Rows.Count > 0 Then - CveContratoTipo = ObjContrato.DtResultados.Rows(0)("CveContratoTipo").ToString.ToEntero + CveContratoTipo = ObjContrato.DtResultados.Rows(0)("CveContratoTipo").ToString().ToEntero() End If End If ObjContrato.Dispose() @@ -6514,17 +6515,17 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then Dim ObjVentas As New ClsVentas - If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero) 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 + 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 + 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 @@ -6560,7 +6561,7 @@ Partial Class Ventas 'VALIDA PROMOCIONES Y EXISTENCIAS Dim ObjVentas As New ClsVentas - If ObjVentas.GetPromocionesPS(-1, TxtFecha.Text.ToDateTime, DdlSubProyectoDatos.SelectedValue.ToEntero, CveCliente, DdlVendedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetPromocionesPS(-1, TxtFecha.Text.ToDateTime, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveCliente, DdlVendedor.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then DtPromociones = ObjVentas.DtResultados End If ObjVentas.Dispose() @@ -6572,24 +6573,24 @@ Partial Class Ventas Dim CveUnidad As Integer Dim CveProducto As Integer Dim Existencia As Double - Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEntero + Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEntero() For Each dr As DataRow In TmpDT.Rows 'SI ES SERVICIO NO VALIDA 'GlobalDTProductosServicios - If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=dr("CvePS").ToString.ToEntero).FiltroPrimeroValor("CveTipoPS").ToString.ToEntero = 1 Then + If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=dr("CvePS").ToString().ToEntero()).FiltroPrimeroValor("CveTipoPS").ToString().ToEntero() = 1 Then Continue For End If If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then 'VALIDA EXISTENCIA - CveProducto = dr("CvePS").ToString.ToEntero - CveUnidad = dr("CveUM").ToString.ToEntero + CveProducto = dr("CvePS").ToString().ToEntero() + CveUnidad = dr("CveUM").ToString().ToEntero() Cantidad = TmpDT.SUM("Cantidad", $"CvePS = {CveProducto} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") 'VALIDA CONTRA LA SUMA DEL MISMO PS - If UsuarioActual.Empresa.UsaInventarios AndAlso RemisionesLista.Count < 1 AndAlso dr("EntregaDirecta").ToString.ToEntero < 1 Then - Existencia = ObjInventarios.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) + If UsuarioActual.Empresa.UsaInventarios AndAlso RemisionesLista.Count < 1 AndAlso dr("EntregaDirecta").ToString().ToEntero() < 1 Then + Existencia = ObjInventarios.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) If Existencia < Cantidad Then - MensajeCosto.AppendFormat("
    El Producto {0}. No cuenta con la cantidad suficiente en inventario. Cuenta con {1}.", dr("CodigoPS").ToString, Existencia.FormatoNumero(2)) + MensajeCosto.AppendFormat("
    El Producto {0}. No cuenta con la cantidad suficiente en inventario. Cuenta con {1}.", dr("CodigoPS").ToString(), Existencia.FormatoNumero(2)) Continue For End If End If @@ -6598,15 +6599,15 @@ Partial Class Ventas EsValido = False EsValidoMayor = False EsValidoPU = True - PU = dr("PU").ToString.ToDecimal * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) - Costo = ObjInventarios.GetCostoPS(dr("CvePS").ToString.ToEntero, dr("Cantidad").ToString.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero, CveTipoAlmacen:=1) + PU = dr("PU").ToString().ToDecimal * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal) + Costo = ObjInventarios.GetCostoPS(dr("CvePS").ToString().ToEntero(), dr("Cantidad").ToString().ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) Dim PrecioMinimo As Decimal = 0 'RMF. condicion temporal, para reubicación, precio mínimo If UsuarioActual.CveEmpresa = 119 Then 'Dim CvePrecioLista As Integer = 38 Dim objPS As New ClsProductosServicios - If objPS.GetPSSucursalesALL(dr("CvePS").ToString.ToEntero, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) Then + If objPS.GetPSSucursalesALL(dr("CvePS").ToString().ToEntero(), UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero()) Then PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal 'If PrecioMinimo > 0 Then ' Costo = PrecioMinimo @@ -6617,7 +6618,7 @@ Partial Class Ventas End If 'PRECIO MINIMO - If UsuarioActual.Empresa.Funcionalidad(129).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then + If UsuarioActual.Empresa.Funcionalidad(129).ToEntero() > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then '' NOTA. si tiene preciominimo, debe de validarlos e ignorar el costo, pero se debe de considerar el TC, para el costo If PrecioMinimo > 0 Then 'SI EL PRECIO ES MAYOR AL COSTO, SI PASA @@ -6627,7 +6628,7 @@ Partial Class Ventas Else CostoMenor = Costo + ((UsuarioActual.Empresa.Funcionalidad(129).ToDecimal / 100) * Costo) 'SI EL PRECIO ES MAYOR AL COSTO, SI PASA - If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= CostoMenor Then + If PU * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal) >= CostoMenor Then EsValido = True End If End If @@ -6635,7 +6636,7 @@ Partial Class Ventas EsValido = True End If - If UsuarioActual.Empresa.Funcionalidad(133).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then + If UsuarioActual.Empresa.Funcionalidad(133).ToEntero() > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then CostoMayor = Costo + ((UsuarioActual.Empresa.Funcionalidad(133).ToDecimal / 100) * Costo) 'SI EL PRECIO ES MAYOR AL COSTO, SI PASA If PU <= CostoMayor Then @@ -6647,8 +6648,8 @@ Partial Class Ventas 'VALIDA PROMOCION: SI TIENE PROMOCION Y EL PRECIO ES MENOR AL PRECIO DE PROMOCION, NO PASA | SI YA CUMPLE NO VUELVE A VALIDAR If Not EsValido Or PU = 0 Then - If DtPromociones.FiltraParametros($"CvePS = {dr("CvePS").ToString.ToEntero}").Rows.Count > 0 Then - If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {dr("CvePS").ToString.ToEntero}").ToDecimal Then + If DtPromociones.FiltraParametros($"CvePS = {dr("CvePS").ToString().ToEntero()}").Rows.Count > 0 Then + If PU * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal) >= DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {dr("CvePS").ToString().ToEntero()}").ToDecimal Then EsValido = True Else EsValidoPU = False ' SI NO ENTRA DENTRO DE LA PROMOCION NO SE PUEDE VENDER A 0 @@ -6661,35 +6662,35 @@ Partial Class Ventas Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) If Not EsValido Then - MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio menor de su Costo ni a un precio mayor de su rango aceptado
    ", dr("PS").ToString) + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio menor de su Costo ni a un precio mayor de su rango aceptado
    ", dr("PS").ToString()) If TienePermisoImportes Then MensajeCosto.AppendFormat("El costo del producto es: {0:#,###.00}$
    ", Costo) - MensajeCosto.AppendFormat("El rango menor aceptado es: {0} {1:#,###.00}$
    ", UsuarioActual.Empresa.Funcionalidad(129).ToEntero, CostoMenor) + MensajeCosto.AppendFormat("El rango menor aceptado es: {0} {1:#,###.00}$
    ", UsuarioActual.Empresa.Funcionalidad(129).ToEntero(), CostoMenor) MensajeCosto.AppendFormat("El precio indicado es: {0:#,###.00}$ ({1}% de ganancia)
    ", PU.FormatoNumero, If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)) End If End If If Not EsValidoMayor Then - MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
    ", dr("PS").ToString) + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
    ", dr("PS").ToString()) If TienePermisoImportes Then MensajeCosto.AppendFormat("El costo del producto es: {0:#,###.00}$
    ", Costo) - MensajeCosto.AppendFormat("El rango mayor aceptado es: {0} {1:#,###.00}$
    ", UsuarioActual.Empresa.Funcionalidad(133).ToEntero, CostoMayor) + MensajeCosto.AppendFormat("El rango mayor aceptado es: {0} {1:#,###.00}$
    ", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) MensajeCosto.AppendFormat("El precio indicado es: {0:#,###.00}$ ({1}% de ganancia)
    ", PU.FormatoNumero, If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)) End If End If ' SOLO SI TIENE LA FUNCIONALIDAD DE RESTRICCION VALIDA EL IMPORTE CERO - If UsuarioActual.Empresa.Funcionalidad(139).ToString.ToEntero > 0 Then + If UsuarioActual.Empresa.Funcionalidad(139).ToString().ToEntero() > 0 Then If Not EsValidoPU Then - MensajeCosto.AppendFormat($"El producto {dr("PS").ToString}. No se puede vender a un importe de cero ($0)", TipoMensaje.MsgAdvertencia) + MensajeCosto.AppendFormat($"El producto {dr("PS").ToString()}. No se puede vender a un importe de cero ($0)", TipoMensaje.MsgAdvertencia) End If End If Next ObjInventarios.Dispose() - If MensajeCosto.ToString.Length > 1 Then - Alert(MensajeCosto.ToString, TipoMensaje.MsgAdvertencia) + If MensajeCosto.ToString().Length > 1 Then + Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -6698,9 +6699,9 @@ Partial Class Ventas 'Valida si en caso de que el detalle tenga llantas o polizas se agreguén kilometraje/serie en la parte de observaciones(solo para el caso de empresas llanteras) If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then - If TxtKilometraje.Text.ToEntero = 0 Then + If TxtKilometraje.Text.ToEntero() = 0 Then 'cuando es la clasificacion de llantas - Dim FaltaObservacion As Integer = TmpDT.FiltroPrimeroValor("CveClasificacion", "CveClasificacion = 20342").ToEntero + Dim FaltaObservacion As Integer = TmpDT.FiltroPrimeroValor("CveClasificacion", "CveClasificacion = 20342").ToEntero() If FaltaObservacion = 20342 Then Alert("No se ha especificado el kilometraje.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -6712,13 +6713,13 @@ Partial Class Ventas Dim FaltaObservacion As Integer = -1 'For Each PS As GridViewRow In GvPS.Rows ' Dim PsRenglon As GridViewRow = PS - ' Dim CveClasificacion As Integer = PsRenglon.DataKey("CveClasificacion").ToEntero + ' Dim CveClasificacion As Integer = PsRenglon.DataKey("CveClasificacion").ToEntero() ' If CveClasificacion = 20345 Or CveClasificacion = 20342 Then ' FaltaObservacion = CveClasificacion ' Exit For ' End If ' - FaltaObservacion = TmpDT.FiltroPrimeroValor("CveClasificacion", "CveClasificacion = 20345").ToEntero + FaltaObservacion = TmpDT.FiltroPrimeroValor("CveClasificacion", "CveClasificacion = 20345").ToEntero() 'cuando es la clasificacion de polizas If FaltaObservacion = 20345 Then Alert("No se ha especificado la serie para la poliza en la sección de Observaciones", TipoMensaje.MsgAdvertencia) @@ -6734,10 +6735,10 @@ Partial Class Ventas Dim Objeto As New ClsVtaVendedores Dim DTSupervisores As New DataTable If Objeto.GetVendedores(UsuarioActual.CveEmpresa) Then - DTSupervisores = Objeto.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DdlVendedor.SelectedValue.ToEntero)) + DTSupervisores = Objeto.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DdlVendedor.SelectedValue.ToEntero())) 'Verifico si el supervisor tiene correo para proceder If DTSupervisores.Rows.Count > 0 Then - CorreoSupervisor = DTSupervisores.Rows(0)("CorreoSupervisor").ToString + CorreoSupervisor = DTSupervisores.Rows(0)("CorreoSupervisor").ToString() End If End If DTSupervisores.Dispose() @@ -6778,7 +6779,7 @@ Partial Class Ventas LnkImprimir.Visible = False 'If (UsuarioActual.CveEmpresa.Contiene(1, 4, 5, 7, 11, 12, 72, 80, 81, 83) And UsuarioActual.CveUsuario = 100) Or UsuarioActual.CveEmpresa.Contiene(80, 83) Or UsuarioActual.CveUsuario = 100 Then - If (Archivo.Exists Or Archivo2.Exists) And IfNull(CveVenta, 0).ToString.ToEntero > 0 Then + If (Archivo.Exists Or Archivo2.Exists) And IfNull(CveVenta, 0).ToString().ToEntero() > 0 Then HplDownPDF.Visible = True HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))) End If @@ -6804,7 +6805,7 @@ Partial Class Ventas For Each drt As DataRow In dttsat.Rows str.AppendFormat("{0}
    ", drt("CodigoPS")) Next - Alert(str.ToString, TipoMensaje.MsgAdvertencia) + Alert(str.ToString(), TipoMensaje.MsgAdvertencia) dttsat.Dispose() Exit Sub End If @@ -6859,7 +6860,7 @@ Partial Class Ventas Alert("El Cliente no tiene registrado la cuenta contable", TipoMensaje.MsgError) Exit Sub End If - 'If ViewState("IdCtaContClientes").ToString.ToEntero <= 0 Then 'GetClientes ObjCliente.IdCtaContClientes + 'If ViewState("IdCtaContClientes").ToString().ToEntero() <= 0 Then 'GetClientes ObjCliente.IdCtaContClientes ' Alert("El Cliente no tiene registrado la cuenta contable", TipoMensaje.MsgError) ' Exit Sub 'End If @@ -6906,18 +6907,18 @@ Partial Class Ventas End If 'VERIFICA QUE EL FOLIO NO SEA IGUAL AL DE LA FACTURA ANTERIOR - 'If ObjFactura.Folio = TxtFolio.Text.ToEntero Then + 'If ObjFactura.Folio = TxtFolio.Text.ToEntero() Then ' If ObjFolios.GetFolios(ObjFactura.TipoDocto, UsuarioActual.CveEmpresa) Then ' Dim DtFolios As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSucursal = {0} And Estado = 'Activo'", ObjFactura.CveSucursal)) ' If DtFolios.Rows.Count > 0 Then - ' 'ViewState("CveFolio") = DtFolios.Rows(0)("CveFolio").ToString.ToEntero - ' 'ViewState("NumAprobacion") = CLng(DtFolios.Rows(0)("Aprobacion").ToString) - ' 'ViewState("FechaAprobacion") = DtFolios.Rows(0)("FechaAprobacion").ToString.ToDate - ' 'ViewState("FolioActual") = DtFolios.Rows(0)("FActual").ToString - ' 'LblSerie.Text = DtFolios.Rows(0)("Serie").ToString + ' 'ViewState("CveFolio") = DtFolios.Rows(0)("CveFolio").ToString().ToEntero() + ' 'ViewState("NumAprobacion") = CLng(DtFolios.Rows(0)("Aprobacion").ToString()) + ' 'ViewState("FechaAprobacion") = DtFolios.Rows(0)("FechaAprobacion").ToString().ToDate + ' 'ViewState("FolioActual") = DtFolios.Rows(0)("FActual").ToString() + ' 'LblSerie.Text = DtFolios.Rows(0)("Serie").ToString() ' If UsuarioActual.CveEmpresa <> 72 Then - ' ObjFactura.Folio = DtFolios.Rows(0)("FActual").ToString.ToEntero + ' ObjFactura.Folio = DtFolios.Rows(0)("FActual").ToString().ToEntero() ' End If ' End If ' End If @@ -6935,7 +6936,7 @@ Partial Class Ventas If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then TieneAnticipo = True - CveAnticipoPadre = row2.DataKey("CveVenta").ToEntero + CveAnticipoPadre = row2.DataKey("CveVenta").ToEntero() CveAnticipo = CveAnticipoPadre 'CUANDO ES REFACTURACION DEBE RELACIONAR CON LA FACTURA REFACTURADA @@ -6943,7 +6944,7 @@ Partial Class Ventas ObjFactura.CveVentaRelacion = CveAnticipoPadre 'relaciona al anticipo ObjFactura.ImporteRelacion = row2.FCTextBox($"TxtAnticipo{actualindex}").Text.ToDecimal FolioFiscalRelacionado = row2.DataKey("FolioFiscal") - ObjFactura.CveVentaPadre = row2.DataKey("CveVenta").ToEntero + ObjFactura.CveVentaPadre = row2.DataKey("CveVenta").ToEntero() Else ObjFactura.CveVentaRelacion = CveDevolucion End If @@ -6970,9 +6971,9 @@ Partial Class Ventas Dim Cantidad As Decimal = 0 For Each row As DataRow In TmpDT.Rows - Cantidad = row("Cantidad").ToString.ToDecimal - CveVentaDetalle = row("CveVentaDetalle").ToString.ToEntero - CveOrdenCompraDetalle = row("CveOrdenCompraDetalle").ToString.ToEntero + Cantidad = row("Cantidad").ToString().ToDecimal + CveVentaDetalle = row("CveVentaDetalle").ToString().ToEntero() + CveOrdenCompraDetalle = row("CveOrdenCompraDetalle").ToString().ToEntero() If Not ObjVentas.AgregarVentaOCDetalle(CveVentaDetalle, CveOrdenCompraDetalle, Cantidad) Then ErrorList.Add("Ocurrió un Error al agregar el detalle de la Remision") Exit For @@ -7061,21 +7062,21 @@ Partial Class Ventas 'ACTUALIZA VENTA COTIZACIÓN If EraCotizacion = 1 And BtnEmitirImprimir.Text = "Facturar" Then - If Not ObjVentas.UpdateVentaCotizacion(ObjFactura.CveVenta, Request("CveVenta").ToEntero) Then + If Not ObjVentas.UpdateVentaCotizacion(ObjFactura.CveVenta, Request("CveVenta").ToEntero()) Then ErrorList.Add("Ocurrió un error al actualizar la cotización") End If End If 'ACTUALIZA VENTAPADRE PEDIDO - If Request("DevPed").ToEntero > 0 AndAlso ErrorList.Count = 0 Then - If Not ObjVentas.UpdateVentaCotizacion(Request("DevPed").ToEntero, ObjFactura.CveVenta) Then + If Request("DevPed").ToEntero() > 0 AndAlso ErrorList.Count = 0 Then + If Not ObjVentas.UpdateVentaCotizacion(Request("DevPed").ToEntero(), ObjFactura.CveVenta) Then ErrorList.Add("Ocurrió un error al actualizar la devolución de pedido") End If End If 'ACTUALIZA LA COLUMNA CveVentaFacturada - If (Request("CveRemision") IsNot Nothing AndAlso ViewState("CveRemision").ToString.ToEntero > 0) AndAlso (Request("Op") IsNot Nothing AndAlso Request("Op") = "Rem") AndAlso ErrorList.Count = 0 Then - If Not ObjVentas.UpdateVentaRemision(ViewState("CveRemision").ToString.ToEntero, ObjFactura.CveVenta) Then + If (Request("CveRemision") IsNot Nothing AndAlso ViewState("CveRemision").ToString().ToEntero() > 0) AndAlso (Request("Op") IsNot Nothing AndAlso Request("Op") = "Rem") AndAlso ErrorList.Count = 0 Then + If Not ObjVentas.UpdateVentaRemision(ViewState("CveRemision").ToString().ToEntero(), ObjFactura.CveVenta) Then ErrorList.Add("Ocurrió un error al actualizar la remision") End If End If @@ -7090,10 +7091,10 @@ Partial Class Ventas For Each row As DataRow In DtCotizacionesPS.Rows Cantidad = DtCotizacionTmpDT.FiltroPrimeroValor("Cantidad", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToDecimal - CvePS = DtCotizacionTmpDT.FiltroPrimeroValor("CvePS", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToEntero + CvePS = DtCotizacionTmpDT.FiltroPrimeroValor("CvePS", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToEntero() PU = DtCotizacionTmpDT.FiltroPrimeroValor("PU", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToDecimal - CveVentaDetalle = TmpDT.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToEntero - CveVentaDetallePadre = row("CveVentaDetalle").ToString.ToEntero + CveVentaDetalle = TmpDT.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetalleCotizacion={row("CveVentaDetalle")}").ToEntero() + CveVentaDetallePadre = row("CveVentaDetalle").ToString().ToEntero() If Not ObjVentas.AgregaCotizacionDetalle(CveVentaDetalle, CveVentaDetallePadre, Cantidad) Then ErrorList.Add("Ocurrió un Error al agregar el detalle de la Cotización.") @@ -7187,7 +7188,7 @@ Partial Class Ventas Try - Dim DirectoriArchivoXML As String = System.IO.Path.Combine(Server.MapPath("/"), "Empresas", UsuarioActual.CveEmpresa.ToString, ObjFactura.TipoDocto) + Dim DirectoriArchivoXML As String = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas", UsuarioActual.CveEmpresa.ToString(), ObjFactura.TipoDocto) If Not Directory.Exists(DirectoriArchivoXML) Then Directory.CreateDirectory(DirectoriArchivoXML) End If @@ -7268,7 +7269,7 @@ Partial Class Ventas If ObjContr.DtResultados.Rows.Count > 0 Then ' si es flexible que notifique el monto maximo, si no lo es que notifique el porcentaje alcanzado... flexible = 2, no flexible = 1 - Dim PorcentajeAvance As Double = ObjContr.DtResultados.Rows(0)("ContratoAvance").ToString.ToDouble + Dim PorcentajeAvance As Double = ObjContr.DtResultados.Rows(0)("ContratoAvance").ToString().ToDouble If ObjContr.DtResultados.Rows(0)("ModalidadDetalle").ToString() = "1" Then @@ -7276,7 +7277,7 @@ Partial Class Ventas EnviarNotificacionAvance(ObjContr.DtResultados.Rows(0)("NumeroContrato").ToString(), ObjContr.DtResultados.Rows(0)("DescripcionContrato").ToString(), ObjContr.DtResultados.Rows(0)("ContratoTipo").ToString(), ObjContr.DtResultados.Rows(0)("NombreComercial").ToString(), ObjContr.DtResultados.Rows(0)("CorreoVendedor").ToString()) End If Else - Dim MontoMaximo As Double = ObjContr.DtResultados.Rows(0)("ImporteMax").ToString.ToDouble + Dim MontoMaximo As Double = ObjContr.DtResultados.Rows(0)("ImporteMax").ToString().ToDouble If PorcentajeAvance >= 100 And MontoMaximo > 0 Then EnviarNotificacionAvance(ObjContr.DtResultados.Rows(0)("NumeroContrato").ToString(), ObjContr.DtResultados.Rows(0)("DescripcionContrato").ToString(), ObjContr.DtResultados.Rows(0)("ContratoTipo").ToString(), ObjContr.DtResultados.Rows(0)("NombreComercial").ToString(), ObjContr.DtResultados.Rows(0)("CorreoVendedor").ToString(), MontoMaximo) @@ -7391,14 +7392,14 @@ Partial Class Ventas MensajeAlert.AppendFormat("

    Se generó una Nota de crédito Folio: {0} amortizando el anticipo
    ", ObjFacturaDevolucion.Folio) End If - If RBLPago.SelectedValue.ToEntero = 2 And TxtCambio.Text.ToDecimal > 0 Then + If RBLPago.SelectedValue.ToEntero() = 2 And TxtCambio.Text.ToDecimal > 0 Then MensajeAlert.AppendFormat("

    Su cambio es de ${0}
    ", TxtCambio.Text.ToDecimal.FormatoNumero(2)) End If 'MUESTA ALERT OK ' si es elrol 1165-Ventas,EMp:80, o la empresa 119, recarga ventas, para seguir registrando-. Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}&Opt=3"";")) - Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion, Liga) + Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga) 'LIMPIA CONDICIONES DE PAGO - CONTADO @@ -7464,7 +7465,7 @@ Partial Class Ventas ObjFacturaDevolucion = New Modelos.Factura ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario - ObjFacturaDevolucion.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero + ObjFacturaDevolucion.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero() If CveVentasPadre > 0 Then ObjFacturaDevolucion.CveVentaPadre = CveVentasPadre @@ -7475,21 +7476,21 @@ Partial Class Ventas End If ObjFacturaDevolucion.CveEmpresa = UsuarioActual.CveEmpresa - ObjFacturaDevolucion.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal) + ObjFacturaDevolucion.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal) ObjFacturaDevolucion.ConvertirPesos = ChkConvertirDoctoPesos.Checked - ObjFacturaDevolucion.CveMoneda = DdlMoneda.SelectedValue.ToEntero + ObjFacturaDevolucion.CveMoneda = DdlMoneda.SelectedValue.ToEntero() ObjFacturaDevolucion.Moneda = DdlMoneda.SelectedItem.Text ObjFacturaDevolucion.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {DdlMoneda.SelectedValue}") 'ObjFacturaDevolucion.RefDocto = TxtDocto.Text.Trim - 'ObjFacturaDevolucion.Folio = If(ExFolioFactura, FolioXML.ToEntero, -1) + 'ObjFacturaDevolucion.Folio = If(ExFolioFactura, FolioXML.ToEntero(), -1) ObjFacturaDevolucion.Serie = LblSerie.Text ObjFacturaDevolucion.Fecha = New Date(TxtFecha.Text.Trim.ToDate.Year, TxtFecha.Text.Trim.ToDate.Month, TxtFecha.Text.Trim.ToDate.Day, Now.Hour, Now.Minute, Now.Second) ObjFacturaDevolucion.CvePrePoliza = -1 - ObjFacturaDevolucion.CveMetodoPago = 0 'DdlMetodoPago.SelectedValue.ToEntero + ObjFacturaDevolucion.CveMetodoPago = 0 'DdlMetodoPago.SelectedValue.ToEntero() ObjFacturaDevolucion.MetodoPago = "" ObjFacturaDevolucion.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") ObjFacturaDevolucion.UsuarioCreo = LblUsuario.Text.Trim - ' ObjFacturaDevolucion.CveCondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedValue.ToEntero, -1) + ' ObjFacturaDevolucion.CveCondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedValue.ToEntero(), -1) ' ObjFacturaDevolucion.CondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedItem.Text, "") 'ObjFacturaDevolucion.NumeroCuenta = TxtNumCtaPago.Text.Trim 'ObjFacturaDevolucion.Cliente.NumCtaPago = TxtNumCtaPago.Text.Trim @@ -7508,11 +7509,11 @@ Partial Class Ventas ObjFacturaDevolucion.FormaPago33 = "Aplicación de anticipos" ObjFacturaDevolucion.FormaPagoSAT33 = "30" - ObjFacturaDevolucion.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero + ObjFacturaDevolucion.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero() ObjFacturaDevolucion.UsoCFDI = DdlUsoCFDI.SelectedItem.Text ObjFacturaDevolucion.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") - ObjFacturaDevolucion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero + ObjFacturaDevolucion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero() ObjFacturaDevolucion.TipoRelacion = "07" Dim Fol As New List(Of String) @@ -7554,19 +7555,19 @@ Partial Class Ventas ObjFacturaDevolucion.NumeroPersonas = 0 ObjFacturaDevolucion.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto) ObjFacturaDevolucion.DescripcionContrato = If(DdlContratosModal.SelectedItem IsNot Nothing, DdlContratosModal.SelectedItem.Text, "") - ObjFacturaDevolucion.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero + ObjFacturaDevolucion.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero() ObjFacturaDevolucion.Entrega = Entrega ObjFacturaDevolucion.Vigencia = TxtFechaVencimientoCotizacion.Text.ToDate ObjFacturaDevolucion.CveVentaPadre = CveAnticipoPadre - ObjFacturaDevolucion.CveVendedor = DdlVendedor.SelectedValue.ToEntero - If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then + ObjFacturaDevolucion.CveVendedor = DdlVendedor.SelectedValue.ToEntero() + If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False End If ObjFacturaDevolucion.FechaEjecucion = TxtFechaEjecucion.Text.Trim.ToDate - ObjFacturaDevolucion.CveSucursalEjecucion = DdlSucursalEjecucion.SelectedValue.ToEntero - ObjFacturaDevolucion.CveSucursalCobranza = DdlSucursalCobranza.SelectedValue.ToEntero + ObjFacturaDevolucion.CveSucursalEjecucion = DdlSucursalEjecucion.SelectedValue.ToEntero() + ObjFacturaDevolucion.CveSucursalCobranza = DdlSucursalCobranza.SelectedValue.ToEntero() ObjFacturaDevolucion.AtencionA = If(ObjFacturaDevolucion.TipoDocto = "Cot" Or (ObjFacturaDevolucion.TipoDocto.Contiene("Ing", "Rem") AndAlso LblRFC.Text = "XAXX010101000"), TxtAtencionA.Text, "-1") ObjFacturaDevolucion.MotivoDescuento = TxtMotivoDescuento.Text.Trim @@ -7600,7 +7601,7 @@ Partial Class Ventas DR = TmpDTImpuestos.NewRow() - 'If DdlFormatoImpresion.SelectedValue.ToEntero = 3 Or DdlFormatoImpresion.SelectedValue.ToEntero = 4 Then + 'If DdlFormatoImpresion.SelectedValue.ToEntero() = 3 Or DdlFormatoImpresion.SelectedValue.ToEntero() = 4 Then ' DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (TxtSubTotal.Text.ToDecimal + TxtIVA.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal) : DR("Orden") = 55 : TmpDTImpuestos.Rows.Add(DR) ' DR = TmpDTImpuestos.NewRow() @@ -7610,7 +7611,7 @@ Partial Class Ventas If gvr.RowType = DataControlRowType.DataRow Then Dim Orden As Integer = 80 If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then - DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal.RoundSQL(2) : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString.ToEntero : TmpDTImpuestos.Rows.Add(DR) + DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString() : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal.RoundSQL(2) : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString() : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString() : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString().ToEntero() : TmpDTImpuestos.Rows.Add(DR) DR = TmpDTImpuestos.NewRow() Orden = Orden + 1 End If @@ -7650,7 +7651,7 @@ Partial Class Ventas ObjFacturaDevolucion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim - ObjFacturaDevolucion.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero + ObjFacturaDevolucion.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero() If ObjFacturaDevolucion.CveMoneda <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then ObjFacturaDevolucion.TipoCambio = 1 @@ -7664,7 +7665,7 @@ Partial Class Ventas ObjFacturaDevolucion.SetCliente() ''SUCURSAL - 'ObjFacturaDevolucion.CveSucursal = DdlSucursal.SelectedValue.ToEntero + 'ObjFacturaDevolucion.CveSucursal = DdlSucursal.SelectedValue.ToEntero() 'ObjFacturaDevolucion.SetSucursalMatriz(Me) 'ObjFacturaDevolucion.SetSucursal(Me) @@ -7678,9 +7679,9 @@ Partial Class Ventas ObjFacturaDevolucion.ClienteSucursal.Estado = LblEstado.Text ObjFacturaDevolucion.ClienteSucursal.CP = LblCP.Text ObjFacturaDevolucion.ClienteSucursal.Pais = CliPais - ObjFacturaDevolucion.ClienteSucursal.CorreoSucursal = CliCorreoCot.ToString + ObjFacturaDevolucion.ClienteSucursal.CorreoSucursal = CliCorreoCot.ToString() ObjFacturaDevolucion.ClienteSucursal.TelefonoSucursal = LblTelefono.Text - ObjFacturaDevolucion.ClienteSucursal.Sucursal = If(DdlSucursalCliente.SelectedValue.ToEntero > 0, DdlSucursalCliente.SelectedItem.Text, "") + ObjFacturaDevolucion.ClienteSucursal.Sucursal = If(DdlSucursalCliente.SelectedValue.ToEntero() > 0, DdlSucursalCliente.SelectedItem.Text, "") @@ -7690,14 +7691,14 @@ Partial Class Ventas 'ENVIO DIRECCION ObjFacturaDevolucion.EnviarA = New Modelos.EnviarAModel If ChkDireccionEnvio.Checked Then - If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero)).Rows.Count > 0 Then - For Each Row As DataRow In TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero)).Rows - ObjFacturaDevolucion.EnviarA.CveDireccionEnvio = Row("CveDireccionEnvio").ToString.ToEntero - ObjFacturaDevolucion.EnviarA.EnvioDireccion = Row("EnvioDireccion").ToString - ObjFacturaDevolucion.EnviarA.EnvioColonia = Row("EnvioColonia").ToString - ObjFacturaDevolucion.EnviarA.EnvioCiudad = Row("EnvioCiudad").ToString - ObjFacturaDevolucion.EnviarA.EnvioEstado = Row("EnvioEstado").ToString - ObjFacturaDevolucion.EnviarA.EnvioCP = Row("EnvioCP").ToString + If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then + For Each Row As DataRow In TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows + ObjFacturaDevolucion.EnviarA.CveDireccionEnvio = Row("CveDireccionEnvio").ToString().ToEntero() + ObjFacturaDevolucion.EnviarA.EnvioDireccion = Row("EnvioDireccion").ToString() + ObjFacturaDevolucion.EnviarA.EnvioColonia = Row("EnvioColonia").ToString() + ObjFacturaDevolucion.EnviarA.EnvioCiudad = Row("EnvioCiudad").ToString() + ObjFacturaDevolucion.EnviarA.EnvioEstado = Row("EnvioEstado").ToString() + ObjFacturaDevolucion.EnviarA.EnvioCP = Row("EnvioCP").ToString() Next End If End If @@ -7724,9 +7725,9 @@ Partial Class Ventas Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL()) If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then - Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero)) + Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero())) If DT.Rows.Count > 0 Then - factura.Folio = DT.Rows(0)("FActual").ToString.ToEntero + factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero() Else ProcesoCorrecto = False End If @@ -7752,14 +7753,14 @@ Partial Class Ventas Dim tmpcon As DataTable = TmpDT.Clone tmpcon.Clear() - Dim drpss As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlNCPSAnt.SelectedValue.ToEntero).FiltroPrimero("") + Dim drpss As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlNCPSAnt.SelectedValue.ToEntero()).FiltroPrimero("") If drpss IsNot Nothing Then Dim ii As Integer = 1 Dim CveVentaP As Integer = 0 For Each gvrt As GridViewRow In GVAnticipos.Rows If gvrt.FCCheckBox(String.Format("Chk{0}", gvrt.RowIndex)).Checked Then - Dim CveSub As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto").ToEntero + Dim CveSub As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto").ToEntero() Dim dr As DataRow = tmpcon.NewRow Dim Cantidad As Decimal = 1 Dim PU As Decimal = gvrt.FCTextBox(String.Format("TxtAnticipo{0}", gvrt.RowIndex)).Text.ToDecimal @@ -7774,24 +7775,24 @@ Partial Class Ventas dr("SATClaveUM") = "ACT" dr("Consec") = ii - If drpss("IVA").ToString = "-1" Then + If drpss("IVA").ToString() = "-1" Then dr("PorcentajeIVA") = PorcentajeIVA ' GlobalDTSubProyectos(-1,cves DrPS("IVA") Else dr("PorcentajeIVA") = drpss("IVA") End If dr("IVA") = dr("PorcentajeIVA") - dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales) dr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales) dr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales) dr("PorcentajeRetIVA") = ClienteRetIVA dr("PorcentajeRetISR") = ClienteRetISR If UsuarioActual.Empresa.Funcionalidad(343) = "1" Then dr("PorcentajeIEPS") = drpss("IEPSPorcentaje") - dr("ImporteIEPS") = Math.Round(drpss("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + dr("ImporteIEPS") = Math.Round(drpss("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales) Else dr("PorcentajeIEPS") = 0 ' DrPS("IEPSPorcentaje") - dr("ImporteIEPS") = 0 'Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + dr("ImporteIEPS") = 0 'Math.Round(DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales) End If dr("IEPS") = dr("ImporteIEPS") @@ -7801,7 +7802,7 @@ Partial Class Ventas dr("CveClasificacion") = drpss("CveClasificacion") dr("CveSubProyecto") = CveSub dr("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales) - CveVentaP = gvrt.DataKey("CveVenta").ToEntero + CveVentaP = gvrt.DataKey("CveVenta").ToEntero() tmpcon.Rows.Add(dr) ii += 1 End If @@ -7819,7 +7820,7 @@ Partial Class Ventas Dim TotalRetIVA As Decimal = tmpcon.SUM("ImporteRetIVA").ToDecimal Dim TotalRetISR As Decimal = tmpcon.SUM("ImporteRetISR").ToDecimal Dim Total As Decimal = 0 - Dim TotalImpuestosLocales As Decimal = factura.TotalImpuestoLocal.ToString.ToDecimal + Dim TotalImpuestosLocales As Decimal = factura.TotalImpuestoLocal.ToString().ToDecimal Total = (TotalSubTotal - TotalDescuentos + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales) factura.SubTotal = TotalSubTotal @@ -7870,56 +7871,56 @@ Partial Class Ventas ObjFactura.Version = "3.3" ObjFactura.CveUsuario = UsuarioActual.CveUsuario ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa - ObjFactura.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal) + ObjFactura.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal) ObjFactura.TipoCambioDolares = TxtTipoCambioDlls.Text.Trim.ToDecimal ObjFactura.ConvertirPesos = ChkConvertirDoctoPesos.Checked ObjFactura.ConvertirDolares = ChkConvertirDolares.Checked - ObjFactura.CveMoneda = DdlMoneda.SelectedValue.ToEntero + ObjFactura.CveMoneda = DdlMoneda.SelectedValue.ToEntero() ObjFactura.Moneda = DdlMoneda.SelectedItem.Text ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {DdlMoneda.SelectedValue}") - ObjFactura.TipoDocto = If(IfNull(ViewState("CveRemision"), 0).ToString.ToEntero > 0, "Ing", DdlTipoComprobante.SelectedValue) + ObjFactura.TipoDocto = If(IfNull(ViewState("CveRemision"), 0).ToString().ToEntero() > 0, "Ing", DdlTipoComprobante.SelectedValue) 'ObjFactura.RefDocto = TxtDocto.Text.Trim 'si es cancelacion, debe de conservar el folio actual - If Not EsCancelacion Then ObjFactura.Folio = If(EstablecioFolio Or VistaPrevia Or (CveVenta > 0 And (NuevaFactura.Contiene(0, 2))), TxtFolio.Text.Trim.ToEntero, -1) + If Not EsCancelacion Then ObjFactura.Folio = If(EstablecioFolio Or VistaPrevia Or (CveVenta > 0 And (NuevaFactura.Contiene(0, 2))), TxtFolio.Text.Trim.ToEntero(), -1) - 'ObjFactura.Folio = If(ExFolioFactura, FolioXML.ToEntero, -1) + 'ObjFactura.Folio = If(ExFolioFactura, FolioXML.ToEntero(), -1) ObjFactura.Serie = If(VistaPrevia, "VistaPrevia", LblSerie.Text) ObjFactura.Fecha = New Date(TxtFecha.Text.Trim.ToDate.Year, TxtFecha.Text.Trim.ToDate.Month, TxtFecha.Text.Trim.ToDate.Day, Now.Hour, Now.Minute, Now.Second) ObjFactura.CvePrePoliza = -1 - ObjFactura.CveMetodoPago = 0 'DdlMetodoPago.SelectedValue.ToEntero + ObjFactura.CveMetodoPago = 0 'DdlMetodoPago.SelectedValue.ToEntero() ObjFactura.MetodoPago = "" ' DdlMetodoPago.SelectedItem.Text ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") ObjFactura.FechaVencimiento = TxtFechaPago.Text.ToDate ' If ObjFactura.TipoDocto = "Cot" Then - ObjFactura.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero - ObjFactura.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero > 0, DdlMetodoPago33.SelectedItem.Text, "") + ObjFactura.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero() + ObjFactura.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero() > 0, DdlMetodoPago33.SelectedItem.Text, "") ObjFactura.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") - ObjFactura.CveFormaPago33 = DdlFormaPago33.SelectedValue.ToEntero - ObjFactura.FormaPago33 = If(DdlFormaPago33.SelectedValue.ToEntero > 0, DdlFormaPago33.SelectedItem.Text, "") + ObjFactura.CveFormaPago33 = DdlFormaPago33.SelectedValue.ToEntero() + ObjFactura.FormaPago33 = If(DdlFormaPago33.SelectedValue.ToEntero() > 0, DdlFormaPago33.SelectedItem.Text, "") ObjFactura.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {DdlFormaPago33.SelectedValue}") - ObjFactura.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero - ObjFactura.UsoCFDI = If(DdlUsoCFDI.SelectedValue.ToEntero > 0, DdlUsoCFDI.SelectedItem.Text, "") + ObjFactura.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero() + ObjFactura.UsoCFDI = If(DdlUsoCFDI.SelectedValue.ToEntero() > 0, DdlUsoCFDI.SelectedItem.Text, "") ObjFactura.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") ' End If ObjFactura.UsuarioCreo = LblUsuario.Text.Trim - ObjFactura.CveCondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedValue.ToEntero, -1) + ObjFactura.CveCondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedValue.ToEntero(), -1) ObjFactura.CondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedItem.Text, "") 'ObjFactura.NumeroCuenta = TxtNumCtaPago.Text.Trim 'ObjFactura.Cliente.NumCtaPago = TxtNumCtaPago.Text.Trim ObjFactura.CondicionesPago = If(RBLPago.SelectedValue = "2", 0, If(RBLPago.SelectedValue = "1", 1, 2)) ' 0 - Contado, 1 - Credito, 2 - termianl - ObjFactura.FormaPago = 0 'DdlFormaPago.SelectedValue.ToEntero + ObjFactura.FormaPago = 0 'DdlFormaPago.SelectedValue.ToEntero() - 'ObjFactura.AnticipoPosicion = DdlAmortizacionConceptos.SelectedValue.ToEntero + 'ObjFactura.AnticipoPosicion = DdlAmortizacionConceptos.SelectedValue.ToEntero() 'ObjFactura.AnticipoEnSubTotal = If(ChkAnticipoEnSubTotal.Checked, True, False) - 'ObjFactura.CveTipoRelacion = DdlTipoRelacion.SelectedValue.ToEntero + 'ObjFactura.CveTipoRelacion = DdlTipoRelacion.SelectedValue.ToEntero() 'ObjFactura.SerieFolio = String.Format("{0}-{1}", LblSerie.Text, TxtFolio.Text) @@ -7976,24 +7977,24 @@ Partial Class Ventas ObjFactura.NumeroPersonas = 0 ObjFactura.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto) - ObjFactura.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero + ObjFactura.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero() ObjFactura.Entrega = Entrega ObjFactura.Vigencia = TxtFechaVencimientoCotizacion.Text.ToDate ObjFactura.CveVentaPadre = If(CveDevolucion > 0, CveDevolucion, If(CvePedido2 > 0, CvePedido2, CvePedido)) If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then - ObjFactura.CveVentaPadre = DtVentasNC.Rows(0)("CveVenta").ToString.ToEntero - ObjFactura.SerieFolioPadre = DtVentasNC.Rows(0)("FolioFiscal").ToString + ObjFactura.CveVentaPadre = DtVentasNC.Rows(0)("CveVenta").ToString().ToEntero() + ObjFactura.SerieFolioPadre = DtVentasNC.Rows(0)("FolioFiscal").ToString() End If - ObjFactura.CveVendedor = DdlVendedor.SelectedValue.ToEntero - If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then + ObjFactura.CveVendedor = DdlVendedor.SelectedValue.ToEntero() + If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False End If ObjFactura.FechaEjecucion = TxtFechaEjecucion.Text.Trim.ToDate - ObjFactura.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero - ObjFactura.CveSubProyectoCobranza = DdlSubProyectoCobranza.SelectedValue.ToEntero - ObjFactura.CveSubProyectoEjecucion = DdlSubProyectoEjecucion.SelectedValue.ToEntero + ObjFactura.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero() + ObjFactura.CveSubProyectoCobranza = DdlSubProyectoCobranza.SelectedValue.ToEntero() + ObjFactura.CveSubProyectoEjecucion = DdlSubProyectoEjecucion.SelectedValue.ToEntero() ObjFactura.AtencionA = If(ObjFactura.TipoDocto = "Cot" Or (ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso LblRFC.Text = "XAXX010101000"), TxtAtencionA.Text, "-1") ObjFactura.MotivoDescuento = TxtMotivoDescuento.Text.Trim ObjFactura.Observaciones = TxtObsFact.Text.Trim @@ -8006,26 +8007,26 @@ Partial Class Ventas If (ObjFactura.CveMoneda = 2 AndAlso ObjFactura.ConvertirPesos = True AndAlso ObjFactura.TipodeComprobante = "Ingresos" AndAlso RemisionesLista.Count > 0) Then Dim TotalCalculableImpuestos, TotalCalculableImpuestosIVA As Decimal For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * ObjFactura.TipoCambio, 6) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDecimal * ObjFactura.TipoCambio, 6) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble * ObjFactura.TipoCambio, NumeroDecimales) - TotalCalculableImpuestos = (Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal) - Row("Descuento").ToString.ToDecimal - TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString.ToDecimal) + TotalCalculableImpuestos = (Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal) - Row("Descuento").ToString().ToDecimal + TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString().ToDecimal) Row("IVA") = Row("PorcentajeIVA") - Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA, NumeroDecimales) Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales) Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("PorcentajeIEPS").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales) Row("IEPS") = Row("ImporteIEPS") - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) Next Dim ImpuestosLocales As Double = 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.TipoCambio).FormatoNumero - If gvr.DataKey("TipoImpuesto").ToString = "5" Then + If gvr.DataKey("TipoImpuesto").ToString() = "5" Then ImpuestosLocales -= Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) Else ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) @@ -8052,14 +8053,14 @@ Partial Class Ventas ElseIf (ObjFactura.CveMoneda = 1 AndAlso ObjFactura.ConvertirDolares = True AndAlso ObjFactura.TipodeComprobante = "Ingresos" AndAlso RemisionesLista.Count > 0) Then For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDouble / ObjFactura.TipoCambioDolares, 6) - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDouble / ObjFactura.TipoCambioDolares, 6) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) Next Dim ImpuestosLocales As Double = 0 @@ -8089,19 +8090,19 @@ Partial Class Ventas Dim TotalCalculableImpuestos, TotalCalculableImpuestosIVA As Decimal For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * ObjFactura.TipoCambio, 6) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDecimal * ObjFactura.TipoCambio, 6) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble * ObjFactura.TipoCambio, NumeroDecimales) - TotalCalculableImpuestos = (Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal) - Row("Descuento").ToString.ToDecimal - TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString.ToDecimal) + TotalCalculableImpuestos = (Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal) - Row("Descuento").ToString().ToDecimal + TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString().ToDecimal) Row("IVA") = Row("PorcentajeIVA") - Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA, NumeroDecimales) Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales) Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("PorcentajeIEPS").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales) Row("IEPS") = Row("ImporteIEPS") - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) Next Dim ImpuestosLocales As Double = 0 @@ -8129,14 +8130,14 @@ Partial Class Ventas 'CONVERTIR REMISION - TIPO MONEDA -PESOS A DOLARES REGISTRO DIRECTO SIN VENTA ElseIf (EditoRemision = False AndAlso ObjFactura.CveMoneda = 1 AndAlso ObjFactura.ConvertirDolares = True) Then For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDouble / ObjFactura.TipoCambioDolares, 6) - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDouble / ObjFactura.TipoCambioDolares, 6) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble / ObjFactura.TipoCambioDolares, NumeroDecimales) Next Dim ImpuestosLocales As Double = 0 @@ -8186,7 +8187,7 @@ Partial Class Ventas For Each li As ListItem In LstFordASN.Items SB.AppendFormat("{0}, ", li.Text) Next - ObjFactura.FordASN = SB.ToString + ObjFactura.FordASN = SB.ToString() End If If TmpDTImpuestos Is Nothing Then CreaDTImpuestos() @@ -8219,7 +8220,7 @@ Partial Class Ventas If gvr.RowType = DataControlRowType.DataRow Then Dim Orden As Integer = 80 If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble > 0 Then - DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString.ToEntero : TmpDTImpuestosVista.Rows.Add(DR) + DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString() : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString() : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString() : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString().ToEntero() : TmpDTImpuestosVista.Rows.Add(DR) DR = TmpDTImpuestosVista.NewRow() Orden = Orden + 1 End If @@ -8254,30 +8255,30 @@ Partial Class Ventas End Try If DrIVA IsNot Nothing Then - DrIVA("Importe") = DrIVA("Importe").ToString.ToDouble + DrImpuestos33("ImporteIVA").ToString.ToDouble + DrIVA("Importe") = DrIVA("Importe").ToString().ToDouble + DrImpuestos33("ImporteIVA").ToString().ToDouble TmpDTImpuestosIVAIEPS.AcceptChanges() Else Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() - If DrImpuestos33("PorcentajeIVA").ToString.ToDecimal > 0 Then - DR2("Impuesto") = "IVA" : DR2("tasa") = DdlIVA.SelectedItem.ToString : DR2("Importe") = DrImpuestos33("ImporteIVA").ToString.ToDecimal : DR2("Orden") = "1" + If DrImpuestos33("PorcentajeIVA").ToString().ToDecimal > 0 Then + DR2("Impuesto") = "IVA" : DR2("tasa") = DdlIVA.SelectedItem.ToString() : DR2("Importe") = DrImpuestos33("ImporteIVA").ToString().ToDecimal : DR2("Orden") = "1" TmpDTImpuestosIVAIEPS.Rows.Add(DR2) TmpDTImpuestosIVAIEPS.AcceptChanges() End If End If Try - DrIEPS = TmpDTImpuestosIVAIEPS.Select($"Impuesto = 'IEPS' AND tasa = '{DrImpuestos33("PorcentajeIEPS").ToString.ToDecimal * 100} %'")(0) + DrIEPS = TmpDTImpuestosIVAIEPS.Select($"Impuesto = 'IEPS' AND tasa = '{DrImpuestos33("PorcentajeIEPS").ToString().ToDecimal * 100} %'")(0) Catch ex As Exception DrIEPS = Nothing End Try If DrIEPS IsNot Nothing Then - DrIEPS("Importe") = DrIEPS("Importe").ToString.ToDouble + DrImpuestos33("ImporteIEPS").ToString.ToDouble + DrIEPS("Importe") = DrIEPS("Importe").ToString().ToDouble + DrImpuestos33("ImporteIEPS").ToString().ToDouble TmpDTImpuestosIVAIEPS.AcceptChanges() Else Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() - If DrImpuestos33("PorcentajeIEPS").ToString.ToDouble > 0 Then - DR2("Impuesto") = "IEPS" : DR2("tasa") = String.Format("{0} {1}", DrImpuestos33("PorcentajeIEPS").ToString.ToDouble * 100, "%") : DR2("Importe") = DrImpuestos33("ImporteIEPS").ToString.ToDouble : DR2("Orden") = If(DrImpuestos33("PorcentajeIEPS").ToString = "0.03", "2", If(DrImpuestos33("PorcentajeIEPS").ToString = "0.06", "3", If(DrImpuestos33("PorcentajeIEPS").ToString = "0.07", "4", If(DrImpuestos33("PorcentajeIEPS").ToString = "0.09", "5", "0")))) + If DrImpuestos33("PorcentajeIEPS").ToString().ToDouble > 0 Then + DR2("Impuesto") = "IEPS" : DR2("tasa") = String.Format("{0} {1}", DrImpuestos33("PorcentajeIEPS").ToString().ToDouble * 100, "%") : DR2("Importe") = DrImpuestos33("ImporteIEPS").ToString().ToDouble : DR2("Orden") = If(DrImpuestos33("PorcentajeIEPS").ToString() = "0.03", "2", If(DrImpuestos33("PorcentajeIEPS").ToString() = "0.06", "3", If(DrImpuestos33("PorcentajeIEPS").ToString() = "0.07", "4", If(DrImpuestos33("PorcentajeIEPS").ToString() = "0.09", "5", "0")))) TmpDTImpuestosIVAIEPS.Rows.Add(DR2) TmpDTImpuestosIVAIEPS.AcceptChanges() End If @@ -8292,7 +8293,7 @@ Partial Class Ventas ObjFactura.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim ObjFactura.Det_ContraRecibo = TxtDet_ContraRecibo.Text.Trim - ObjFactura.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero + ObjFactura.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero() If ObjFactura.CveMoneda <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then ObjFactura.TipoCambio = 1 @@ -8324,7 +8325,7 @@ Partial Class Ventas ObjFactura.SetCliente() 'SUCURSAL - 'ObjFactura.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero + 'ObjFactura.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero() ObjFactura.SetSubProyectoMatriz(Me) ObjFactura.SetSubProyecto(Me) ObjFactura.ClienteSucursal = New Modelos.SucursalModel @@ -8338,36 +8339,36 @@ Partial Class Ventas ObjFactura.ClienteSucursal.Estado = LblEstado.Text ObjFactura.ClienteSucursal.CP = LblCP.Text ObjFactura.ClienteSucursal.Pais = CliPais - ObjFactura.ClienteSucursal.CorreoSucursal = CliCorreoCot.ToString + ObjFactura.ClienteSucursal.CorreoSucursal = CliCorreoCot.ToString() ObjFactura.ClienteSucursal.TelefonoSucursal = LblTelefono.Text - ObjFactura.ClienteSucursal.Sucursal = If(DdlSucursalCliente.SelectedValue.ToEntero > 0, DdlSucursalCliente.SelectedItem.Text, "") - ObjFactura.ClienteSucursal.ImprimeNombreSucursal = ImprimeNombreSucursal.ToString + ObjFactura.ClienteSucursal.Sucursal = If(DdlSucursalCliente.SelectedValue.ToEntero() > 0, DdlSucursalCliente.SelectedItem.Text, "") + ObjFactura.ClienteSucursal.ImprimeNombreSucursal = ImprimeNombreSucursal.ToString() End If 'ENVIO DIRECCION ObjFactura.EnviarA = New Modelos.EnviarAModel If ChkDireccionEnvio.Checked Then - If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero)).Rows.Count > 0 Then - For Each Row As DataRow In TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero)).Rows - ObjFactura.EnviarA.CveDireccionEnvio = Row("CveDireccionEnvio").ToString.ToEntero - ObjFactura.EnviarA.EnvioDireccion = Row("EnvioDireccion").ToString - ObjFactura.EnviarA.EnvioNoExt = Row("EnvioNoExt").ToString - ObjFactura.EnviarA.EnvioNoInt = Row("EnvioNoInt").ToString - ObjFactura.EnviarA.EnvioColonia = Row("EnvioColonia").ToString - ObjFactura.EnviarA.EnvioCiudad = Row("EnvioCiudad").ToString - ObjFactura.EnviarA.EnvioEstado = Row("EnvioEstado").ToString - ObjFactura.EnviarA.EnvioCP = Row("EnvioCP").ToString - ObjFactura.EnviarA.EnvioTel = Row("EnvioTel").ToString - ObjFactura.EnviarA.EnvioContacto = Row("EnvioContacto").ToString - ObjFactura.EnviarA.EnvioDepartamento = Row("EnvioDepartamento").ToString - 'ObjFactura.EnviarA.EnvioPedidoContrato = Row("EnvioPedidoContrato").ToString + If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then + For Each Row As DataRow In TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows + ObjFactura.EnviarA.CveDireccionEnvio = Row("CveDireccionEnvio").ToString().ToEntero() + ObjFactura.EnviarA.EnvioDireccion = Row("EnvioDireccion").ToString() + ObjFactura.EnviarA.EnvioNoExt = Row("EnvioNoExt").ToString() + ObjFactura.EnviarA.EnvioNoInt = Row("EnvioNoInt").ToString() + ObjFactura.EnviarA.EnvioColonia = Row("EnvioColonia").ToString() + ObjFactura.EnviarA.EnvioCiudad = Row("EnvioCiudad").ToString() + ObjFactura.EnviarA.EnvioEstado = Row("EnvioEstado").ToString() + ObjFactura.EnviarA.EnvioCP = Row("EnvioCP").ToString() + ObjFactura.EnviarA.EnvioTel = Row("EnvioTel").ToString() + ObjFactura.EnviarA.EnvioContacto = Row("EnvioContacto").ToString() + ObjFactura.EnviarA.EnvioDepartamento = Row("EnvioDepartamento").ToString() + 'ObjFactura.EnviarA.EnvioPedidoContrato = Row("EnvioPedidoContrato").ToString() Next End If End If 'Amortizacion - ObjFactura.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero + ObjFactura.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero() If ObjFactura.CveTipoRelacion > 0 Then Select Case ObjFactura.CveTipoRelacion Case 7 @@ -8379,7 +8380,7 @@ Partial Class Ventas End If ObjFactura.AplicaDevolucion = Me.AplicaDevolucion - ObjFactura.CveTipoAmortizacionAnticipo = DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero + ObjFactura.CveTipoAmortizacionAnticipo = DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() ObjFactura.Timbre.Comprobante.TipoComprobante = If(ObjFactura.TipoDocto.Contiene("Ing", "Ant"), "I", If(ObjFactura.TipoDocto.Contiene("Egs", "Dev"), "E", "")) If ObjFactura.Timbre.Comprobante.TipoComprobante = "E" Then @@ -8392,7 +8393,7 @@ Partial Class Ventas ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "03" ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" End If - ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero + ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero() If HdnFolioFiscalNC.Value <> "0" And HdnFolioFiscalNC.Value <> "" Then ObjFactura.Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value) End If ' cuando es refacturacoin es cfdirelacionado, con relacion 04 @@ -8404,11 +8405,11 @@ Partial Class Ventas If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso NuevaFactura = 1 Then ' refacturación - ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero + ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero() End If - If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso DdlTipoRelacionAnticipo.SelectedValue.ToEntero > 0 Then ' refacturación - ObjFactura.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero + If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso DdlTipoRelacionAnticipo.SelectedValue.ToEntero() > 0 Then ' refacturación + ObjFactura.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero() If GVAnticipos.Rows.Count > 0 Then 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 @@ -8430,12 +8431,12 @@ Partial Class Ventas If TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.FiltraParametros("TipoImpuesto = 1").Rows.Count > 0 Then For Each DrImpuestosLocales As DataRow In TmpDTImpuestos.FiltraParametros("TipoImpuesto = 1").Rows - If DrImpuestosLocales("Importe").ToString.ToDecimal > 0 Then + If DrImpuestosLocales("Importe").ToString().ToDecimal > 0 Then Dim ret As New CFDIRetencionesLocales With { - .TasaRetencion = DrImpuestosLocales("Porcentaje").ToString.ToDecimal, - .ImpuestoLocalRetenido = DrImpuestosLocales("ImpuestoLocal").ToString, - .Importe = DrImpuestosLocales("Importe").ToString.ToDecimal(If(ObjFactura.ConvertirPesos, ObjFactura.TipoCambio, 1)).RoundSQL(2) + .TasaRetencion = DrImpuestosLocales("Porcentaje").ToString().ToDecimal, + .ImpuestoLocalRetenido = DrImpuestosLocales("ImpuestoLocal").ToString(), + .Importe = DrImpuestosLocales("Importe").ToString().ToDecimal(If(ObjFactura.ConvertirPesos, ObjFactura.TipoCambio, 1)).RoundSQL(2) } ObjFactura.Timbre.RetencionesLocales.Add(ret) End If @@ -8445,34 +8446,34 @@ Partial Class Ventas If TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.FiltraParametros("TipoImpuesto = 5").Rows.Count > 0 Then For Each DrImpuestosLocales As DataRow In TmpDTImpuestos.FiltraParametros("TipoImpuesto = 5").Rows - If DrImpuestosLocales("Importe").ToString.ToDecimal > 0 Then - Dim ret As New CFDITrasladosLocales With {.TasaTraslado = DrImpuestosLocales("Porcentaje").ToString.ToDecimal, .ImpuestoLocalTraslado = DrImpuestosLocales("ImpuestoLocal").ToString, .Importe = DrImpuestosLocales("Importe").ToString.ToDecimal(If(ObjFactura.ConvertirPesos, ObjFactura.TipoCambio, 1))} + If DrImpuestosLocales("Importe").ToString().ToDecimal > 0 Then + Dim ret As New CFDITrasladosLocales With {.TasaTraslado = DrImpuestosLocales("Porcentaje").ToString().ToDecimal, .ImpuestoLocalTraslado = DrImpuestosLocales("ImpuestoLocal").ToString(), .Importe = DrImpuestosLocales("Importe").ToString().ToDecimal(If(ObjFactura.ConvertirPesos, ObjFactura.TipoCambio, 1))} ObjFactura.Timbre.TrasladosLocales.Add(ret) End If Next End If 'INE COMPLEMENTO - If RblComplementos.SelectedValue.ToEntero > 0 Then - ObjFactura.CveComplementoTimbrado = RblComplementos.SelectedValue.ToEntero + If RblComplementos.SelectedValue.ToEntero() > 0 Then + ObjFactura.CveComplementoTimbrado = RblComplementos.SelectedValue.ToEntero() Dim INE As New Modelos.ComplementoINE - Select Case RblComplementos.SelectedValue.ToEntero + Select Case RblComplementos.SelectedValue.ToEntero() Case 5 - INE.INEIdContabilidad = TxtIdConta.Text.ToEntero + INE.INEIdContabilidad = TxtIdConta.Text.ToEntero() INE.INETipoProceso = "Ordinario" INE.INETipoComite = "Directivo Estatal" INE.INEEntidad = DdlINEEntidad.SelectedValue Case 6 - INE.INEIdContabilidad = TxtIdConta.Text.ToEntero + INE.INEIdContabilidad = TxtIdConta.Text.ToEntero() INE.INETipoProceso = "Ordinario" INE.INETipoComite = "Ejecutivo Estatal" INE.INEEntidad = DdlINEEntidad.SelectedValue Case 7 - INE.INEIdContabilidad = TxtIdConta.Text.ToEntero + INE.INEIdContabilidad = TxtIdConta.Text.ToEntero() INE.INETipoProceso = "Ordinario" INE.INETipoComite = "Ejecutivo Nacional" Case 8 - INE.INEIdContabilidad = TxtIdConta.Text.ToEntero + INE.INEIdContabilidad = TxtIdConta.Text.ToEntero() INE.INETipoProceso = DdlTipoCampaña.SelectedValue INE.INETipoComite = DdlAmbitoComplemento.SelectedValue INE.INEEntidad = DdlINEEntidad.SelectedValue @@ -8495,21 +8496,21 @@ Partial Class Ventas ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario ObjFacturaDevolucion.CveEmpresa = UsuarioActual.CveEmpresa - ObjFacturaDevolucion.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal) + ObjFacturaDevolucion.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal) ObjFacturaDevolucion.ConvertirPesos = ChkConvertirDoctoPesos.Checked - ObjFacturaDevolucion.CveMoneda = DdlMoneda.SelectedValue.ToEntero + ObjFacturaDevolucion.CveMoneda = DdlMoneda.SelectedValue.ToEntero() ObjFacturaDevolucion.Moneda = DdlMoneda.SelectedItem.Text ObjFacturaDevolucion.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {DdlMoneda.SelectedValue}") 'ObjFacturaDevolucion.RefDocto = TxtDocto.Text.Trim - 'ObjFacturaDevolucion.Folio = If(ExFolioFactura, FolioXML.ToEntero, -1) + 'ObjFacturaDevolucion.Folio = If(ExFolioFactura, FolioXML.ToEntero(), -1) ObjFacturaDevolucion.Serie = LblSerie.Text ObjFacturaDevolucion.Fecha = New Date(TxtFecha.Text.Trim.ToDate.Year, TxtFecha.Text.Trim.ToDate.Month, TxtFecha.Text.Trim.ToDate.Day, Now.Hour, Now.Minute, Now.Second) ObjFacturaDevolucion.CvePrePoliza = -1 - ObjFacturaDevolucion.CveMetodoPago = 0 'DdlMetodoPago.SelectedValue.ToEntero + ObjFacturaDevolucion.CveMetodoPago = 0 'DdlMetodoPago.SelectedValue.ToEntero() ObjFacturaDevolucion.MetodoPago = "" 'DdlMetodoPago.SelectedItem.Text ObjFacturaDevolucion.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") ObjFacturaDevolucion.UsuarioCreo = LblUsuario.Text.Trim - ObjFacturaDevolucion.CveCondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedValue.ToEntero, -1) + ObjFacturaDevolucion.CveCondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedValue.ToEntero(), -1) ObjFacturaDevolucion.CondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedItem.Text, "") 'ObjFacturaDevolucion.NumeroCuenta = TxtNumCtaPago.Text.Trim 'ObjFacturaDevolucion.Cliente.NumCtaPago = TxtNumCtaPago.Text.Trim @@ -8529,19 +8530,19 @@ Partial Class Ventas DdlMetodoPago33.SelectedValueExist("1") DdlFormaPago33.SelectedValueExist("20") - ObjFacturaDevolucion.SerieFolioPadre = HdnFolioFiscalNC.Value.ToString + ObjFacturaDevolucion.SerieFolioPadre = HdnFolioFiscalNC.Value.ToString() ObjFacturaDevolucion.Version = "3.3" - ObjFacturaDevolucion.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero - ObjFacturaDevolucion.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero > 0, DdlMetodoPago33.SelectedItem.Text, "") + ObjFacturaDevolucion.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero() + ObjFacturaDevolucion.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero() > 0, DdlMetodoPago33.SelectedItem.Text, "") ObjFacturaDevolucion.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") - ObjFacturaDevolucion.CveFormaPago33 = DdlFormaPago33.SelectedValue.ToEntero - ObjFacturaDevolucion.FormaPago33 = If(DdlFormaPago33.SelectedValue.ToEntero > 0, DdlFormaPago33.SelectedItem.Text, "") + ObjFacturaDevolucion.CveFormaPago33 = DdlFormaPago33.SelectedValue.ToEntero() + ObjFacturaDevolucion.FormaPago33 = If(DdlFormaPago33.SelectedValue.ToEntero() > 0, DdlFormaPago33.SelectedItem.Text, "") ObjFacturaDevolucion.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {DdlFormaPago33.SelectedValue}") - ObjFacturaDevolucion.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero - ObjFacturaDevolucion.UsoCFDI = If(DdlUsoCFDI.SelectedValue.ToEntero > 0, DdlUsoCFDI.SelectedItem.Text, "") + ObjFacturaDevolucion.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero() + ObjFacturaDevolucion.UsoCFDI = If(DdlUsoCFDI.SelectedValue.ToEntero() > 0, DdlUsoCFDI.SelectedItem.Text, "") ObjFacturaDevolucion.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") DdlUsoCFDI.SelectedValueExist(CveUsoCFDIOld) @@ -8568,7 +8569,7 @@ Partial Class Ventas ViewState("TipoDoctoDevolucion") = ObjFacturaDevolucion.TipoDocto End If - ObjFacturaDevolucion.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero + ObjFacturaDevolucion.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero() ObjFacturaDevolucion.Fech1 = TxtFech1.Text.Trim.ToDate ObjFacturaDevolucion.Fech2 = TxtFech2.Text.Trim.ToDate ObjFacturaDevolucion.Fech3 = TxtFech3.Text.Trim.ToDate @@ -8585,22 +8586,22 @@ Partial Class Ventas ObjFacturaDevolucion.NumeroPersonas = 0 ObjFacturaDevolucion.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto) ObjFacturaDevolucion.DescripcionContrato = If(DdlContratosModal.SelectedItem IsNot Nothing, DdlContratosModal.SelectedItem.Text, "") - ObjFacturaDevolucion.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero + ObjFacturaDevolucion.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero() ObjFacturaDevolucion.Entrega = Entrega ObjFacturaDevolucion.Vigencia = TxtFechaVencimientoCotizacion.Text.ToDate ObjFacturaDevolucion.CveVentaPadre = If(CveDevolucion > 0, CveDevolucion, CvePedido) - ObjFacturaDevolucion.CveVendedor = DdlVendedor.SelectedValue.ToEntero - If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then + ObjFacturaDevolucion.CveVendedor = DdlVendedor.SelectedValue.ToEntero() + If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False End If ObjFacturaDevolucion.FechaEjecucion = TxtFechaEjecucion.Text.Trim.ToDate - 'ObjFacturaDevolucion.CveSucursalEjecucion = DdlSucursalEjecucion.SelectedValue.ToEntero - 'ObjFacturaDevolucion.CveSucursalCobranza = DdlSucursalCobranza.SelectedValue.ToEntero - ObjFacturaDevolucion.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero - ObjFacturaDevolucion.CveSubProyectoCobranza = DdlSubProyectoCobranza.SelectedValue.ToEntero - ObjFacturaDevolucion.CveSubProyectoEjecucion = DdlSubProyectoEjecucion.SelectedValue.ToEntero + 'ObjFacturaDevolucion.CveSucursalEjecucion = DdlSucursalEjecucion.SelectedValue.ToEntero() + 'ObjFacturaDevolucion.CveSucursalCobranza = DdlSucursalCobranza.SelectedValue.ToEntero() + ObjFacturaDevolucion.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero() + ObjFacturaDevolucion.CveSubProyectoCobranza = DdlSubProyectoCobranza.SelectedValue.ToEntero() + ObjFacturaDevolucion.CveSubProyectoEjecucion = DdlSubProyectoEjecucion.SelectedValue.ToEntero() ObjFacturaDevolucion.AtencionA = If(ObjFacturaDevolucion.TipoDocto = "Cot" Or (ObjFacturaDevolucion.TipoDocto.Contiene("Ing", "Rem") AndAlso LblRFC.Text = "XAXX010101000"), TxtAtencionA.Text, "-1") ObjFacturaDevolucion.MotivoDescuento = TxtMotivoDescuento.Text.Trim ObjFacturaDevolucion.Observaciones = TxtObsFact.Text.Trim @@ -8645,7 +8646,7 @@ Partial Class Ventas If gvr.RowType = DataControlRowType.DataRow Then Dim Orden As Integer = 80 If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble > 0 Then - DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString.ToEntero : TmpDTImpuestosVista.Rows.Add(DR) + DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString() : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString() : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString() : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString().ToEntero() : TmpDTImpuestosVista.Rows.Add(DR) DR = TmpDTImpuestosVista.NewRow() Orden = Orden + 1 End If @@ -8671,30 +8672,30 @@ Partial Class Ventas End Try If DrIVA IsNot Nothing Then - DrIVA("Importe") = DrIVA("Importe").ToString.ToDouble + DrImpuestos33("ImporteIVA").ToString.ToDouble + DrIVA("Importe") = DrIVA("Importe").ToString().ToDouble + DrImpuestos33("ImporteIVA").ToString().ToDouble TmpDTImpuestosIVAIEPS.AcceptChanges() Else Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() - If DrImpuestos33("PorcentajeIVA").ToString.ToDouble >= 0 Then - DR2("Impuesto") = "IVA" : DR2("tasa") = "16 %" : DR2("Importe") = DrImpuestos33("ImporteIVA").ToString.ToDouble : DR2("Orden") = "1" + If DrImpuestos33("PorcentajeIVA").ToString().ToDouble >= 0 Then + DR2("Impuesto") = "IVA" : DR2("tasa") = "16 %" : DR2("Importe") = DrImpuestos33("ImporteIVA").ToString().ToDouble : DR2("Orden") = "1" TmpDTImpuestosIVAIEPS.Rows.Add(DR2) TmpDTImpuestosIVAIEPS.AcceptChanges() End If End If Try - DrIEPS = TmpDTImpuestosIVAIEPS.Select($"Impuesto = 'IEPS' AND tasa = '{DrImpuestos33("PorcentajeIEPS").ToString.ToDouble * 100} %'")(0) + DrIEPS = TmpDTImpuestosIVAIEPS.Select($"Impuesto = 'IEPS' AND tasa = '{DrImpuestos33("PorcentajeIEPS").ToString().ToDouble * 100} %'")(0) Catch ex As Exception DrIEPS = Nothing End Try If DrIEPS IsNot Nothing Then - DrIEPS("Importe") = DrIEPS("Importe").ToString.ToDouble + DrImpuestos33("ImporteIEPS").ToString.ToDouble + DrIEPS("Importe") = DrIEPS("Importe").ToString().ToDouble + DrImpuestos33("ImporteIEPS").ToString().ToDouble TmpDTImpuestosIVAIEPS.AcceptChanges() Else Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() - If DrImpuestos33("PorcentajeIEPS").ToString.ToDouble > 0 Then - DR2("Impuesto") = "IEPS" : DR2("tasa") = String.Format("{0} {1}", DrImpuestos33("PorcentajeIEPS").ToString.ToDouble * 100, "%") : DR2("Importe") = DrImpuestos33("ImporteIEPS").ToString.ToDouble : DR2("Orden") = If(DrImpuestos33("PorcentajeIEPS").ToString = "0.03", "2", If(DrImpuestos33("PorcentajeIEPS").ToString = "0.06", "3", If(DrImpuestos33("PorcentajeIEPS").ToString = "0.07", "4", If(DrImpuestos33("PorcentajeIEPS").ToString = "0.09", "5", "")))) + If DrImpuestos33("PorcentajeIEPS").ToString().ToDouble > 0 Then + DR2("Impuesto") = "IEPS" : DR2("tasa") = String.Format("{0} {1}", DrImpuestos33("PorcentajeIEPS").ToString().ToDouble * 100, "%") : DR2("Importe") = DrImpuestos33("ImporteIEPS").ToString().ToDouble : DR2("Orden") = If(DrImpuestos33("PorcentajeIEPS").ToString() = "0.03", "2", If(DrImpuestos33("PorcentajeIEPS").ToString() = "0.06", "3", If(DrImpuestos33("PorcentajeIEPS").ToString() = "0.07", "4", If(DrImpuestos33("PorcentajeIEPS").ToString() = "0.09", "5", "")))) TmpDTImpuestosIVAIEPS.Rows.Add(DR2) TmpDTImpuestosIVAIEPS.AcceptChanges() End If @@ -8708,7 +8709,7 @@ Partial Class Ventas ObjFacturaDevolucion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim ObjFacturaDevolucion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim - ObjFacturaDevolucion.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero + ObjFacturaDevolucion.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero() If ObjFacturaDevolucion.CveMoneda <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then ObjFacturaDevolucion.TipoCambio = 1 @@ -8724,7 +8725,7 @@ Partial Class Ventas ObjFacturaDevolucion.SetCliente() 'SUCURSAL - ObjFacturaDevolucion.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero + ObjFacturaDevolucion.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero() ObjFacturaDevolucion.SetSubProyectoMatriz(Me) ObjFacturaDevolucion.SetSubProyecto(Me) ObjFacturaDevolucion.ClienteSucursal = New Modelos.SucursalModel @@ -8737,21 +8738,21 @@ Partial Class Ventas ObjFacturaDevolucion.ClienteSucursal.Estado = LblEstado.Text ObjFacturaDevolucion.ClienteSucursal.CP = LblCP.Text ObjFacturaDevolucion.ClienteSucursal.Pais = CliPais - ObjFacturaDevolucion.ClienteSucursal.CorreoSucursal = CliCorreoCot.ToString + ObjFacturaDevolucion.ClienteSucursal.CorreoSucursal = CliCorreoCot.ToString() ObjFacturaDevolucion.ClienteSucursal.TelefonoSucursal = LblTelefono.Text - ObjFacturaDevolucion.ClienteSucursal.Sucursal = If(DdlSucursalCliente.SelectedValue.ToEntero > 0, DdlSucursalCliente.SelectedItem.Text, "") + ObjFacturaDevolucion.ClienteSucursal.Sucursal = If(DdlSucursalCliente.SelectedValue.ToEntero() > 0, DdlSucursalCliente.SelectedItem.Text, "") 'ENVIO DIRECCION ObjFacturaDevolucion.EnviarA = New Modelos.EnviarAModel If ChkDireccionEnvio.Checked Then - If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero)).Rows.Count > 0 Then - For Each Row As DataRow In TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero)).Rows - ObjFacturaDevolucion.EnviarA.CveDireccionEnvio = Row("CveDireccionEnvio").ToString.ToEntero - ObjFacturaDevolucion.EnviarA.EnvioDireccion = Row("EnvioDireccion").ToString - ObjFacturaDevolucion.EnviarA.EnvioColonia = Row("EnvioColonia").ToString - ObjFacturaDevolucion.EnviarA.EnvioCiudad = Row("EnvioCiudad").ToString - ObjFacturaDevolucion.EnviarA.EnvioEstado = Row("EnvioEstado").ToString - ObjFacturaDevolucion.EnviarA.EnvioCP = Row("EnvioCP").ToString + If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then + For Each Row As DataRow In TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows + ObjFacturaDevolucion.EnviarA.CveDireccionEnvio = Row("CveDireccionEnvio").ToString().ToEntero() + ObjFacturaDevolucion.EnviarA.EnvioDireccion = Row("EnvioDireccion").ToString() + ObjFacturaDevolucion.EnviarA.EnvioColonia = Row("EnvioColonia").ToString() + ObjFacturaDevolucion.EnviarA.EnvioCiudad = Row("EnvioCiudad").ToString() + ObjFacturaDevolucion.EnviarA.EnvioEstado = Row("EnvioEstado").ToString() + ObjFacturaDevolucion.EnviarA.EnvioCP = Row("EnvioCP").ToString() Next End If End If @@ -8762,7 +8763,7 @@ Partial Class Ventas Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre Dim Timbre As New CFDITimbre Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) - Timbre.Comprobante.Folio = Obj.Folio.ToString + Timbre.Comprobante.Folio = Obj.Folio.ToString() Timbre.Comprobante.Serie = Obj.Serie Timbre.Comprobante.Fecha = Obj.FechaCP Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 @@ -8771,7 +8772,7 @@ Partial Class Ventas Timbre.Comprobante.Subtotal = Obj.SubTotal Timbre.Comprobante.Descuentos = Obj.Descuento Timbre.Comprobante.Moneda = Obj.MonedaSAT - Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) + Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString()) Timbre.Comprobante.Total = Obj.Total 'Try @@ -8794,7 +8795,7 @@ Partial Class Ventas Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI - If HdnTipoDescuento.Value = "3" And DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero > 0 Then + If HdnTipoDescuento.Value = "3" And DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() > 0 Then Timbre.CFDIRelacionados.TipoRelacion = "07" Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo" @@ -8819,7 +8820,7 @@ Partial Class Ventas Else 'SI LA FACTURA VIENE DE SER CANCELADA SISTEMA CUANDO SE REFACTURO NO HAY QUE RELACIONAR - If (CveEstatusFacturaPadre > 0 AndAlso CveEstatusFacturaPadre <> 4) OrElse (DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0) OrElse HdnFolioFiscalNC.Value.ToString <> "" Then + If (CveEstatusFacturaPadre > 0 AndAlso CveEstatusFacturaPadre <> 4) OrElse (DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0) OrElse HdnFolioFiscalNC.Value.ToString() <> "" Then If Obj.CveTipoRelacion > 0 Then Select Case Obj.CveTipoRelacion @@ -8848,7 +8849,7 @@ Partial Class Ventas If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then For Each Dr As DataRow In DtVentasNC.Rows - Timbre.CFDIRelacionados.UUID.Add(Dr("FolioFiscal").ToString) + Timbre.CFDIRelacionados.UUID.Add(Dr("FolioFiscal").ToString()) Next Else If Not String.IsNullOrEmpty(HdnFolioFiscalNC.Value.Trim()) Then @@ -8875,10 +8876,10 @@ Partial Class Ventas Dim tPS As String = "" For Each drr As DataRow In Obj.DtDetalle.Rows - If drr("PS").ToString.Length = 1 Then - tPS = drr("Obs").ToString + If drr("PS").ToString().Length = 1 Then + tPS = drr("Obs").ToString() Else - If drr("PS").ToString.Length = 0 Then + If drr("PS").ToString().Length = 0 Then tPS = "" Else tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) @@ -8887,17 +8888,17 @@ Partial Class Ventas 'condicionante, especial If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" ' les comentan que no debe de ir la etiqueta de "unidad" en el producto - Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal, + Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString().ToDecimal, .Descripcion = tPS, - .ValorUnitario = drr("PU").ToString.ToDecimal, - .Importe = drr("TotalImporte").ToString.ToDecimal, - .Descuento = drr("Descuento").ToString.ToDecimal.RoundSQL(2), - .Unidad = drr("UM").ToString, - .ClaveUnidad = drr("SATClaveUM").ToString, - .ClaveProdServ = drr("SATClaveProdServ").ToString, - .Noidentificacion = drr("Noidentificacion").ToString, - .CuentaPredial = drr("CuentaPredial").ToString, - .ImporteGravaIVAAdicional = drr("ImporteIEPS").ToString.ToDecimal} + .ValorUnitario = drr("PU").ToString().ToDecimal, + .Importe = drr("TotalImporte").ToString().ToDecimal, + .Descuento = drr("Descuento").ToString().ToDecimal.RoundSQL(2), + .Unidad = drr("UM").ToString(), + .ClaveUnidad = drr("SATClaveUM").ToString(), + .ClaveProdServ = drr("SATClaveProdServ").ToString(), + .Noidentificacion = drr("Noidentificacion").ToString(), + .CuentaPredial = drr("CuentaPredial").ToString(), + .ImporteGravaIVAAdicional = drr("ImporteIEPS").ToString().ToDecimal} 'verifica suma subtotales If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales concepto.Importe = totSubTotal @@ -8905,58 +8906,58 @@ Partial Class Ventas totSubTotal = totSubTotal - concepto.Importe 'siempre estaremos agregando el iva, auqnue sea en importe cero o tasa cero, para que se emita la factura - ' If drr("ImporteIVA").ToString.ToDouble > 0 Then + ' If drr("ImporteIVA").ToString().ToDouble > 0 Then 'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos, y si la BASE de calculo es mayor a cero If Timbre.Comprobante.Total > 0 AndAlso concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional > 0 Then - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional, .TasaOCuota = drr("PorcentajeIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString().ToDecimal}) End If - If drr("ImporteIEPS").ToString.ToDouble > 0 Then - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal}) + If drr("ImporteIEPS").ToString().ToDouble > 0 Then + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString().ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString().ToDecimal}) End If - If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal}) + If drr("ImporteRetIVA").ToString().ToDouble > 0 Then 'si hay retenciones + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString().ToDecimal}) End If - If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetISR").ToString.ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal}) + If drr("ImporteRetISR").ToString().ToDouble > 0 Then 'retención de ISR + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetISR").ToString().ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString().ToDecimal}) End If Timbre.Conceptos.Add(concepto) i += 1 Next - Dim AplicaComercioExteriorSubProyecto As Boolean = If(GlobalDTSubProyectos(-1, Obj.CveSubProyecto)(0)("AplicaComercioExterior").ToString = "True", True, False) + Dim AplicaComercioExteriorSubProyecto As Boolean = If(GlobalDTSubProyectos(-1, Obj.CveSubProyecto)(0)("AplicaComercioExterior").ToString() = "True", True, False) Timbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto = AplicaComercioExteriorSubProyecto If Obj.Cliente.AplicaComercioExterior And AplicaComercioExteriorSubProyecto Then 'DATOS GENERALES - Timbre.Complementos.ComercioExterior11.TipoOperacion = GlobalDTTipoOperacion().FiltraParametros($"CveTipoOperacion={CveTipoOperacion}")(0)("ClaveSATTipoOperacion").ToString - Timbre.Complementos.ComercioExterior11.ClavedePedimento = GlobalDTClavePedimento().FiltraParametros($"CvePedimento={CvePedimento}")(0)("ClaveSATPedimento").ToString + Timbre.Complementos.ComercioExterior11.TipoOperacion = GlobalDTTipoOperacion().FiltraParametros($"CveTipoOperacion={CveTipoOperacion}")(0)("ClaveSATTipoOperacion").ToString() + Timbre.Complementos.ComercioExterior11.ClavedePedimento = GlobalDTClavePedimento().FiltraParametros($"CvePedimento={CvePedimento}")(0)("ClaveSATPedimento").ToString() Timbre.Complementos.ComercioExterior11.CertificadoOrigen = "0" Timbre.Complementos.ComercioExterior11.Incoterm = GlobalDTIncoterm.FiltroPrimeroValor("ClaveSATIncoterm", $"CveIncoterm={DdlIncoterm.SelectedValue}") Timbre.Complementos.ComercioExterior11.Subdivision = "0" - Timbre.Complementos.ComercioExterior11.TipoCambioUSD = If(Obj.CveMoneda = 1, 1, Obj.TipoCambio.ToString.ToDecimal) + Timbre.Complementos.ComercioExterior11.TipoCambioUSD = If(Obj.CveMoneda = 1, 1, Obj.TipoCambio.ToString().ToDecimal) Timbre.Complementos.ComercioExterior11.MotivoTraslado = GlobalDTSATMotivoTraslado.FiltroPrimeroValor("ClaveSATMotivoTraslado", $"CveMotivoTraslado={DdlSATMotivoTraslado.SelectedValue}") 'EMISOR Dim Dr As DataRow Dr = Nothing - If GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero).Rows.Count > 0 Then - Dr = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero)(0) + If GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero()).Rows.Count > 0 Then + Dr = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero())(0) End If Timbre.Complementos.ComercioExterior11.Emisor.CURP = UsuarioActual.Empresa.CURP - Timbre.Complementos.ComercioExterior11.Emisor.Calle = Dr("Calle").ToString - Timbre.Complementos.ComercioExterior11.Emisor.NumeroExterior = Dr("NoExt").ToString - Timbre.Complementos.ComercioExterior11.Emisor.NumeroInterior = Dr("NoInt").ToString - Timbre.Complementos.ComercioExterior11.Emisor.Colonia = Dr("ClaveSATColonia").ToString + Timbre.Complementos.ComercioExterior11.Emisor.Calle = Dr("Calle").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.NumeroExterior = Dr("NoExt").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.NumeroInterior = Dr("NoInt").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.Colonia = Dr("ClaveSATColonia").ToString() Timbre.Complementos.ComercioExterior11.Emisor.Localidad = "" - Timbre.Complementos.ComercioExterior11.Emisor.Municipio = Dr("ClaveSATMunicipio").ToString - Timbre.Complementos.ComercioExterior11.Emisor.Estado = Dr("ClaveSATEstado").ToString - Timbre.Complementos.ComercioExterior11.Emisor.Pais = Dr("ClaveSATPais").ToString - Timbre.Complementos.ComercioExterior11.Emisor.CP = Dr("ClaveSATCP").ToString + Timbre.Complementos.ComercioExterior11.Emisor.Municipio = Dr("ClaveSATMunicipio").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.Estado = Dr("ClaveSATEstado").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.Pais = Dr("ClaveSATPais").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.CP = Dr("ClaveSATCP").ToString() 'RECEPTOR Timbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib = "" ' EN LA VERSION 3.3 NO DEBE DE REGISTRARSE ESTE VALOR @@ -9012,8 +9013,8 @@ Partial Class Ventas 'MERCANCIAS For Each Gvr As GridViewRow In GvComercioExterior.Rows Dim mercancia As New CFDIComercioExterior11Mercancias With {.CantidadAduana = Gvr.FCTextBox("TxtCantidad").Text.ToDecimal, - .FraccionArancelaria = Gvr.DataKey("ClaveSATFraccionArancelaria").ToString, - .UnidadAduana = Gvr.DataKey("ClaveSATUnidadAduana").ToString, + .FraccionArancelaria = Gvr.DataKey("ClaveSATFraccionArancelaria").ToString(), + .UnidadAduana = Gvr.DataKey("ClaveSATUnidadAduana").ToString(), .ValorDolares = Math.Round(Gvr.FCTextBox("TxtCantidad").Text.ToDecimal * Gvr.FCTextBox("TxtValorUnitario").Text.ToDecimal, 2), .ValorUnitarioAduana = Gvr.FCTextBox("TxtValorUnitario").Text.ToDecimal, .NoIdentificacion = Gvr.DataKey("Codigo")} @@ -9034,7 +9035,7 @@ Partial Class Ventas FM.FEMSA_NumSociedad = TxtFEMSA_NumSociedad.Text.Trim FM.FEMSA_NumProveedor = TxtFEMSA_NumProveedor.Text.Trim FM.FEMSA_Mail = TxtFEMSA_Mail.Text.Trim - FM.FEMSA_Version = TxtFEMSA_Version.Text.ToEntero + FM.FEMSA_Version = TxtFEMSA_Version.Text.ToEntero() FM.FEMSA_NumPedido = TxtFEMSA_NumPedido.Text.Trim.ToLong FM.FEMSA_NumEntrada = TxtFEMSA_NumEntrada.Text.Trim FM.FEMSA_NumRemision = TxtFEMSA_NumRemision.Text.Trim @@ -9065,30 +9066,30 @@ Partial Class Ventas TmpDTComplementosTimbrado.Columns.Add("Entidad") Dim Row2 As DataRow = TmpDTComplementosTimbrado.NewRow - If RblComplementos.SelectedValue.ToEntero > 0 Then + If RblComplementos.SelectedValue.ToEntero() > 0 Then - Select Case RblComplementos.SelectedValue.ToEntero + Select Case RblComplementos.SelectedValue.ToEntero() Case 5 - Row2("CveComplemento") = RblComplementos.SelectedValue.ToEntero - Row2("IdContabilidad") = TxtIdConta.Text.ToEntero + Row2("CveComplemento") = RblComplementos.SelectedValue.ToEntero() + Row2("IdContabilidad") = TxtIdConta.Text.ToEntero() Row2("TipoProceso") = "Ordinario" Row2("TipoAmbito") = "Directivo Estatal" Row2("Entidad") = DdlINEEntidad.SelectedValue Case 6 - Row2("CveComplemento") = RblComplementos.SelectedValue.ToEntero - Row2("IdContabilidad") = TxtIdConta.Text.ToEntero + Row2("CveComplemento") = RblComplementos.SelectedValue.ToEntero() + Row2("IdContabilidad") = TxtIdConta.Text.ToEntero() Row2("TipoProceso") = "Ordinario" Row2("TipoAmbito") = "Ejecutivo Estatal" Row2("Entidad") = DdlINEEntidad.SelectedValue Case 7 - Row2("CveComplemento") = RblComplementos.SelectedValue.ToEntero - Row2("IdContabilidad") = TxtIdConta.Text.ToEntero + Row2("CveComplemento") = RblComplementos.SelectedValue.ToEntero() + Row2("IdContabilidad") = TxtIdConta.Text.ToEntero() Row2("TipoProceso") = "Ordinario" Row2("TipoAmbito") = "Ejecutivo Nacional" Row2("Entidad") = "" Case 8 - Row2("CveComplemento") = RblComplementos.SelectedValue.ToEntero - Row2("IdContabilidad") = TxtIdConta.Text.ToEntero + Row2("CveComplemento") = RblComplementos.SelectedValue.ToEntero() + Row2("IdContabilidad") = TxtIdConta.Text.ToEntero() Row2("TipoProceso") = DdlTipoCampaña.SelectedValue Row2("TipoAmbito") = DdlAmbitoComplemento.SelectedValue Row2("Entidad") = DdlINEEntidad.SelectedValue @@ -9111,7 +9112,7 @@ Partial Class Ventas Dim ObjVentas As New ClsVentas If ObjVentas.GetOCSinFacturar(TxtFechaIOC.Text, TxtFechaFOC.Text, CveCliente, 1) Then - If DdlContratosOC.SelectedValue.ToEntero > 0 Then + If DdlContratosOC.SelectedValue.ToEntero() > 0 Then DTOrdenesCompra = ObjVentas.DtResultados.FiltraParametros($"CveContratoVinculado = '{DdlContratosOC.SelectedValue}'") Else DTOrdenesCompra = ObjVentas.DtResultados @@ -9131,7 +9132,7 @@ Partial Class Ventas Dim ObjVentas As New ClsVentas If ObjVentas.GetOCSinFacturar(TxtFechaIOC.Text, TxtFechaFOC.Text, CveCliente, 2) Then - If DdlContratosOC.SelectedValue.ToEntero > 0 Then + If DdlContratosOC.SelectedValue.ToEntero() > 0 Then DTOrdenesCompra = ObjVentas.DtResultados.FiltraParametros($"Cantidad > 0 AND CveContratoVinculado = '{DdlContratosOC.SelectedValue}'") Else DTOrdenesCompra = ObjVentas.DtResultados.FiltraParametros($"Cantidad > 0") @@ -9156,7 +9157,7 @@ Partial Class Ventas If Gvr.RowType = DataControlRowType.DataRow Then If Gvr.FCCheckBox("Chk").Checked Then Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk") - Dim CveOrdenCompraDetalle As Integer = Gvr.DataKey("CveOrdenCompraDetalle").ToEntero + Dim CveOrdenCompraDetalle As Integer = Gvr.DataKey("CveOrdenCompraDetalle").ToEntero() Dim Drs As DataRow() = dt.Select($"CveOrdenCompraDetalle = {CveOrdenCompraDetalle}") If Drs.Count > 0 Then Drs(0)("Aplicado") = ChkAplicar.Checked @@ -9171,7 +9172,7 @@ Partial Class Ventas If Gvr.RowType = DataControlRowType.DataRow Then If Gvr.FCCheckBox("Chk").Checked Then Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk") - Dim CveOrdenCompra As Integer = Gvr.DataKey("CveOrdenCompra").ToEntero + Dim CveOrdenCompra As Integer = Gvr.DataKey("CveOrdenCompra").ToEntero() Dim Drs As DataRow() = dt.Select($"CveOrdenCompra = {CveOrdenCompra}") If Drs.Count > 0 Then Drs(0)("Aplicado") = ChkAplicar.Checked @@ -9218,30 +9219,30 @@ Partial Class Ventas Dim sb As New StringBuilder If ChkPSOC.Checked Then For Each row As DataRow In dtSeleccionadas.Rows - sb.Append($"{row("CveOrdenCompraDetalle").ToString},") + sb.Append($"{row("CveOrdenCompraDetalle").ToString()},") Next Else For Each row As DataRow In dtSeleccionadas.Rows - sb.Append($"{row("CveOrdenCompra").ToString},") + sb.Append($"{row("CveOrdenCompra").ToString()},") Next End If sb.Remove(sb.Length - 1, 1) - If ObjClientes.GetVentasOCTotales(CveCliente, sb.ToString, If(ChkPSOC.Checked, 2, 1)) Then + If ObjClientes.GetVentasOCTotales(CveCliente, sb.ToString(), If(ChkPSOC.Checked, 2, 1)) Then DTOrdenesCompraPS = ObjClientes.DtResultados RegistroxOC = True Dim tCantidad As Decimal = 0 For Each Dr As DataRow In DTOrdenesCompraPS.Select() - tCantidad = If(ChkPSOC.Checked, GvOCPS.Rows(IndiceGVDataKey(GvOCPS, "CveOrdenCompraDetalle", $"{Dr("CveOrdenCompraDetalle")}")).FCTextBox("TxtCantidadOC").Text, Dr("Cantidad")).ToString.ToDecimal - AgregarProductoServicio(tCantidad, Dr("CveUM").ToString.ToEntero, Dr("UM").ToString, Dr("CveClasificacion").ToString.ToEntero, Dr("Clasificacion").ToString, - Dr("CvePS").ToString.ToEntero, Dr("PS").ToString, Dr("Obs").ToString, Dr("PUCon").ToString.ToDecimal, 0, - Dr("CveProyecto").ToString.ToEntero, Dr("Proyecto").ToString, Dr("CveSubProyecto").ToString.ToEntero, Dr("SubProyecto").ToString, - CveContratoDetalle:=Dr("CveContratoDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, + tCantidad = If(ChkPSOC.Checked, GvOCPS.Rows(IndiceGVDataKey(GvOCPS, "CveOrdenCompraDetalle", $"{Dr("CveOrdenCompraDetalle")}")).FCTextBox("TxtCantidadOC").Text, Dr("Cantidad")).ToString().ToDecimal + AgregarProductoServicio(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(), + Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PUCon").ToString().ToDecimal, 0, + Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(), + CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero(), CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString().ToEntero(), EntregaDirecta:=1) Next - CveContrato = DTOrdenesCompraPS.FiltroPrimeroValor("CveContrato").ToString.ToEntero + CveContrato = DTOrdenesCompraPS.FiltroPrimeroValor("CveContrato").ToString().ToEntero() If CveContrato > 0 Then ContratoOC = True CalculaTotalesVenta() @@ -9354,11 +9355,11 @@ Partial Class Ventas Dim EsInterno As Integer = -1 If DdlAlmacenAsignado.Visible Or RequiereAlmacenDestino Then - CveAlmacenTraspasoDestino = DdlAlmacenAsignado.SelectedValue.ToEntero + CveAlmacenTraspasoDestino = DdlAlmacenAsignado.SelectedValue.ToEntero() End If If DdlAlmacenOrigen.Visible Or RequiereAlmacenOrigen Then - CveAlmacenTraspasoOrigen = DdlAlmacenOrigen.SelectedValue.ToEntero + CveAlmacenTraspasoOrigen = DdlAlmacenOrigen.SelectedValue.ToEntero() End If If TrTipoPedido.Visible Then @@ -9368,15 +9369,15 @@ Partial Class Ventas 'Si es devolucion revertimos los almacenes If CvePedido > 0 And TipoContrato = 2 Then EsDevolucionVenta = 1 - CveAlmacenTraspasoOrigen = DdlAlmacenAsignado.SelectedValue.ToEntero - CveAlmacenTraspasoDestino = DdlAlmacenOrigen.SelectedValue.ToEntero + CveAlmacenTraspasoOrigen = DdlAlmacenAsignado.SelectedValue.ToEntero() + CveAlmacenTraspasoDestino = DdlAlmacenOrigen.SelectedValue.ToEntero() End If 'VALIDA ENTREGA POR ADELANTADO If UsuarioActual.Empresa.Funcionalidad(145) = "1" Then 'If UsuarioActual.CveEmpresa.Contiene(4, 72, 80, 119) Then 'INCRUSTAMOS ALMACEN ENTREGA POR ADELANTADO CUANDO SEA REMISION Y NO TRAIGA ASIGNADO POR EL USUARIO If CveAlmacenTraspasoDestino <= 0 And factura.TipoDocto = "Rem" Then - CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString.ToEntero + CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero() End If 'SI LA SUCURSAL NO TIENE ENTREGA POR ADELANTADO @@ -9414,10 +9415,10 @@ Partial Class Ventas factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.CveMesa, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa, AtencionA:=factura.AtencionA, TelefonoGenerico:=TxtTelefonoGenerico.Text.Trim, CveContrato:=factura.CveContrato, CveVentaPadre:=If(AplicaDevolucion, CveVentaDevolucion, factura.CveVentaPadre), Det_FechaOrdenCompra:=factura.Det_FechaOrdenCompra, Det_OrdenCompra:=factura.Det_OrdenCompra, otros:=factura.Otros, Entrega:=TxtEntrega.Text, Vigencia:=If(DdlTipoComprobante.SelectedValue = "Cot", TxtFechaVencimientoCotizacion.Text.ToDate, MinFecha), - CveAlmacenTraspasoDestino:=CveAlmacenTraspasoDestino, CveAlmacenTraspasoOrigen:=CveAlmacenTraspasoOrigen, CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), CveOC:=CveOC, IEPS:=factura.IEPSTC, Serie:=factura.Serie, CveCondicionEntrega:=DdlFormaEntrega.SelectedValue.ToEntero, + CveAlmacenTraspasoDestino:=CveAlmacenTraspasoDestino, CveAlmacenTraspasoOrigen:=CveAlmacenTraspasoOrigen, CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero(), -1), CveOC:=CveOC, IEPS:=factura.IEPSTC, Serie:=factura.Serie, CveCondicionEntrega:=DdlFormaEntrega.SelectedValue.ToEntero(), PedidoContrato:=TxtPedidoContrato.Text, ObservacionesAlmacen:=TxtObsAlmacen.Text, CveSubProyecto:=factura.CveSubProyecto, CveSubProyectoCobranza:=factura.CveSubProyectoCobranza, CveSubProyectoEjecucion:=factura.CveSubProyectoEjecucion, CveFormaPago33:=factura.CveFormaPago33, - CveMetodoPago33:=factura.CveMetodoPago33, CveUsoCFDI:=factura.CveUsoCFDI, OrdenCompra:=TxtOrdenCompra.Text, CveCuentaTerminal:=DdlCuentasTerminal.SelectedValue.ToEntero, CveTipoRelacion:=factura.CveTipoRelacion, ImpuestoLocal:=TotalImpuestoLocal, - CveVentaRelacion:=(If(factura.CveVentaRelacion.ToEntero > 0, factura.CveVentaRelacion, -1)), ImporteRelacion:=(If(factura.ImporteRelacion <> Nothing, factura.ImporteRelacion, -1)), + CveMetodoPago33:=factura.CveMetodoPago33, CveUsoCFDI:=factura.CveUsoCFDI, OrdenCompra:=TxtOrdenCompra.Text, CveCuentaTerminal:=DdlCuentasTerminal.SelectedValue.ToEntero(), CveTipoRelacion:=factura.CveTipoRelacion, ImpuestoLocal:=TotalImpuestoLocal, + CveVentaRelacion:=(If(factura.CveVentaRelacion.ToEntero() > 0, factura.CveVentaRelacion, -1)), ImporteRelacion:=(If(factura.ImporteRelacion <> Nothing, factura.ImporteRelacion, -1)), CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM, DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False), Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=CveTipoRetencion) Then @@ -9426,8 +9427,8 @@ Partial Class Ventas If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Then If DtVentasNC IsNot Nothing Then For Each row As DataRow In DtVentasNC.Rows - If Not row("CveVenta").ToString.ToEntero = -1 Then - If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, row("CveVenta").ToString.ToEntero) Then + If Not row("CveVenta").ToString().ToEntero() = -1 Then + If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, row("CveVenta").ToString().ToEntero()) Then ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") End If End If @@ -9455,7 +9456,7 @@ Partial Class Ventas factura.Folio = ObjVentas.Folio ViewState("VentaFolio") = ObjVentas.SerieFolio factura.Timbre.Comprobante.Serie = ObjVentas.Serie - factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString + factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString() If factura.TipoDocto = "Egs" AndAlso NuevaFactura = 1 Then If DtVentasNC Is Nothing Then @@ -9466,13 +9467,13 @@ Partial Class Ventas 'Se agregan los PS For Each Row As DataRow In TmpDTDetalle.Rows - If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero, - Row("PU").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString.ToDouble, Math.Round((Row("Total").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6), - Row("Obs").ToString, Row("Descuento").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero, - TiempoEntrega:=Row("TiempoEntrega").ToString, CveVentaDetallePadre:=Row("CveVentaDetalle").ToString.ToEntero, CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CvePromocionDetalle:=Row("CvePromocionDetalle").ToString.ToEntero, - IEPS:=Row("ImporteIEPS").ToString.ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString.ToEntero, - ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDouble, - PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDouble, CuentaPredial:=Row("CuentaPredial").ToString) Then + If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(), + Row("PU").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6), + Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), + TiempoEntrega:=Row("TiempoEntrega").ToString(), CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(), CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=Row("CvePromocionDetalle").ToString().ToEntero(), + IEPS:=Row("ImporteIEPS").ToString().ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString().ToEntero(), + ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, + PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString()) Then ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la Factura.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Exit For Else @@ -9480,7 +9481,7 @@ Partial Class Ventas 'Agregamos el gasto de contrato If CveContrato > 0 AndAlso factura.TipoDocto = "Rem" AndAlso AplicaGastoContrato Then Dim ObjContrato As New ClsContratos - If Not ObjContrato.AddContratoGasto(CveContrato, Row("PS").ToString, Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, factura.Fecha, UsuarioActual.CveUsuario, CveVenta:=ObjVentas.CveVenta) Then + If Not ObjContrato.AddContratoGasto(CveContrato, Row("PS").ToString(), Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, factura.Fecha, UsuarioActual.CveUsuario, CveVenta:=ObjVentas.CveVenta) Then ErrorList.Add("Ocurrió un error al agregar el gasto de la Factura.") Exit For End If @@ -9489,7 +9490,7 @@ Partial Class Ventas 'Si es devolucion se agregan a la tabla de Vta_VentasDetalleDevolucion If factura.AplicaDevolucion Then - If Not ObjVentas.AddVentaDetalleDevolucion(Row("CveVentaDetalle").ToString.ToEntero, ObjVentas.CveVentaDetalle, Row("Cantidad").ToString.ToDouble) Then + If Not ObjVentas.AddVentaDetalleDevolucion(Row("CveVentaDetalle").ToString().ToEntero(), ObjVentas.CveVentaDetalle, Row("Cantidad").ToString().ToDouble) Then ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.") End If If ErrorList.Count = 0 Then @@ -9499,15 +9500,12 @@ Partial Class Ventas End If End If - Dim TmpDr As DataRow = TmpDTDetalle.Select($"Consec = {Row("Consec").ToString}")(0) + Dim TmpDr As DataRow = TmpDTDetalle.Select($"Consec = {Row("Consec").ToString()}")(0) TmpDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle Try - If DtInv IsNot Nothing Then - Dim InvDr As DataRow = DtInv.Select($"Consec = {Row("Consec").ToString}")(0) - InvDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle - End If - + Dim InvDr As DataRow = DtInv.Select($"Consec = {Row("Consec").ToString()}")(0) + InvDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle Catch ex As Exception End Try @@ -9516,7 +9514,7 @@ Partial Class Ventas 'Orden Produccion' If UsuarioActual.CveEmpresa.Contiene(126) Then - If ObjVentas.CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero > 0 Then + If ObjVentas.CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), ObjVentas.CveVenta) Then ErrorList.Add("Ocurrió un error al actualizar la orden de producción") End If @@ -9565,7 +9563,7 @@ Partial Class Ventas For Each gvr As GridViewRow In GvImpuestosLocales2.Rows If gvr.RowType = DataControlRowType.DataRow Then If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble <> 0 Then - If Not ObjVentas.AddVentaImpuestoLocales(factura.CveVenta, gvr.DataKey("CveImpuestoLocal").ToString.ToEntero, gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1))) Then + If Not ObjVentas.AddVentaImpuestoLocales(factura.CveVenta, gvr.DataKey("CveImpuestoLocal").ToString().ToEntero(), gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1))) Then ErrorList.Add("Ocurrió un error al Guardar Impuestos Locales") End If End If @@ -9574,7 +9572,7 @@ Partial Class Ventas If DTmpF.Rows.Count > 0 Then For Each Row As DataRow In DTmpF.Rows - If Not ObjVentas.AddVentasFirmas(factura.CveVenta, Row("Titulo").ToString, Row("Nombre").ToString, Row("Puesto").ToString, Row("Lado").ToString.ToEntero) Then + If Not ObjVentas.AddVentasFirmas(factura.CveVenta, Row("Titulo").ToString(), Row("Nombre").ToString(), Row("Puesto").ToString(), Row("Lado").ToString().ToEntero()) Then ErrorList.Add("Ocurrio un error al Guardar Firmas") End If Next @@ -9585,7 +9583,7 @@ Partial Class Ventas 'cuando es contado If RBLPago.SelectedValue = "2" AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then For Each DrPago As DataRow In DtPagos.Rows - If Not ObjVentas.AddVta_VentaPago(factura.CveVenta, DrPago("CveMetodoPago").ToString.ToEntero, DrPago("Importe").ToString.ToDouble) Then + If Not ObjVentas.AddVta_VentaPago(factura.CveVenta, DrPago("CveMetodoPago").ToString().ToEntero(), DrPago("Importe").ToString().ToDouble) Then ErrorList.Add("Ocurrio un error al guardar los metodos de pago") End If Next @@ -9603,13 +9601,13 @@ Partial Class Ventas 'If factura.CveCorte > 0 Then ' If RBLPago.SelectedValue = "2" AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then ' For Each DrPago As DataRow In DtPagos.Rows - ' If ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString.ToEntero, DrPago("CveTipoMovimiento").ToString.ToEntero, TxtFechaPago.Text.ToDate, DrPago("Folio").ToString, "", DrPago("Importe").ToString.ToDouble, DdlMoneda.SelectedValue.ToEntero, If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDouble), "", "", True, False, -1, factura.CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte) = -1 Then + ' If ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString().ToEntero(), DrPago("CveTipoMovimiento").ToString().ToEntero(), TxtFechaPago.Text.ToDate, DrPago("Folio").ToString(), "", DrPago("Importe").ToString().ToDouble, DdlMoneda.SelectedValue.ToEntero(), If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDouble), "", "", True, False, -1, factura.CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte) = -1 Then ' ErrorList.Add("Ocurrio un error al guardar los metodos de pago") ' End If ' Next ' 'Else ' ' 'cuando es crédito o terminal - ' ' If ObjBancos.AddBancos_IE(, 7, TxtFechaPago.Text.ToDate, TxtFolio.Text.ToString, "", TxtTotal.Text.ToDouble, DdlMoneda.SelectedValue.ToEntero, If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDouble), "", "", True, False, -1, factura.CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte) = -1 Then + ' ' If ObjBancos.AddBancos_IE(, 7, TxtFechaPago.Text.ToDate, TxtFolio.Text.ToString(), "", TxtTotal.Text.ToDouble, DdlMoneda.SelectedValue.ToEntero(), If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDouble), "", "", True, False, -1, factura.CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte) = -1 Then ' ' ErrorList.Add("Ocurrio un error al guardar los metodos de pago") ' ' End If ' End If @@ -9619,7 +9617,7 @@ Partial Class Ventas 'INE COMPLEMENTOS If ObjFactura.ComplementoINE IsNot Nothing Then - If Not ObjVentas.UpdateVentasComplementos(ObjFactura.CveVenta, ObjFactura.ComplementoINE.INETipoProceso, ObjFactura.ComplementoINE.INETipoComite, ObjFactura.ComplementoINE.INEIdContabilidad.ToString) Then + If Not ObjVentas.UpdateVentasComplementos(ObjFactura.CveVenta, ObjFactura.ComplementoINE.INETipoProceso, ObjFactura.ComplementoINE.INETipoComite, ObjFactura.ComplementoINE.INEIdContabilidad.ToString()) Then ErrorList.Add("Ocurrio un error al guardar los complementos") End If End If @@ -9635,10 +9633,10 @@ Partial Class Ventas For Each row As DataRow In DtRemisionesPS.Rows Cantidad = DtRemisionesTmpDT.FiltroPrimeroValor("Cantidad", $"CveVentaDetalleRemision={row("CveVentaDetalle")}").ToDecimal - CvePS = DtRemisionesTmpDT.FiltroPrimeroValor("CvePS", $"CveVentaDetalleRemision={row("CveVentaDetalle")}").ToEntero + CvePS = DtRemisionesTmpDT.FiltroPrimeroValor("CvePS", $"CveVentaDetalleRemision={row("CveVentaDetalle")}").ToEntero() PU = DtRemisionesTmpDT.FiltroPrimeroValor("PU", $"CveVentaDetalleRemision={row("CveVentaDetalle")}").ToDecimal - CveVentaDetalle = TmpDT.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetalleRemision={row("CveVentaDetalle")}").ToEntero - CveVentaDetallePadre = row("CveVentaDetalle").ToString.ToEntero + CveVentaDetalle = TmpDT.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetalleRemision={row("CveVentaDetalle")}").ToEntero() + CveVentaDetallePadre = row("CveVentaDetalle").ToString().ToEntero() If Not ObjVentas.AgregarRemisionDetalle(CveVentaDetalle, CveVentaDetallePadre, Cantidad) Then ErrorList.Add("Ocurrió un error al agregar el detalle de la Remision") @@ -9652,7 +9650,7 @@ Partial Class Ventas Dim dt As DataTable = DTRemisiones.FiltraParametros("Aplicado = True") If dt.Rows.Count > 0 Then For Each row As DataRow In dt.Rows - If Not ObjVentas.UpdateVentaRemision(row("CveVenta").ToString.ToEntero, ObjFactura.CveVenta) Then + If Not ObjVentas.UpdateVentaRemision(row("CveVenta").ToString().ToEntero(), ObjFactura.CveVenta) Then ErrorList.Add("Ocurrió un error al actualizar la remisión") End If Next @@ -9671,10 +9669,10 @@ Partial Class Ventas For Each row As DataRow In DtPedidos2PS.Rows Cantidad = DtPedidos2TmpDT.FiltroPrimeroValor("Cantidad", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToDecimal - CvePS = DtPedidos2TmpDT.FiltroPrimeroValor("CvePS", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToEntero + CvePS = DtPedidos2TmpDT.FiltroPrimeroValor("CvePS", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToEntero() PU = DtPedidos2TmpDT.FiltroPrimeroValor("PU", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToDecimal - CveVentaDetalle = TmpDTDetalle.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToEntero - CveVentaDetallePadre = row("CveVentaDetalle").ToString.ToEntero + CveVentaDetalle = TmpDTDetalle.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetallePedido2={row("CveVentaDetalle")}").ToEntero() + CveVentaDetallePadre = row("CveVentaDetalle").ToString().ToEntero() If Not ObjVentas.AddVentaDetallePedido2(CveVentaDetalle, CveVentaDetallePadre, Cantidad) Then ErrorList.Add("Ocurrió un error al agregar el detalle del Pedido2") @@ -9686,7 +9684,7 @@ Partial Class Ventas Dim dt As DataTable = DtPedidos2.FiltraParametros("Aplicado = True") If dt.Rows.Count > 0 Then For Each row As DataRow In dt.Rows - If Not ObjVentas.UpdateVentaPedido2(row("CveVenta").ToString.ToEntero, ObjFactura.CveVenta) Then + If Not ObjVentas.UpdateVentaPedido2(row("CveVenta").ToString().ToEntero(), ObjFactura.CveVenta) Then ErrorList.Add("Ocurrió un error al actualizar el Pedido2") End If Next @@ -9785,7 +9783,7 @@ Partial Class Ventas If ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio > 0 Then tipoCambio = ObjFactura.TipoCambio ElseIf ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio <= 1 Then - tipoCambio = GlobalTipoCambio(ObjFactura.Fecha).ToString.ToDecimal + tipoCambio = GlobalTipoCambio(ObjFactura.Fecha).ToString().ToDecimal Else tipoCambio = 1 End If @@ -9798,8 +9796,8 @@ Partial Class Ventas Dim CveCuenta As Integer Dim IdCtaContableCliente As Integer Dim CveCuentaCliente As Integer - Dim Concepto As String = ViewState("VentaFolio").ToString - Dim Referencia As String = ViewState("VentaFolio").ToString + Dim Concepto As String = ViewState("VentaFolio").ToString() + Dim Referencia As String = ViewState("VentaFolio").ToString() Dim Fecha = TxtFecha.Text.Trim.ToDate Dim importeMX As Decimal @@ -9807,7 +9805,7 @@ Partial Class Ventas Dim CveIEPago As Integer Dim FolioIE As Long Dim CveIEAnticipo As Integer - Dim CveSubProyectoVenta = DdlSubProyectoDatos.SelectedValue.ToEntero + Dim CveSubProyectoVenta = DdlSubProyectoDatos.SelectedValue.ToEntero() Dim CveSubProyectoContabilizar As Integer Dim IdCtaIVAXTrasladar As Integer = 0 Dim IdCtaIVATrasladado As Integer = 0 @@ -9819,10 +9817,10 @@ Partial Class Ventas End If If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then - IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("IdCtaIVAXTrasladar").ToString.ToEntero - CveCuentaIVAxTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveCuentaIVAXTrasladar").ToString.ToEntero - IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("IdCtaIVATrasladado").ToString.ToEntero - CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveCuentaIVATrasladado").ToString.ToEntero + IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("IdCtaIVAXTrasladar").ToString().ToEntero() + CveCuentaIVAxTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveCuentaIVAXTrasladar").ToString().ToEntero() + IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("IdCtaIVATrasladado").ToString().ToEntero() + CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveCuentaIVATrasladado").ToString().ToEntero() End If Dim UsaComplementariaClientes As Boolean = False @@ -9833,13 +9831,13 @@ Partial Class Ventas If ValorMultiplicador = -1 Then dtt = ObjConta.DtResultados.FiltraParametros("", "Orden DESC") ' se ordena contrario al registro para llevar los saldos correctos For Each Row As DataRow In dtt.Rows - ConceptoContable = Row("CveConcepto").ToString.ToEntero - TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) + ConceptoContable = Row("CveConcepto").ToString().ToEntero() + TipoMovimiento = If(Row("TipoMovto").ToString() = "True", True, False) importeMovimiento = 0 IdCtaContable = 0 CveCuenta = 0 CveSubProyectoContabilizar = 0 - Multiplicador = (Row("Multiplicador").ToString.ToEntero) + Multiplicador = (Row("Multiplicador").ToString().ToEntero()) Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", "") Dim PorcentajeImpuesto As Decimal = 0 @@ -9985,11 +9983,11 @@ Partial Class Ventas ImporteConcepto12 = importeMX.RoundSQL If importeMovimiento <> 0 Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then @@ -10020,39 +10018,39 @@ Partial Class Ventas Dim Importe251 As Decimal = 0 Dim ImporteMN251 As Decimal = 0 - If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = Dr("Importe").ToString.ToDecimal - Importe91 = Dr("Importe").ToString.ToDecimal - ImporteMN91 = Dr("Importe").ToString.ToDecimal + If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso Not Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then + Importe251 = Dr("Importe").ToString().ToDecimal + Importe91 = Dr("Importe").ToString().ToDecimal + ImporteMN91 = Dr("Importe").ToString().ToDecimal TipoCambioNC = 1 - ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = Dr("Importe").ToString.ToDecimal - Importe91 = Dr("Importe").ToString.ToDecimal - ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC - ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = Dr("Importe").ToString.ToDecimal - Importe91 = Dr("Importe").ToString.ToDecimal - ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC - ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then + ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso Not Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then + Importe251 = Dr("Importe").ToString().ToDecimal + Importe91 = Dr("Importe").ToString().ToDecimal + ImporteMN91 = Dr("Importe").ToString().ToDecimal * TipoCambioNC + ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then + Importe251 = Dr("Importe").ToString().ToDecimal + Importe91 = Dr("Importe").ToString().ToDecimal + ImporteMN91 = Dr("Importe").ToString().ToDecimal * TipoCambioNC + ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then - Importe91 = Dr("Importe").ToString.ToDecimal / TipoCambioNC - ImporteMN91 = Dr("Importe").ToString.ToDecimal + Importe91 = Dr("Importe").ToString().ToDecimal / TipoCambioNC + ImporteMN91 = Dr("Importe").ToString().ToDecimal End If - Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal + Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString().ToDecimal If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal End If - If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then - ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion - ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then - ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion - ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then - Importe251 = Dr("Importe").ToString.ToDecimal / TCFluctuacion - ImporteMN251 = Dr("Importe").ToString.ToDecimal + If DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso Not Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then + ImporteMN251 = Dr("Importe").ToString().ToDecimal * TCFluctuacion + ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then + ImporteMN251 = Dr("Importe").ToString().ToDecimal * TCFluctuacion + ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then + Importe251 = Dr("Importe").ToString().ToDecimal / TCFluctuacion + ImporteMN251 = Dr("Importe").ToString().ToDecimal Else - ImporteMN251 = Dr("Importe").ToString.ToDecimal + ImporteMN251 = Dr("Importe").ToString().ToDecimal End If Importe251 = Importe251.RoundSQL @@ -10061,27 +10059,27 @@ Partial Class Ventas ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}" - CveUltimaVenta = Dr("CveVenta").ToString.ToEntero + CveUltimaVenta = Dr("CveVenta").ToString().ToEntero() Dim ImporteComplementarioIngreso As Decimal = 0 If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then ImporteMN91 = Importe91 ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString().ToDecimal) Then ErrorPrepoliza = True Exit For End If End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then ErrorPrepoliza = True Exit For End If ImporteAcumulado91 += (ImporteMN91).RoundSQL - If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then + If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then ImporteMN251 = Importe251 - Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then + Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString().ToDecimal) - Importe251).RoundSQL + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal) Then ErrorPrepoliza = True Exit For End If @@ -10091,12 +10089,12 @@ Partial Class Ventas If EsNCAmortizacion Then '' aqui no se registra el pago como NC, se deja para el registro de la aplicaion del anticipo '' esto para trasladar los impuestos. - If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") Then + If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") Then For Each row2 As GridViewRow In GVAnticipos.Rows - If row2.DataKey("CveConceptoContable").ToString().ToEntero = 3 Then + If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then - CveIEAnticipo = row2.DataKey("CveIE").ToString.ToEntero + CveIEAnticipo = row2.DataKey("CveIE").ToString().ToEntero() importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal) If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" @@ -10105,12 +10103,12 @@ Partial Class Ventas CveSubProyectoContabilizar = CveSubProyectoVenta If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Exit For Else ViewState("SeGuardoPrePoliza") = True - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then ErrorPrepoliza = True Exit For End If @@ -10126,15 +10124,15 @@ Partial Class Ventas If IngresoIVA > 0 Then IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If 'IVA PAGADO IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If @@ -10143,15 +10141,15 @@ Partial Class Ventas If IngresoIEPS > 0 Then 'IEPS X TRASLADAR - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) + If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If 'IEPS PAGADO - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) + If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If @@ -10167,7 +10165,7 @@ Partial Class Ventas End If Else - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then ErrorPrepoliza = True Exit For End If @@ -10197,7 +10195,7 @@ Partial Class Ventas End If Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString().ToDecimal, CveCuenta:=CveCuenta) Then ErrorPrepoliza = True Exit For End If @@ -10320,18 +10318,18 @@ Partial Class Ventas CveSubProyectoContabilizar = CveSubProyectoVenta If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - If row2.DataKey("IdCtaContable").ToEntero > 0 Then - IdCtaContable = row2.DataKey("IdCtaContable").ToEntero + If row2.DataKey("IdCtaContable").ToEntero() > 0 Then + IdCtaContable = row2.DataKey("IdCtaContable").ToEntero() Else - If ObjConta.GetRetCuenta(row2.DataKey("CveConceptoContable").ToEntero, ObjFactura.CveCliente) Then + If ObjConta.GetRetCuenta(row2.DataKey("CveConceptoContable").ToEntero(), ObjFactura.CveCliente) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContFondoGarantia").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContFondoGarantia").ToString().ToEntero() End If End If End If If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, If(row2.DataKey("TipoMovto").ToString = "True", True, False), importeMovimiento, Referencia, row2.DataKey("CveConceptoContable").ToEntero, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, If(row2.DataKey("TipoMovto").ToString() = "True", True, False), importeMovimiento, Referencia, row2.DataKey("CveConceptoContable").ToEntero(), Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True End If End If @@ -10349,7 +10347,7 @@ Partial Class Ventas If ObjFactura.TipoDocto = "Ing" AndAlso ValorMultiplicador = -1 Then For Each row2 As GridViewRow In GvAntNC.Rows - If row2.DataKey("CveConceptoContable").ToString().ToEntero = 11 Then + If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 11 Then importeMovimiento = row2.DataKey("Importe").ToString().ToDecimal * ValorMultiplicador '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal) If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" @@ -10358,7 +10356,7 @@ Partial Class Ventas CveSubProyectoContabilizar = CveSubProyectoVenta If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Exit For Else @@ -10374,7 +10372,7 @@ Partial Class Ventas If ObjFactura.TipoDocto = "Egs" AndAlso EsNCAmortizacion Then If DtAnticipoAmortizacion IsNot Nothing AndAlso DtAnticipoAmortizacion.Rows.Count > 0 Then For Each RowAnticipo As DataRow In DtAnticipoAmortizacion.Rows - Dim CveVentaAnticipo As Integer = RowAnticipo("CveVenta").ToString().ToEntero + Dim CveVentaAnticipo As Integer = RowAnticipo("CveVenta").ToString().ToEntero() importeMovimiento = RowAnticipo("SaldoAnticipo").ToString().ToDecimal If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" @@ -10400,14 +10398,14 @@ Partial Class Ventas ' cuando es amortización de nota de crédito, y es la nc ' cuando es amortización por descuento, y es el ingreso ' cuando es amortización en cero - 'DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") OrElse - If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero = 1 AndAlso ObjFactura.TipoDocto.Contiene("Ing") OrElse - DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero = 3 Then + 'DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") OrElse + If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 1 AndAlso ObjFactura.TipoDocto.Contiene("Ing") OrElse + DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 3 Then For Each row2 As GridViewRow In GVAnticipos.Rows - If row2.DataKey("CveConceptoContable").ToString().ToEntero = 3 Then + If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then - CveIEAnticipo = row2.DataKey("CveIE").ToString.ToEntero + CveIEAnticipo = row2.DataKey("CveIE").ToString().ToEntero() importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal) If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" @@ -10416,7 +10414,7 @@ Partial Class Ventas CveSubProyectoContabilizar = CveSubProyectoVenta If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Exit For Else @@ -10435,7 +10433,7 @@ Partial Class Ventas DT = TmpDTDetalle.FiltraParametros($"CvePS = {CvePSAmortizacion}") If DT.Rows.Count > 0 Then For Each Row2 As DataRow In DT.Rows - importeMovimiento = Math.Abs(Row2("PU").ToString.ToDecimal) + importeMovimiento = Math.Abs(Row2("PU").ToString().ToDecimal) IdCtaContable = IdCtaContAnticipos CveCuenta = CveCuentaAnticipos CveSubProyectoContabilizar = CveSubProyectoVenta @@ -10462,7 +10460,7 @@ Partial Class Ventas 'cuando es cancelación For Each row2 As GridViewRow In GvNC.Rows - If row2.DataKey("CveConceptoContable").ToString().ToEntero = 91 Then + If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 91 Then importeMovimiento = row2.DataKey("Importe").ToDecimal * ValorMultiplicador sumaAmorticaciones += importeMovimiento @@ -10478,8 +10476,8 @@ Partial Class Ventas If importeMovimiento <> 0 Then - If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVentaNC").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2.DataKey("CveVentaNC").ToString.ToEntero, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVentaNC").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2.DataKey("CveVentaNC").ToString().ToEntero(), ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then ErrorPrepoliza = True Exit For End If @@ -10488,7 +10486,7 @@ Partial Class Ventas Exit For End If - 'If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2.DataKey("CveVentaNC").ToString.ToEntero, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then + 'If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2.DataKey("CveVentaNC").ToString().ToEntero(), ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then ' ErrorPrepoliza = True 'End If End If @@ -10498,7 +10496,7 @@ Partial Class Ventas Else For Each row2 As GridViewRow In GVAnticipos.Rows - If row2.DataKey("CveConceptoContable").ToString().ToEntero = 12 Then + If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 12 Then If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal @@ -10510,7 +10508,7 @@ Partial Class Ventas If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then ErrorPrepoliza = True End If End If @@ -10601,10 +10599,10 @@ Partial Class Ventas For i = 0 To TmpDTDetalle.Rows.Count - 1 'se excluyen las clasificaciones anteriores para que se asignen las de ingreso - If Not TmpDTDetalle(i)("CveClasificacion").ToString.Contiene("19958", "19933", "18097") Then + If Not TmpDTDetalle(i)("CveClasificacion").ToString().Contiene("19958", "19933", "18097") Then - 'If TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal > 0 Then - ' If TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal = 0.08 Then + 'If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal > 0 Then + ' If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal = 0.08 Then ' TmpDTDetalle(i)("CveClasificacion") = 20242 'clasif: ventas tasa 8% ' Else ' TmpDTDetalle(i)("CveClasificacion") = 19929 'clasif: ventas tasa 16% @@ -10615,8 +10613,8 @@ Partial Class Ventas ' End If 'reclasifica la clasificación del producto, por la del ingreso correspondiente a su iva - If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal).Rows.Count > 0 Then - TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal).Rows(0)("CveClasificacion").ToString + If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal).Rows.Count > 0 Then + TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal).Rows(0)("CveClasificacion").ToString() End If End If @@ -10630,35 +10628,35 @@ Partial Class Ventas If DT.Rows.Count > 0 Then 'Se agrega movimiento separado por la cuenta de ventas (ER) For Each Row2 As DataRow In DT.Rows - importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString.ToDecimal) * ValorMultiplicador + importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador importeMX = importeMovimiento * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago - Concepto = $"{ViewState("VentaFolio").ToString} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" + Concepto = $"{ViewState("VentaFolio").ToString()} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}" If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas If ObjFactura.TipoDocto.Contiene("Egs") Then - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero + IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() Else - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero + IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() End If - CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero + CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() If importeMovimiento <> 0 Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString() + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}")) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString() + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}")) CveCuentaContabilizacion = 0 End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContableAplicar, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContableAplicar, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=Row2("CveSubProyecto").ToString().ToEntero(), ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta) Then ErrorPrepoliza = True Else ViewState("SeGuardoPrePoliza") = True @@ -10682,10 +10680,10 @@ Partial Class Ventas For i = 0 To TmpDTDetalle.Rows.Count - 1 'se excluyen las clasificaciones anteriores para que se asignen las de ingreso - If Not TmpDTDetalle(i)("CveClasificacion").ToString.Contiene("19958", "19933", "18097") Then + If Not TmpDTDetalle(i)("CveClasificacion").ToString().Contiene("19958", "19933", "18097") Then If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then - TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveClasificacion").ToString + TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveClasificacion").ToString() End If End If @@ -10699,41 +10697,41 @@ Partial Class Ventas If DT.Rows.Count > 0 Then 'Se agrega movimiento separado por la cuenta de ventas (ER) For Each Row2 As DataRow In DT.Rows - importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString.ToDecimal) * ValorMultiplicador + importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador importeMX = importeMovimiento * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago - Concepto = $"{ViewState("VentaFolio").ToString} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" + Concepto = $"{ViewState("VentaFolio").ToString()} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}" If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then Dim CampoCuenta As String = "IdCuentaGasto" 'If UsuarioActual.CveEmpresa.Contiene(80, 72, 146) Then CampoCuenta = "IdCuentaDescuento" - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor(CampoCuenta, String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero + IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor(CampoCuenta, String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() Else - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero + IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() End If If UsuarioActual.CveEmpresa = 119 Then - If Row2("CveClasificacion").ToString = "19930" Then IdCtaContable = 1141 - If Row2("CveClasificacion").ToString = "19929" Then IdCtaContable = 1142 + If Row2("CveClasificacion").ToString() = "19930" Then IdCtaContable = 1141 + If Row2("CveClasificacion").ToString() = "19929" Then IdCtaContable = 1142 End If - CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero + CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() If importeMovimiento <> 0 Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString() + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}")) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString() + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}")) CveCuentaContabilizacion = 0 End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContableAplicar, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContableAplicar, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=Row2("CveSubProyecto").ToString().ToEntero(), ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta) Then ErrorPrepoliza = True Else ViewState("SeGuardoPrePoliza") = True @@ -10754,16 +10752,16 @@ Partial Class Ventas If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString.ToEntero - 'CveCuenta = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString().ToEntero() + 'CveCuenta = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString().ToEntero() End If End If If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" If importeMovimiento > 0 AndAlso UsuarioActual.CveEmpresa = 119 Then 'código fijo en base el porcentaje iva, que se afecten las clasificaciones For i = 0 To TmpDTDetalle.Rows.Count - 1 - 'If TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal > 0 Then - ' If TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal = 0.08 Then + 'If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal > 0 Then + ' If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal = 0.08 Then ' TmpDTDetalle(i)("CveClasificacion") = 20242 'clasif: ventas tasa 8% ' Else ' TmpDTDetalle(i)("CveClasificacion") = 19929 'clasif: ventas tasa 16% @@ -10773,7 +10771,7 @@ Partial Class Ventas 'End If If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then - TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveClasificacion").ToString + TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveClasificacion").ToString() End If Next @@ -10805,7 +10803,7 @@ Partial Class Ventas Else If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString().ToEntero() End If End If End If @@ -10816,7 +10814,7 @@ Partial Class Ventas Else If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero + CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString().ToEntero() End If End If End If @@ -10835,7 +10833,7 @@ Partial Class Ventas If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then 'Conta ContPAQ - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString().ToEntero() End If End If @@ -10855,7 +10853,7 @@ Partial Class Ventas Else If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString().ToEntero() End If End If End If @@ -10866,7 +10864,7 @@ Partial Class Ventas Else If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero + CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString().ToEntero() End If End If End If @@ -10893,8 +10891,8 @@ Partial Class Ventas If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladar").ToString.ToEntero - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladarSIG").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladar").ToString().ToEntero() + CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladarSIG").ToString().ToEntero() End If End If End If @@ -10907,21 +10905,21 @@ Partial Class Ventas CveIEPago = -1 FolioIE = -1 - FolioIE = ObjBancos.GetNextFolio(DrPago("CveCuenta").ToString.ToEntero, DrPago("CveTipoMovimiento").ToString.ToEntero) + FolioIE = ObjBancos.GetNextFolio(DrPago("CveCuenta").ToString().ToEntero(), DrPago("CveTipoMovimiento").ToString().ToEntero()) If Not FolioIE > 0 Then ErrorPrepoliza = True Exit For End If - 'If DrPago("CveTipoMovimiento").ToString.ToEntero = 8 Then '13 - ' DrPago("Importe") = DrPago("Importe").ToString.ToDecimal - TxtCambio.Text.ToDecimal + 'If DrPago("CveTipoMovimiento").ToString().ToEntero() = 8 Then '13 + ' DrPago("Importe") = DrPago("Importe").ToString().ToDecimal - TxtCambio.Text.ToDecimal 'End If - CveIEPago = ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString.ToEntero, DrPago("CveTipoMovimiento").ToString.ToEntero, Fecha, FolioIE.ToString, String.Format("PAGO: {0}", TxtFolio.Text), DrPago("Importe").ToString.ToDouble, DdlMoneda.SelectedValue.ToEntero, tipoCambio, DrPago("Observaciones").ToString, "", False, False, -1, ObjFactura.CvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte, MesesSinIntereses:=DrPago("MesesSinIntereses").ToString.ToEntero) + CveIEPago = ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString().ToEntero(), DrPago("CveTipoMovimiento").ToString().ToEntero(), Fecha, FolioIE.ToString(), String.Format("PAGO: {0}", TxtFolio.Text), DrPago("Importe").ToString().ToDouble, DdlMoneda.SelectedValue.ToEntero(), tipoCambio, DrPago("Observaciones").ToString(), "", False, False, -1, ObjFactura.CvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte, MesesSinIntereses:=DrPago("MesesSinIntereses").ToString().ToEntero()) If CveIEPago > 0 Then - importeMovimiento = DrPago("Importe").ToString.ToDecimal * ValorMultiplicador + importeMovimiento = DrPago("Importe").ToString().ToDecimal * ValorMultiplicador importeMX = importeMovimiento * tipoCambio * Multiplicador IdCtaContable = 0 CveCuenta = 0 @@ -10929,30 +10927,30 @@ Partial Class Ventas Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal - If GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows.Count = 1 Then - IdCtaContable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("IdCtaContable").ToString.ToEntero - CveCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("IdCtaContableSIG").ToString.ToEntero + If GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero()).Rows.Count = 1 Then + IdCtaContable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero()).Rows(0)("IdCtaContable").ToString().ToEntero() + CveCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero()).Rows(0)("IdCtaContableSIG").ToString().ToEntero() End If If IdCtaContable <= 0 Then - CuentasContablesInvalidas.AppendFormat("
    {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("NumCuentaMoneda").ToString.ToEntero) + CuentasContablesInvalidas.AppendFormat("
    {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero()).Rows(0)("NumCuentaMoneda").ToString().ToEntero()) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.AppendFormat("
    {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("NumCuentaMoneda").ToString.ToEntero) + CuentasContablesInvalidasSIG.AppendFormat("
    {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero()).Rows(0)("NumCuentaMoneda").ToString().ToEntero()) CveCuentaContabilizacion = 0 End If 'BANCOS - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta) Then ErrorPrepoliza = True Exit For End If 'CLIENTES - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For @@ -10961,7 +10959,7 @@ Partial Class Ventas 'IVA X TRASLADAR IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) CveCuentaIVAxTrasladar = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVAxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For @@ -10970,21 +10968,21 @@ Partial Class Ventas 'IVA PAGADO IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) CveCuentaIVATrasladado = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVATrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If 'IEPS X TRASLADAR - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If 'IEPS PAGADO - Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSTrasladado, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For @@ -11007,12 +11005,12 @@ Partial Class Ventas If (importeMovimiento <> 0 OrElse (importeMovimiento = 0 AndAlso ObjFactura.Total = 0 AndAlso ConceptoContable = 1)) And Not ErrorPrepoliza Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If @@ -11066,18 +11064,18 @@ Partial Class Ventas Dim Selecciono As Boolean = False If ChkCanRem.Checked Then For Each Gvr As GridViewRow In GvCancelarRemisiones.Rows - If Gvr.DataKey("CveVenta").ToEntero = Dr("CveVenta").ToString.ToEntero AndAlso Gvr.FCCheckBox("ChkCancelarRemision").Checked Then + If Gvr.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() AndAlso Gvr.FCCheckBox("ChkCancelarRemision").Checked Then Selecciono = True End If Next End If If Not Selecciono Then - If Not ObjConta.TraspasarSaldosRemision(Dr("CveVenta").ToString.ToEntero, ObjFactura.CvePrePoliza, ObjFactura.CveVenta, 1) Then + If Not ObjConta.TraspasarSaldosRemision(Dr("CveVenta").ToString().ToEntero(), ObjFactura.CvePrePoliza, ObjFactura.CveVenta, 1) Then ErrorPrepoliza = True End If 'Remision - If Not ObjEventos.AddEventoBitacora($"Facturación cancelada en: {TxtFolio.Text}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Dr("CveVenta").ToString.ToEntero) Then + If Not ObjEventos.AddEventoBitacora($"Facturación cancelada en: {TxtFolio.Text}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Dr("CveVenta").ToString().ToEntero()) Then ErrorPrepoliza = True End If End If @@ -11178,7 +11176,7 @@ Partial Class Ventas CveConceptoAlmacen = 18 End If - Dim CveAlmacen As Integer = ddlAlmacen.SelectedValue.ToEntero + Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEntero() Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, CveConceptoAlmacen, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Vta/E1") If CveMovimientoInventario <= 0 Then @@ -11198,18 +11196,18 @@ Partial Class Ventas For Each Dr As DataRow In DtInv.Rows If GvInv.Rows(i).FCCheckBox("cbInv").Checked Then - CveProducto = Dr("CvePS").ToString.ToEntero - CveUnidad = Dr("CveUM").ToString.ToEntero - Cantidad = Dr("Cantidad").ToString.ToDouble + CveProducto = Dr("CvePS").ToString().ToEntero() + CveUnidad = Dr("CveUM").ToString().ToEntero() + Cantidad = Dr("Cantidad").ToString().ToDouble - If Dr("CveTipoInvPS").ToString.ToEntero = 5 And Dr("SerieLote").ToString = "" Then + If Dr("CveTipoInvPS").ToString().ToEntero() = 5 And Dr("SerieLote").ToString() = "" Then OcurrioError = True ErrorList.Add("Se deben especificar las Series de los productos de almacén") Exit For End If - If CveConceptoAlmacen = 3 AndAlso UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso Dr("EntregaDirecta").ToString.ToEntero < 1 Then - Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacen, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) + If CveConceptoAlmacen = 3 AndAlso UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso Dr("EntregaDirecta").ToString().ToEntero() < 1 Then + Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacen, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) If Existencia < Cantidad Then OcurrioError = True ErrorList.Add($"No cuenta con la cantidad suficiente en inventario del producto {Dr("CodigoPS")} .Cuenta con {Existencia.FormatoNumero(2)}.") @@ -11220,13 +11218,13 @@ Partial Class Ventas If UsuarioActual.CveEmpresa = 1 Then DtEquivalencias = New DataTable DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1, UsuarioActual.CveEmpresa) - Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero + Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero() Dim drUMBase As DataRow = DtEquivalencias.FiltroPrimero("UnidadBase = 'True'") 'SI LA UNIDAD ACTUAL NO ES LA BASE SACA PROPORCION (EQUIVALENTE) If CveUnidadBase <> CveUnidad Then ' LO QUE PUSE LO QUE VALE UNIDAD BASE LO QUE VALE UNIDAD SELECCIONADA - Cantidad = Dr("Cantidad").ToString.ToDouble * drUMBase("Cantidad").ToString.ToDouble / DtEquivalencias.FiltraParametros(String.Format("CveUM = {0}", CveUnidad)).Rows(0)("Cantidad").ToString.ToDouble + Cantidad = Dr("Cantidad").ToString().ToDouble * drUMBase("Cantidad").ToString().ToDouble / DtEquivalencias.FiltraParametros(String.Format("CveUM = {0}", CveUnidad)).Rows(0)("Cantidad").ToString().ToDouble CveUnidad = CveUnidadBase End If End If @@ -11234,7 +11232,7 @@ Partial Class Ventas If CveProducto > 0 Then 'SI ES ENTRADA DEBE TENER EL COSTO DE LA SALIDA If CveConceptoAlmacen.Contiene(18) Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal + PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()}").ToString().ToDecimal If PU <= 0 Then ErrorList.Add("Ocurrió un error al obtener el costo.
    ") OcurrioError = True @@ -11242,7 +11240,7 @@ Partial Class Ventas End If End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, Serie:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=Dr("SerieLote").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then OcurrioError = True ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.
    ") Exit For @@ -11291,19 +11289,19 @@ Partial Class Ventas ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado) End If - 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString, Row2("SubProyecto").ToString) - IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero + 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString(), Row2("SubProyecto").ToString()) + IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() + CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then OcurrioError = True End If End If cont += 1 Next End If - IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero + IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero() If TotalCosto <> 0 Then If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then @@ -11340,7 +11338,7 @@ Partial Class Ventas Next 'debe de ser por contrato el movimiento If Str.Length > 0 Then - If Not ObjContr.AddEstimaciones(CveContrato, factura.Fecha, -1, factura.CveVenta, Str.ToString, factura.CveUsuario, factura.CveEmpresa) Then + If Not ObjContr.AddEstimaciones(CveContrato, factura.Fecha, -1, factura.CveVenta, Str.ToString(), factura.CveUsuario, factura.CveEmpresa) Then ErrorList.Add("Ocurrió un error al agregar la estimación a la Factura.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") End If End If @@ -11378,25 +11376,25 @@ Partial Class Ventas Dim IdCtaContable, CveCuenta As Integer Dim Concepto As String Dim tipoCambio As Decimal - Dim CveSubProyectoContabilizar = DdlSubProyectoDatos.SelectedValue.ToEntero + Dim CveSubProyectoContabilizar = DdlSubProyectoDatos.SelectedValue.ToEntero() For Each RowIL As DataRow In TmpDTImpuestos.Rows - If RowIL("TipoImpuesto").ToString.ToEntero > 0 Then + If RowIL("TipoImpuesto").ToString().ToEntero() > 0 Then - Importe = RowIL("Importe").ToString.ToDecimal * ValorMultiplicador - IdCtaContable = RowIL("IdCtaContable").ToString.ToEntero - CveCuenta = RowIL("IdCtaContable").ToString.ToEntero - Concepto = ViewState("VentaFolio").ToString + Importe = RowIL("Importe").ToString().ToDecimal * ValorMultiplicador + IdCtaContable = RowIL("IdCtaContable").ToString().ToEntero() + CveCuenta = RowIL("IdCtaContable").ToString().ToEntero() + Concepto = ViewState("VentaFolio").ToString() If ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio > 0 Then tipoCambio = Factura.TipoCambio ElseIf ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio <= 1 Then - tipoCambio = GlobalTipoCambio(Factura.Fecha).ToString.ToDecimal + tipoCambio = GlobalTipoCambio(Factura.Fecha).ToString().ToDecimal Else tipoCambio = 1 End If - Select Case RowIL("TipoImpuesto").ToString + Select Case RowIL("TipoImpuesto").ToString() Case "1" If Not ObjConta.AddPrePolizasDetalle(Factura.CvePrePoliza, False, Importe, Concepto, 27, Concepto, Factura.Fecha, IdCtaContable:=IdCtaContable, IdSegmentoNegocio:=-1, CveVenta:=Factura.CveVenta, CveCliente:=Factura.CveCliente, ImporteMX:=Importe * tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True @@ -11432,25 +11430,25 @@ Partial Class Ventas If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) Dim TmpDTconceptos As DataTable = Nothing - Dim CveNCaVincular As Integer = DdlNCFactura.SelectedValue.ToEntero + Dim CveNCaVincular As Integer = DdlNCFactura.SelectedValue.ToEntero() 'CargaCliente - Dim CveCliente As Integer = drv("CveCliente").ToString.ToEntero + Dim CveCliente As Integer = drv("CveCliente").ToString().ToEntero() If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then Return Nothing ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then Return Nothing End If - factura.TipoDocto = drv("TipoDocto").ToString - factura.Serie = drv("Serie").ToString - factura.FechaEjecucion = drv("FechaEjecucion").ToString.ToDateTime - factura.Fecha = drv("Fecha").ToString.ToDateTime - factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString.ToEntero - factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString.ToEntero - factura.CveClienteSucursal = drv("CveClienteSucursal").ToString.ToEntero - factura.CveSubProyecto = drv("CveSubProyecto").ToString.ToEntero + factura.TipoDocto = drv("TipoDocto").ToString() + factura.Serie = drv("Serie").ToString() + factura.FechaEjecucion = drv("FechaEjecucion").ToString().ToDateTime + factura.Fecha = drv("Fecha").ToString().ToDateTime + factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString().ToEntero() + factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString().ToEntero() + factura.CveClienteSucursal = drv("CveClienteSucursal").ToString().ToEntero() + factura.CveSubProyecto = drv("CveSubProyecto").ToString().ToEntero() 'Carga Detalle Sucursal - CargaClienteSucursal(drv("CveClienteSucursal").ToString.ToEntero, ObjVentas) + CargaClienteSucursal(drv("CveClienteSucursal").ToString().ToEntero(), ObjVentas) 'CargaDetalle If ObjVentas.GetVentaDetalle(CveVenta) Then @@ -11461,23 +11459,23 @@ Partial Class Ventas End If 'Carga Totales - factura.SubTotal = drv("SubTotal").ToString.ToDecimal - factura.Descuento = drv("Descuento").ToString.ToDecimal - factura.Amortizacion = drv("Amortizacion").ToString.ToDecimal - factura.IVA = drv("IVA").ToString.ToDecimal - factura.RetIVA = drv("RetIVA").ToString.ToDecimal - factura.RetISR = drv("RetISR").ToString.ToDecimal - factura.Total = drv("Total").ToString.ToDecimal - factura.MotivoDescuento = drv("MotivoDescuento").ToString - factura.Observaciones = drv("Observaciones").ToString - factura.CveMoneda = drv("CveMoneda").ToString.ToEntero - factura.TipoCambio = drv("TipoCambio").ToString.ToDecimal - factura.CveVendedor = drv("CveVendedor").ToString.ToEntero - factura.RefDocto = drv("Ref").ToString - 'factura.SerieFolioPadre = drv("SerieFolio").ToString - HdnFolioFiscalNC.Value = drv("FolioFiscal").ToString + factura.SubTotal = drv("SubTotal").ToString().ToDecimal + factura.Descuento = drv("Descuento").ToString().ToDecimal + factura.Amortizacion = drv("Amortizacion").ToString().ToDecimal + factura.IVA = drv("IVA").ToString().ToDecimal + factura.RetIVA = drv("RetIVA").ToString().ToDecimal + factura.RetISR = drv("RetISR").ToString().ToDecimal + factura.Total = drv("Total").ToString().ToDecimal + factura.MotivoDescuento = drv("MotivoDescuento").ToString() + factura.Observaciones = drv("Observaciones").ToString() + factura.CveMoneda = drv("CveMoneda").ToString().ToEntero() + factura.TipoCambio = drv("TipoCambio").ToString().ToDecimal + factura.CveVendedor = drv("CveVendedor").ToString().ToEntero() + factura.RefDocto = drv("Ref").ToString() + 'factura.SerieFolioPadre = drv("SerieFolio").ToString() + HdnFolioFiscalNC.Value = drv("FolioFiscal").ToString() - ViewState("FolioFiscal") = drv("FolioFiscal").ToString + ViewState("FolioFiscal") = drv("FolioFiscal").ToString() 'JJMQ 20160506: Se agrego para la validacion de pago de contado. 'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") @@ -11486,7 +11484,7 @@ Partial Class Ventas If factura.CveCliente > 0 Then If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then - If Not drv("Total").ToString.ToDecimal = factura.Total Then + If Not drv("Total").ToString().ToDecimal = factura.Total Then Return Nothing End If @@ -11567,7 +11565,7 @@ Partial Class Ventas 'If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then ' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue)) ' If DT.Rows.Count > 0 Then - ' factura.Folio = DT.Rows(0)("FActual").ToString.ToEntero + ' factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero() ' Else ' ProcesoCorrecto = False ' End If @@ -11598,7 +11596,7 @@ Partial Class Ventas ' ObjTimbrado.TimbrarFactura(UsuarioActual, factura, FM, TmpDT, TmpDTImpuestos, TmpDT7Eleven, TmpDTComplementosTimbrado, Ruta, LstFordASN, TxtFordGSDB.Text, ObjVentas) ' sw.Stop() - ' GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC) + ' GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString(), UsuarioActual.Empresa.CvePAC) ' ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" Then ' GeneraPDFCBB(ObjFactura.Fecha, Nothing, ObjFactura.SerieFolio, False) @@ -11636,24 +11634,24 @@ Partial Class Ventas 'REINICIA VALORES DE CONVERSION DE MONEDA 'If Not ObjFactura.ConvertirPesos And ChkConvertirDoctoPesos.Checked Then ' For Each Row As DataRow In TmpDT.Rows - ' Row("PU") = Row("PU").ToString.ToDouble / TxtTipoCambio.Text.Trim.ToDecimal - ' Row("Total") = Row("Cantidad").ToString.ToDouble / Row("PU").ToString.ToDouble - ' Row("Descuento") = Row("Descuento").ToString.ToDouble / TxtTipoCambio.Text.Trim.ToDecimal - ' Row("IEPS") = Row("IEPS").ToString.ToDouble / TxtTipoCambio.Text.Trim.ToDecimal + ' Row("PU") = Row("PU").ToString().ToDouble / TxtTipoCambio.Text.Trim.ToDecimal + ' Row("Total") = Row("Cantidad").ToString().ToDouble / Row("PU").ToString().ToDouble + ' Row("Descuento") = Row("Descuento").ToString().ToDouble / TxtTipoCambio.Text.Trim.ToDecimal + ' Row("IEPS") = Row("IEPS").ToString().ToDouble / TxtTipoCambio.Text.Trim.ToDecimal ' Next 'End If Select Case ConversionRemision Case "*" For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) Next For Each gvr As GridViewRow In GvImpuestosLocales2.Rows @@ -11663,14 +11661,14 @@ Partial Class Ventas Next Case "/" For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) Next For Each gvr As GridViewRow In GvImpuestosLocales2.Rows @@ -11687,15 +11685,15 @@ Partial Class Ventas Select Case ConversionRemision Case "*" For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDouble * TipoCambioRemision, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) Next For Each gvr As GridViewRow In GvImpuestosLocales2.Rows @@ -11705,15 +11703,15 @@ Partial Class Ventas Next Case "/" For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDouble / TipoCambioRemision, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble / TipoCambioRemision, NumeroDecimales) Next For Each gvr As GridViewRow In GvImpuestosLocales2.Rows @@ -11738,8 +11736,8 @@ Partial Class Ventas If UsuarioActual.CveEmpresa = 8 AndAlso ObjFactura.TipoDocto.Contiene("Cot") Then Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("Sucursal", DdlSubProyectoDatos.SelectedItem.Text)) - 'params.Add(New ReportParameter("Fecha", FechaCotizacion.ToString)) - params.Add(New ReportParameter("Folio", ObjFactura.Folio.ToString)) + 'params.Add(New ReportParameter("Fecha", FechaCotizacion.ToString())) + params.Add(New ReportParameter("Folio", ObjFactura.Folio.ToString())) params.Add(New ReportParameter("Cliente", LtlCliente.Text)) params.Add(New ReportParameter("PersonaDirige", TxtAtencionA.Text)) params.Add(New ReportParameter("Total", TxtTotal.Text)) @@ -11963,42 +11961,42 @@ Partial Class Ventas Dim saldo As Decimal = 0 Dim tipoCambio As Decimal = 0 - Dim total As Decimal = TxtTotal.Text.ToString.ToDecimal + Dim total As Decimal = TxtTotal.Text.ToString().ToDecimal If CveVentaRelacion > 0 Then ' dejo seleccionado el la venta relacionado en anticipo - If e.Row.DataKey("CveVenta").ToEntero = CveVentaRelacion Then + If e.Row.DataKey("CveVenta").ToEntero() = CveVentaRelacion Then e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Checked = True - e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).Text = ImporteRelacion.ToString + e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).Text = ImporteRelacion.ToString() End If End If - If e.Row.DBCampo("Tipo").ToString = "NC" And e.Row.DataKey("CveVenta").ToString.ToEntero > 0 Then - If e.Row.DBCampo("CveMoneda").ToString.ToEntero = 2 Then - tipoCambio = e.Row.DBCampo("TipoCambioHoy").ToString.ToDecimal + If e.Row.DBCampo("Tipo").ToString() = "NC" And e.Row.DataKey("CveVenta").ToString().ToEntero() > 0 Then + If e.Row.DBCampo("CveMoneda").ToString().ToEntero() = 2 Then + tipoCambio = e.Row.DBCampo("TipoCambioHoy").ToString().ToDecimal Else - tipoCambio = GlobalTipoCambio(e.Row.DataKey("Fecha").ToString.ToDate).ToDecimal + tipoCambio = GlobalTipoCambio(e.Row.DataKey("Fecha").ToString().ToDate).ToDecimal End If e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Text = tipoCambio.FormatoNumero(4) - If DdlMoneda.SelectedValue.ToEntero = 1 And e.Row.DBCampo("CveMoneda").ToString.ToEntero = 1 Then + If DdlMoneda.SelectedValue.ToEntero() = 1 And e.Row.DBCampo("CveMoneda").ToString().ToEntero() = 1 Then saldo = e.Row.DataKey("Saldo").ToDecimal - ElseIf DdlMoneda.SelectedValue.ToEntero = 2 And e.Row.DBCampo("CveMoneda").ToString.ToEntero = 1 And tipoCambio > 0 Then - saldo = (e.Row.DataKey("Saldo").ToString.ToDecimal / tipoCambio) - ElseIf DdlMoneda.SelectedValue.ToEntero = 1 And e.Row.DBCampo("CveMoneda").ToString.ToEntero = 2 Then - saldo = (e.Row.DataKey("Saldo").ToString.ToDecimal * tipoCambio) + ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 And e.Row.DBCampo("CveMoneda").ToString().ToEntero() = 1 And tipoCambio > 0 Then + saldo = (e.Row.DataKey("Saldo").ToString().ToDecimal / tipoCambio) + ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 And e.Row.DBCampo("CveMoneda").ToString().ToEntero() = 2 Then + saldo = (e.Row.DataKey("Saldo").ToString().ToDecimal * tipoCambio) Else saldo = e.Row.DataKey("Saldo").ToDecimal End If Else - saldo = e.Row.DataKey("Saldo").ToString.ToDecimal + saldo = e.Row.DataKey("Saldo").ToString().ToDecimal If CveVenta <= 0 Then - saldo = e.Row.DataKey("SaldoSubTotal").ToString.ToDecimal + saldo = e.Row.DataKey("SaldoSubTotal").ToString().ToDecimal e.Row.FCLiteral("LtlAnticipos").Text = saldo.FormatoNumero End If @@ -12017,7 +12015,7 @@ Partial Class Ventas 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)) e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("CambioTipoMoneda({0},{1},{2},{3},{4});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, e.Row.DataKey("Saldo"), e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).ClientID, e.Row.DataKey("CveMoneda"))) - If e.Row.DataKey("CveIE").ToString.ToEntero > 0 Then + If e.Row.DataKey("CveIE").ToString().ToEntero() > 0 Then e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DataKey("CveIE"), e.Row.DataKey("Folio")) Else e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DataKey("CveVenta"), e.Row.DataKey("Folio")) @@ -12037,13 +12035,13 @@ Partial Class Ventas End If 'SI UN REGISTRO ES DE DIFERENTE MONEDA AL DOCUMENTO SE MUESTRAN LAS COLUMNAS - If e.Row.DBCampo("CveMoneda").ToString.ToEntero > 0 And e.Row.DBCampo("CveMoneda").ToString.ToEntero <> DdlMoneda.SelectedValue.ToEntero Then + If e.Row.DBCampo("CveMoneda").ToString().ToEntero() > 0 And e.Row.DBCampo("CveMoneda").ToString().ToEntero() <> DdlMoneda.SelectedValue.ToEntero() Then GVAnticipos.Columns(4).Visible = True GVAnticipos.Columns(6).Visible = True End If - If e.Row.DBCampo("CveMoneda").ToString.ToEntero = DdlMoneda.SelectedValue.ToEntero Then + If e.Row.DBCampo("CveMoneda").ToString().ToEntero() = DdlMoneda.SelectedValue.ToEntero() Then e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Visible = False End If @@ -12067,7 +12065,7 @@ Partial Class Ventas 'If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then - ' CveSubProyecto = TmpDT.FiltroPrimeroValor("CveSubProyecto").ToEntero + ' CveSubProyecto = TmpDT.FiltroPrimeroValor("CveSubProyecto").ToEntero() 'End If Dim EsAnticipo2017Jam As Boolean = False @@ -12076,7 +12074,7 @@ Partial Class Ventas If gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal > SaldoVenta Then Alert("No puede ingresar un importe mayor al saldo", TipoMensaje.MsgAdvertencia) Exit Sub - ElseIf UsuarioActual.CveEmpresa = 119 AndAlso gvr.DataKey("Tipo").ToString = "NC" AndAlso gvr.DataKey("Fecha").ToDate.Year <= 2017 Then + ElseIf UsuarioActual.CveEmpresa = 119 AndAlso gvr.DataKey("Tipo").ToString() = "NC" AndAlso gvr.DataKey("Fecha").ToDate.Year <= 2017 Then EsAnticipo2017Jam = True End If End If @@ -12119,7 +12117,7 @@ Partial Class Ventas 'End If 'Dim Now As DateTime = New DateTime(2020, 2, 19) Try - CvePrepoliza = ObjConta.AddPrePolizas("Ventas/Anticipos", CvePlantillaPoliza, TxtTotal.Text.ToDecimal, TxtTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, TxtFechaAnticipoCliente.Text.ToDate, String.Format("{0} {1} {2}-{3}", If(EsAnticipo2017Jam, "Aplicación Anticipo 2017", ""), NombreCliente, Serie, TxtFolio.Text), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + CvePrepoliza = ObjConta.AddPrePolizas("Ventas/Anticipos", CvePlantillaPoliza, TxtTotal.Text.ToDecimal, TxtTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero(), TxtFechaAnticipoCliente.Text.ToDate, String.Format("{0} {1} {2}-{3}", If(EsAnticipo2017Jam, "Aplicación Anticipo 2017", ""), NombreCliente, Serie, TxtFolio.Text), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If CvePrepoliza > 0 Then Dim tipoCambioPago As Decimal = 1 @@ -12127,7 +12125,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 = DdlMoneda.SelectedValue.ToEntero() If ObjConta.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then dtConceptos = ObjConta.DtResultados End If @@ -12141,10 +12139,10 @@ Partial Class Ventas If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then Dim Dr As DataRow = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).FiltroPrimero("") - IdCtaIVAXTrasladar = Dr("IdCtaIVAXTrasladar").ToString.ToEntero - IdCtaIVATrasladado = Dr("IdCtaIVATrasladado").ToString.ToEntero - CveCuentaIVAXTrasladar = Dr("CveCuentaIVAXTrasladar").ToString.ToEntero - CveCuentaIVATrasladado = Dr("CveCuentaIVATrasladado").ToString.ToEntero + IdCtaIVAXTrasladar = Dr("IdCtaIVAXTrasladar").ToString().ToEntero() + IdCtaIVATrasladado = Dr("IdCtaIVATrasladado").ToString().ToEntero() + CveCuentaIVAXTrasladar = Dr("CveCuentaIVAXTrasladar").ToString().ToEntero() + CveCuentaIVATrasladado = Dr("CveCuentaIVATrasladado").ToString().ToEntero() End If For Each gvr As GridViewRow In GVAnticipos.Rows @@ -12160,29 +12158,29 @@ Partial Class Ventas Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC") If drr IsNot Nothing Then - FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate - TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal + FechaUltimaFluctuacion = drr("Fecha").ToString().ToDate + TipoCambioFluctuacion = drr("TipoCambio").ToString().ToDecimal End If 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 + 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 tipoCambioVentaValuacion = 1 PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal - ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'SI LA VENTA VIENE EN DOLARES Y SE VA A PAGAR EN PESOS + ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then 'SI LA VENTA VIENE EN DOLARES Y SE VA A PAGAR EN PESOS tipoCambioPago = gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal tipoCambioVenta = TxtTipoCambio.Text.ToDecimal tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal) PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal - ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'SI LA VENTA VIENE EN DOLARES Y SE VA A PAGAR EN DOLARES - tipoCambioPago = gvr.DataKey("TipoCambio").ToString.ToDecimal + ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then 'SI LA VENTA VIENE EN DOLARES Y SE VA A PAGAR EN DOLARES + tipoCambioPago = gvr.DataKey("TipoCambio").ToString().ToDecimal tipoCambioVenta = TxtTipoCambio.Text.ToDecimal tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal) PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal - ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN DOLARES + ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN DOLARES tipoCambioPago = gvr.DataKey("TipoCambioHoy").ToDecimal() ' gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal tipoCambioVenta = 1 tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal) @@ -12192,14 +12190,14 @@ Partial Class Ventas If dtConceptos IsNot Nothing Then For Each Row As DataRow In dtConceptos.Rows - Dim ConceptoContable = Row("CveConcepto").ToString.ToEntero - Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString = "True", True, False) + Dim ConceptoContable = Row("CveConcepto").ToString().ToEntero() + Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString() = "True", True, False) Dim importeMovimiento As Decimal = 0 Dim importeMX As Decimal = 0 Dim IdCtaContable As Integer = 0 Dim CveCuenta As Integer = 0 Dim FechaMovimiento As Date = Now - Dim Concepto As String = ViewState("VentaFolio").ToString + Dim Concepto As String = ViewState("VentaFolio").ToString() Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False) Dim TipoCambioGeneral As Decimal = 1 Dim PorcentajeImpuesto As Decimal = 0 @@ -12207,17 +12205,17 @@ Partial Class Ventas Select Case ConceptoContable Case 2 'Cliente 'If CveMonedaVenta > 1 Then ConceptoContable = 292 - If Not (gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66) Then - If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then + If Not (gvr.DataKey("CveIE").ToString().ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66) Then + If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal importeMX = importeMovimiento - ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then + ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal importeMX = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioVentaValuacion - ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal importeMX = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioVentaValuacion - ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal importeMX = importeMovimiento End If @@ -12234,13 +12232,13 @@ Partial Class Ventas If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsaComplementariaClientes) Then 'Conta ContPAQ If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If 'Conta SIG If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If @@ -12258,8 +12256,8 @@ Partial Class Ventas ConceptoContable = 251 ' cambia para dejar el concepto 2, solamente para pago en banco End If Case 11 'Anticipo - If gvr.DataKey("CveConceptoContable").ToString().ToEntero = 3 Then - CveIEAnticipo = gvr.DataKey("CveIE").ToString.ToEntero + If gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then + CveIEAnticipo = gvr.DataKey("CveIE").ToString().ToEntero() importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal) 'Mantenemos la integridad de la suma para el pagocliente @@ -12273,17 +12271,17 @@ Partial Class Ventas 'Conta ContPAQ If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If 'Conta SIG If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If - If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveVentaAmortizacion:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambioPago, ImporteME:=If(tipoCambioPago = 1, 0, importeMovimiento), CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambioPago, ImporteME:=If(tipoCambioPago = 1, 0, importeMovimiento), CveCuenta:=CveCuenta) Then ErrorConta = True End If End If @@ -12302,53 +12300,53 @@ Partial Class Ventas importeMovimiento = 0 Case 91 'Amortizacion Nota de Credito Dim TC As Decimal = 1 - If gvr.DataKey("CveConceptoContable").ToString().ToEntero = 12 Then - If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 1 Then + If gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 12 Then + If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 1 Then importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal importeMX = importeMovimiento - TC = gvr.DataKey("TipoCambio").ToString.ToDecimal - ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then + TC = gvr.DataKey("TipoCambio").ToString().ToDecimal + ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - importeMX = importeMovimiento * gvr.DataKey("TipoCambio").ToString.ToDecimal - TC = gvr.DataKey("TipoCambio").ToString.ToDecimal - ElseIf CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then + importeMX = importeMovimiento * gvr.DataKey("TipoCambio").ToString().ToDecimal + TC = gvr.DataKey("TipoCambio").ToString().ToDecimal + ElseIf CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal importeMX = importeMovimiento * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal TC = TipoCambioFluctuacion - ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 1 Then + ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 1 Then importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal importeMX = importeMovimiento - TC = gvr.DataKey("TipoCambio").ToString.ToDecimal + TC = gvr.DataKey("TipoCambio").ToString().ToDecimal End If importeMovimiento = Math.Round(importeMovimiento, 2) importeMX = Math.Round(importeMX, 2) If ObjConta.GetRetCuenta(ConceptoContable, CveCliente) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString().ToEntero() + CveCuenta = ObjConta.DtResultados.Rows(0)("IdCtaContableSIG").ToString().ToEntero() End If End If If importeMovimiento <> 0 Then 'Conta ContPAQ If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If Dim ImporteComplementaria As Decimal = 0 - If UsaComplementariaClientes = True AndAlso gvr.DataKey("CveMoneda").ToString.ToDecimal > 1 Then + If UsaComplementariaClientes = True AndAlso gvr.DataKey("CveMoneda").ToString().ToDecimal > 1 Then IdCtaContable = IdCtaContComplementaria CveCuenta = 0 importeMX = importeMovimiento ImporteComplementaria = ((importeMovimiento * TC) - importeMovimiento).RoundSQL - If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString.ToDecimal = 1, 0, importeMovimiento), TipoCambio:=TC) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString().ToDecimal = 1, 0, importeMovimiento), TipoCambio:=TC) Then ErrorConta = True Exit For End If @@ -12361,7 +12359,7 @@ Partial Class Ventas CveCuenta = 0 End If - If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TC) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TC) Then ErrorConta = True Exit For End If @@ -12369,8 +12367,8 @@ Partial Class Ventas 'AMORTIZA NC CONTRA ANTICIPO A CLIENTES If Not ErrorConta And DdlTipoComprobante.SelectedValue = "Ant" Then importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal) * gvr.DataKey("IVA").ToDecimal) - If ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=gvr.DataKey("CveVenta").ToString.ToEntero, ImporteMX:=importeMovimiento * TC, CveCuenta:=CveCuenta) Then - If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero, -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * TC, CveCuenta:=gvr.DataKey("IdCtaContableNCSIG").ToEntero) Then + If ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=gvr.DataKey("CveVenta").ToString().ToEntero(), ImporteMX:=importeMovimiento * TC, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero(), -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero(), CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * TC, CveCuenta:=gvr.DataKey("IdCtaContableNCSIG").ToEntero()) Then ErrorConta = True Exit For End If @@ -12384,8 +12382,8 @@ Partial Class Ventas Importe91 = importeMovimiento importeMovimiento = 0 Case 92 'Amortizacion Ingreso X Comprobar - If gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66 Then - CveIEAnticipo = gvr.DataKey("CveIE").ToString.ToEntero + If gvr.DataKey("CveIE").ToString().ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66 Then + CveIEAnticipo = gvr.DataKey("CveIE").ToString().ToEntero() importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal IdCtaContable = IdCtaContClientes CveCuenta = CveCuentaClientes @@ -12469,7 +12467,7 @@ Partial Class Ventas IdCtaContable = IdCtaContAnticipos CveCuenta = CveCuentaAnticipos - If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero(), "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then If ObjCliente.DtResultados.Rows.Count > 0 Then If Not tipoCambioPago = 1 Then IdCtaContable = ObjCliente.IdCtaMonedaExtranjeraAnticipos @@ -12500,13 +12498,13 @@ Partial Class Ventas End If importeMovimiento = 0 Case 64 'Ganancia - If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then + If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero() <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria - If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then + If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then - If tipoCambioVentaValuacion > tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + If tipoCambioVentaValuacion > tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then importeMovimiento = Importe91 * (tipoCambioVentaValuacion - tipoCambioPago) 'Añadimos la diferencia de ganancia en la venta importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2)) importeMX = importeMovimiento @@ -12515,9 +12513,9 @@ Partial Class Ventas Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago) TipoCambioGeneral = TCImpuestos Else - Dim TipoCambioGanancia As Decimal = If(Not (gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66), tipoCambioVentaValuacion, tipoCambioVenta) + Dim TipoCambioGanancia As Decimal = If(Not (gvr.DataKey("CveIE").ToString().ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta) - If tipoCambioPago > TipoCambioGanancia AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + If tipoCambioPago > TipoCambioGanancia AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then importeMovimiento = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioPago) - (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * TipoCambioGanancia) 'Añadimos la diferencia de ganancia en la venta importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2)) importeMX = importeMovimiento @@ -12530,12 +12528,12 @@ Partial Class Ventas importeMovimiento = 0 End If Case 65 'Perdida - If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then + If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero() <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria - If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then - If tipoCambioVentaValuacion < tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then + If tipoCambioVentaValuacion < tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then importeMovimiento = Importe91 * Math.Abs(tipoCambioVentaValuacion - tipoCambioPago) 'Añadimos la diferencia de ganancia en la venta importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2)) importeMX = importeMovimiento @@ -12544,9 +12542,9 @@ Partial Class Ventas Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago) TipoCambioGeneral = TCImpuestos Else - Dim TipoCambioPerdida As Decimal = If(Not (gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66), tipoCambioVentaValuacion, tipoCambioVenta) + Dim TipoCambioPerdida As Decimal = If(Not (gvr.DataKey("CveIE").ToString().ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta) - If tipoCambioPago < TipoCambioPerdida AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + If tipoCambioPago < TipoCambioPerdida AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then importeMovimiento = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * TipoCambioPerdida) - (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2)) importeMX = importeMovimiento @@ -12565,12 +12563,12 @@ Partial Class Ventas If importeMovimiento <> 0 Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If @@ -12586,14 +12584,7 @@ Partial Class Ventas ErrorConta = True End If - 'Simplificacion de PrePolizas - If Not ErrorConta AndAlso ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then - If Not ObjConta.PrePolizaSimplificacion(CvePrepoliza, UsuarioActual.CveEmpresa) Then - Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError) - End If - End If - - If Not ErrorConta AndAlso ObjConta.ValidacionPrePolizaCuadre(CvePrepoliza, 3) Then + If ObjConta.ValidacionPrePolizaCuadre(CvePrepoliza, 3) Then If ObjConta.ValorPolizaDescuadre > 0 Then GuardaLogAD($"Ventas/Ventas-Anticipos | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrepoliza}", "LogPrePolizas") ErrorConta = True @@ -12625,7 +12616,7 @@ Partial Class Ventas ObjContpaq.AjustaPoliza(ContaIdPoliza) ObjContpaq.Commit() End If - Alert(Msg.ToString, TipoMensaje.MsgInformacion) + Alert(Msg.ToString(), TipoMensaje.MsgInformacion) End If ObjConta.Dispose() @@ -12644,12 +12635,12 @@ Partial Class Ventas HdnIVACalculado.Value = HdnIVAOriginal.Value For Each gvr As GridViewRow In GVAnticipos.Rows - If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero.Contiene(3) Then + If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal ' - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal) HdnIVACalculado.Value = (HdnIVACalculado.Value.ToDouble - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)).FormatoNumero(2) HdnFolioFiscalNC.Value = gvr.DataKey("FolioFiscal") - 'CvePSAmortizacion = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", "CveConceptoContable = 11").ToEntero + 'CvePSAmortizacion = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", "CveConceptoContable = 11").ToEntero() End If Next 'Amortizacion += TmpDTImpuestos.SUM("Importe").ToDecimal 'RMF. 2018.12.20- saque de la jugada en la amortización los impuestos locales @@ -12668,8 +12659,8 @@ Partial Class Ventas Dim Cantidad, PU, Descuento, DescuentoRound As Decimal For Each dr As DataRow In TmpDT.Rows - Cantidad = dr("Cantidad").ToString.ToDecimal - PU = dr("PU").ToString.ToDecimal + Cantidad = dr("Cantidad").ToString().ToDecimal + PU = dr("PU").ToString().ToDecimal 'proporcional la mortización al concepto Descuento = (PU * Cantidad / LblSubTotal1.Text.ToDecimal * Amortizacion) DescuentoRound = Descuento.RoundSQL(NumeroDecimales) @@ -12679,8 +12670,8 @@ Partial Class Ventas TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento dr("Descuento") = DescuentoRound dr("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales) - dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) - dr("ImporteIEPS") = Math.Round(dr("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + dr("ImporteIEPS") = Math.Round(dr("PorcentajeIEPS").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales) dr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales) dr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales) dr("PorcentajeRetIVA") = ClienteRetIVA @@ -12767,7 +12758,7 @@ Partial Class Ventas Dim ImporteMX As Decimal Dim IdCtaContable, CveCuenta As Integer Dim FechaMovimiento As Date = Now - Dim Concepto As String = ViewState("VentaFolio").ToString + Dim Concepto As String = ViewState("VentaFolio").ToString() Dim PrePolizaCorrecta = True Dim PorcentajeImpuesto As Decimal = 0 Dim IdCtaIVAXTrasladar As Integer = 0 @@ -12778,20 +12769,20 @@ Partial Class Ventas ImporteMX = Math.Round(ImporteMovimiento, 2) * TipoCambio PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then - IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXTrasladar").ToString.ToEntero - CveCuentaIVAxTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVAXTrasladar").ToString.ToEntero + IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXTrasladar").ToString().ToEntero() + CveCuentaIVAxTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVAXTrasladar").ToString().ToEntero() End If IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) CveCuenta = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) If ImporteMovimiento > 0 Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 13))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 13))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 13))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 13))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If @@ -12810,20 +12801,20 @@ Partial Class Ventas Else If ObjConta.GetRetCuenta(8, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString().ToEntero() + CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString().ToEntero() End If End If End If If ImporteMovimiento > 0 Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 8))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 8))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 8))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 8))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If @@ -12842,7 +12833,7 @@ Partial Class Ventas Else If ObjConta.GetRetCuenta(9, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString().ToEntero() End If End If End If @@ -12853,19 +12844,19 @@ Partial Class Ventas Else If ObjConta.GetRetCuenta(9, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero + CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString().ToEntero() End If End If End If If ImporteMovimiento > 0 Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 9))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 9))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If If IdCtaContable <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 9))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 9))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If @@ -12884,7 +12875,7 @@ Partial Class Ventas Dim ImporteMX As Decimal Dim IdCtaContable, CveCuenta As Integer Dim FechaMovimiento As Date = Now - Dim Concepto As String = ViewState("VentaFolio").ToString + Dim Concepto As String = ViewState("VentaFolio").ToString() Dim PrePolizaCorrecta = True Dim PorcentajeImpuesto As Decimal = 0 Dim IdCtaIVATrasladado As Integer = 0 @@ -12895,8 +12886,8 @@ Partial Class Ventas ImporteMX = Math.Round(ImporteMovimiento * TipoCambio, 2) PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then - IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVATrasladado").ToString.ToEntero - CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVATrasladado").ToString.ToEntero + IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVATrasladado").ToString().ToEntero() + CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVATrasladado").ToString().ToEntero() End If IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) CveCuenta = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) @@ -12904,13 +12895,13 @@ Partial Class Ventas If ImporteMovimiento > 0 Then 'ContaContPAQ If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 61))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 61))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If 'ContaSIG If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 61))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 61))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If @@ -12928,7 +12919,7 @@ Partial Class Ventas IdCtaContable = IdCtaContRetIVA Else If ObjConta.GetRetCuenta(62, UsuarioActual.CveEmpresa) Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString().ToEntero() End If End If @@ -12937,18 +12928,18 @@ Partial Class Ventas CveCuenta = CveCuentaRetIVA Else If ObjConta.GetRetCuenta(62, UsuarioActual.CveEmpresa) Then - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero + CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString().ToEntero() End If End If If ImporteMovimiento > 0 Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 62))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 62))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 62))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 62))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If @@ -12967,7 +12958,7 @@ Partial Class Ventas Else If ObjConta.GetRetCuenta(63, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero + IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString().ToEntero() End If End If End If @@ -12977,19 +12968,19 @@ Partial Class Ventas Else If ObjConta.GetRetCuenta(63, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero + CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString().ToEntero() End If End If End If If ImporteMovimiento > 0 Then If IdCtaContable <= 0 Then - CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 63))("ConceptoContable").ToString) + CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 63))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If If CveCuenta <= 0 Then - CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 63))("ConceptoContable").ToString) + CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 63))("ConceptoContable").ToString()) CveCuentaContabilizacion = 0 End If @@ -13021,7 +13012,7 @@ Partial Class Ventas ObjFactura.Serie = Serie ObjFactura.Folio = Folio ObjFactura.Timbre.Comprobante.Serie = Serie - ObjFactura.Timbre.Comprobante.Folio = Folio.ToString + ObjFactura.Timbre.Comprobante.Folio = Folio.ToString() Dim ObjTimbrado As New Timbrado Dim FM As New Modelos.FemsaFactura @@ -13062,15 +13053,15 @@ Partial Class Ventas If ObjFactura.TipoDocto = "Ing" AndAlso ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07" Then CreaObjetosVentaAmortizacion(Nothing, ObjTimbrado.UUID, ObjFactura.CveVentaRelacion, CveVenta) For Each Gvr As GridViewRow In GvAntNC.Rows - If Gvr.DataKey("FolioFiscal").ToString = "" AndAlso Gvr.DataKey("TipoDocto") = "Egs" Then - ObjFacturaDevolucion.CveVenta = Gvr.DataKey("CveVenta").ToEntero - ObjFacturaDevolucion.Serie = Gvr.DataKey("Serie").ToString - ObjFacturaDevolucion.Folio = Gvr.DataKey("Folio").ToEntero + If Gvr.DataKey("FolioFiscal").ToString() = "" AndAlso Gvr.DataKey("TipoDocto") = "Egs" Then + ObjFacturaDevolucion.CveVenta = Gvr.DataKey("CveVenta").ToEntero() + ObjFacturaDevolucion.Serie = Gvr.DataKey("Serie").ToString() + ObjFacturaDevolucion.Folio = Gvr.DataKey("Folio").ToEntero() ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion) End If Exit For Next - If ObjFacturaDevolucion.CveVenta.ToEntero > 0 Then + If ObjFacturaDevolucion.CveVenta.ToEntero() > 0 Then Dim Obj2 As New List(Of Object) Obj2.Add(ObjFacturaDevolucion) If Not IsNothing(Obj2) AndAlso Obj2.Count > 0 Then @@ -13106,7 +13097,7 @@ Partial Class Ventas 'MUESTA Alert OK 'MensajeAlert.Append("El Documento se generó correctamente") Dim Liga = If(UsuarioActual.CveRol = 1165, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}&Opt=3"";") - Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion, Liga) + Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga) TrEmitir.Visible = False Else @@ -13128,7 +13119,7 @@ Partial Class Ventas If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2) - Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble + Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString().ToDouble If IVAPromedio <> IVA Then Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError) @@ -13148,7 +13139,7 @@ Partial Class Ventas ElseIf HdnTipoDescuento.Value = "3" Then If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2) - Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble + Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString().ToDouble If IVAPromedio <> IVA Then Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError) @@ -13214,11 +13205,11 @@ Partial Class Ventas Dim ObjCancelacion As New Timbrado Dim ObjBanco As New ClsBancos - Dim CveComplementoPago As Integer = GvRow.DataKey("CveComplementoPago").ToEntero - Dim FolioFiscal As String = GvRow.DataKey("FolioFiscal").ToString + Dim CveComplementoPago As Integer = GvRow.DataKey("CveComplementoPago").ToEntero() + Dim FolioFiscal As String = GvRow.DataKey("FolioFiscal").ToString() Dim RFCEmisor As String = UsuarioActual.Empresa.RFC Dim RFCReceptor As String = GvRow.DataKey("RFCReceptor") - Dim CvePACCancelacion As Integer = GvRow.DataKey("CvePAC").ToEntero + Dim CvePACCancelacion As Integer = GvRow.DataKey("CvePAC").ToEntero() If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, 0, RFCReceptor, RFCEmisor, CvePACCancelacion) Then @@ -13249,7 +13240,7 @@ Partial Class Ventas Protected Function CancelarMovimientoInventario(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, CveVentaNueva As Integer, CveVentaVieja As Integer) As Boolean 'SI YA ESTA QUEMADA DE ALMACEN LA VENTA, NO SE CANCELAN LOS MOVIMIENTOS DE INVENTARIO - If ObjInventario.GetEstatusVentaPorSurtir(CveVentaVieja) Then + If ObjInventario.GetEstatusVentaPorSurir(CveVentaVieja) Then If ObjInventario.EsDevolucionVenta = 2 Then Return True End If @@ -13268,11 +13259,11 @@ Partial Class Ventas DTMovimientosDetalles = ObjInventario.DtResultados.FiltraParametros("CvePS > 0") For Each Mov As DataRow In DtMovimientos.Rows - If ObjInventario.GetMovimientos(Mov("CveMovimiento").ToString.ToEntero, 3, -1, UsuarioActual.CveEmpresa) Then + If ObjInventario.GetMovimientos(Mov("CveMovimiento").ToString().ToEntero(), 3, -1, UsuarioActual.CveEmpresa) Then If ObjInventario.DtResultados.Rows.Count > 0 Then - Dim CveAlmacen As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString.ToEntero - Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString.ToEntero + Dim CveAlmacen As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString().ToEntero() + Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString().ToEntero() Dim Fecha As Date = Now 'Creamos el movimiento de entrada y el movimiento de salida @@ -13284,24 +13275,24 @@ Partial Class Ventas 'Creamos sus detalles For Each MovDet As DataRow In DTMovimientosDetalles.FiltraParametros($"CveMovimiento = {Mov("CveMovimiento")}").Rows - Dim Cantidad As Double = MovDet("Cantidad").ToString.ToDouble - Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero - Dim PU As Decimal = MovDet("PU").ToString.ToDecimal - Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero - Dim Serie As String = MovDet("Serie").ToString + Dim Cantidad As Double = MovDet("Cantidad").ToString().ToDouble + Dim CveUnidad As Integer = MovDet("CveUM").ToString().ToEntero() + Dim PU As Decimal = MovDet("PU").ToString().ToDecimal + Dim CveProducto As Integer = MovDet("CvePS").ToString().ToEntero() + Dim SerieLote As String = MovDet("SerieLote").ToString() - Dim CveVentaDetalle = MovDet("CveVentaDetalle").ToString.ToEntero + Dim CveVentaDetalle = MovDet("CveVentaDetalle").ToString().ToEntero() 'Entrada - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioEntrada, Cantidad, CveUnidad, CveProducto, PU, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioEntrada, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle) Then OcurrioError = True Exit For End If 'Salida - CveVentaDetalle = ObjInventario.VentaDetallePadreGet(CveVentaDetalle).ToString.ToEntero + CveVentaDetalle = ObjInventario.VentaDetallePadreGet(CveVentaDetalle).ToString().ToEntero() If CveVentaDetalle > 0 Then - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioSalida, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioSalida, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle) Then OcurrioError = True Exit For End If @@ -13320,15 +13311,15 @@ Partial Class Ventas Dim ValorInventario As Decimal = 0 For Each RowInv As DataRow In tmpCostos.Rows - ValorInventario = DTMovimientosDetalles.SUM("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).ToString.ToDecimal.RoundSQL() - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero + ValorInventario = DTMovimientosDetalles.SUM("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).ToString().ToDecimal.RoundSQL() + IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() + CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() If ValorInventario <> 0 Then 'Entrada - If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveDevolucion, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventarioEntrada, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveDevolucion, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventarioEntrada, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then 'Salida - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventarioSalida, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventarioSalida, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then OcurrioError = True Exit For End If @@ -13343,8 +13334,8 @@ Partial Class Ventas Exit For End If - IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {ddlAlmacen.SelectedValue}").ToEntero - CveCuenta = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {ddlAlmacen.SelectedValue}").ToEntero + IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {ddlAlmacen.SelectedValue}").ToEntero() + CveCuenta = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {ddlAlmacen.SelectedValue}").ToEntero() ValorInventario = DTMovimientosDetalles.SUMD("Total", $"CveMovimiento = {Mov("CveMovimiento")}").RoundSQL() If ValorInventario <> 0 Then @@ -13406,7 +13397,7 @@ Partial Class Ventas End If - CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardaEstatus", CvePlantillaPoliza, TxtTotal.Text.ToDouble, TxtTotal.Text.Replace(",", "").ToDouble, DdlMoneda.SelectedValue.ToEntero, Now, NombreCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardaEstatus", CvePlantillaPoliza, TxtTotal.Text.ToDouble, TxtTotal.Text.Replace(",", "").ToDouble, DdlMoneda.SelectedValue.ToEntero(), Now, NombreCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) ObjFacturaDevolucion.CveVenta = CveVenta ObjFacturaDevolucion.CvePrePoliza = CvePrePoliza @@ -13502,7 +13493,7 @@ Partial Class Ventas End If - CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardaEstatus", CvePlantillaPoliza, TxtTotal.Text.ToDouble, TxtTotal.Text.Replace(",", "").ToDouble, DdlMoneda.SelectedValue.ToEntero, Now, NombreCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardaEstatus", CvePlantillaPoliza, TxtTotal.Text.ToDouble, TxtTotal.Text.Replace(",", "").ToDouble, DdlMoneda.SelectedValue.ToEntero(), Now, NombreCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) ObjFactura.CveVenta = CveVenta ObjFactura.CvePrePoliza = CvePrePoliza @@ -13589,7 +13580,7 @@ Partial Class Ventas Row("Titulo") = tbTituloF.Text Row("Nombre") = tbNmbF.Text Row("Puesto") = tbPuesF.Text - Row("Lado") = ddlPos.SelectedValue.ToEntero + Row("Lado") = ddlPos.SelectedValue.ToEntero() DTmpF.Rows.Add(Row) tbNmbF.Text = "" tbPuesF.Text = "" @@ -13614,13 +13605,13 @@ Partial Class Ventas Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") If drPS IsNot Nothing Then - 'HdnUnidadMedida.Value = PS.Rows(0)("CveUnidadMedida").ToString - HdnPS.Value = drPS("PS").ToString - HdnCodigoPS.Value = drPS("PSCodigo").ToString - HdnTipoPS.Value = drPS("CveTipoPS").ToString - HdnTipoInv.Value = drPS("Inv_CveMetodoInventario").ToString - HdnAplicaIEPS.Value = drPS("AplicaIEPS").ToString - HdnPorcentajeIEPS.Value = drPS("IEPSPorcentaje").ToString + 'HdnUnidadMedida.Value = PS.Rows(0)("CveUnidadMedida").ToString() + HdnPS.Value = drPS("PS").ToString() + HdnCodigoPS.Value = drPS("PSCodigo").ToString() + HdnTipoPS.Value = drPS("CveTipoPS").ToString() + HdnTipoInv.Value = drPS("Inv_CveMetodoInventario").ToString() + HdnAplicaIEPS.Value = drPS("AplicaIEPS").ToString() + HdnPorcentajeIEPS.Value = drPS("IEPSPorcentaje").ToString() DdlUnidadMedida.Items.Clear() If UsuarioActual.Empresa.UsaInventarios Then DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(CvePSParametro, -1, UsuarioActual.CveEmpresa) @@ -13630,10 +13621,10 @@ Partial Class Ventas DdlUnidadMedida.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlUnidadMedida.SelectedValue = "-1" DdlUnidadMedida.DataBind() - DdlUnidadMedida.SelectedValueExist(drPS("CveUnidadMedida").ToString) + DdlUnidadMedida.SelectedValueExist(drPS("CveUnidadMedida").ToString()) - If drPS("CveTipoPS").ToString = "1" Then 'Si es servicio - If UsuarioActual.Empresa.Funcionalidad(558).ToString = "1" Then 'Si es Empresa llantera + If drPS("CveTipoPS").ToString() = "1" Then 'Si es servicio + If UsuarioActual.Empresa.Funcionalidad(558).ToString() = "1" Then 'Si es Empresa llantera TxtPrecio.Enabled = True Else 'TxtPrecio.Enabled = False @@ -13643,13 +13634,13 @@ Partial Class Ventas End If If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then - DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString) + DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString()) CambiaMoneda() End If 'SUGIERE PRECIO Dim PrecioSugerido = 0.0 - PrecioSugerido = drPS("Precio").ToString.ToDouble + PrecioSugerido = drPS("Precio").ToString().ToDouble If UsuarioActual.CveEmpresa.Contiene(1) Then Dim ObjPS As New ClsProductosServicios @@ -13662,8 +13653,8 @@ Partial Class Ventas ObjPS.Dispose() End If - If UsuarioActual.Empresa.Funcionalidad(404).ToString = "1" Then - Dim CvePrecioListaPS As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero + If UsuarioActual.Empresa.Funcionalidad(404).ToString() = "1" Then + Dim CvePrecioListaPS As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero() If CvePrecioListaPS > 0 Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then @@ -13674,7 +13665,7 @@ Partial Class Ventas Dim PorcentajePrecio As Double = 0 If PrecioSugerido = 0 Then - CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero + CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero() If CvePrecioListaPS > 0 Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then @@ -13687,7 +13678,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 = 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() @@ -13706,7 +13697,7 @@ Partial Class Ventas If PrecioSugerido > 0 Then Dim PrecioBaseCosto As Decimal = 0 - PrecioBaseCosto = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=drPS("CveClasificacion").ToString.ToEntero).FiltroPrimeroValor("PrecioBaseCosto", "").ToDecimal + PrecioBaseCosto = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=drPS("CveClasificacion").ToString().ToEntero()).FiltroPrimeroValor("PrecioBaseCosto", "").ToDecimal If PrecioBaseCosto > 0 Then PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1) @@ -13716,22 +13707,22 @@ Partial Class Ventas If IsNumeric(TxtCantidad.Text.Trim) Then - LblTotalPS.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString.FormatoNumero(2) + LblTotalPS.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString().FormatoNumero(2) Else LblTotalPS.Text = "0.00" End If LblPrecio1.Text = TxtPrecio.Text UPPDescuento.Update() - HdnIVAPS.Value = If(drPS("IVA").ToString = "-1", ViewState("IVA"), drPS("IVA").ToString).ToString - HdnIVARetAPS.Value = drPS("RetIVA").ToString - HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString - HdnCtaContable.Value = drPS("IdCtaContVentas").ToString - HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString - HdnCodigo.Value = drPS("Codigo").ToString + HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString() + HdnIVARetAPS.Value = drPS("RetIVA").ToString() + HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString() + HdnCtaContable.Value = drPS("IdCtaContVentas").ToString() + HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString() + HdnCodigo.Value = drPS("Codigo").ToString() If DdlClasificacion.SelectedIndex = 0 Then - If drPS("CveClasificacion").ToString IsNot Nothing Then - DdlClasificacion.SelectedValueExist(drPS("CveClasificacion").ToString) + If drPS("CveClasificacion").ToString() IsNot Nothing Then + DdlClasificacion.SelectedValueExist(drPS("CveClasificacion").ToString()) Else Alert("El Productos/Servicio no tiene asignada una Clasificación.", TipoMensaje.MsgInformacion) End If @@ -13741,7 +13732,7 @@ Partial Class Ventas End If ElseIf CvePSParametro = -2 Then - CargaPS(DdlClasificacion.SelectedValue.ToEntero, Ddl) + CargaPS(DdlClasificacion.SelectedValue.ToEntero(), Ddl) End If UPPPS.Update() @@ -13749,15 +13740,15 @@ Partial Class Ventas End Sub Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange - DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS) + DdlPSIndexChange(DdlPS.SelectedValue.ToEntero(), DdlPS) End Sub Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacion.SelectedIndexChanged - CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS) + CargaPS(DdlClasificacion.SelectedValue.ToEntero(), DdlPS) UpPS.Update() End Sub Protected Sub DdlNCFactura_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlNCFactura.SelectedIndexChanged Dim objcompras As New ClsCompras - If objcompras.GetCompraDetallealmacen(0, DdlNCFactura.SelectedValue.ToEntero) Then + If objcompras.GetCompraDetallealmacen(0, DdlNCFactura.SelectedValue.ToEntero()) Then GvInvNC.DataSource = objcompras.DtResultados If objcompras.DtResultados.Rows.Count > 0 Then Tab.ActiveTabIndex = 1 @@ -13778,7 +13769,7 @@ Partial Class Ventas LimpiaEscondeContado() End Sub Private Sub CambiaTipoDocto() - CargaNC(IfNull(Request("CveDevolucion"), "-1").ToString.ToEntero) + CargaNC(IfNull(Request("CveDevolucion"), "-1").ToString().ToEntero()) ConfiguraTipoDocto() CargaFolios() CargaEstatusFactura(DdlTipoComprobante.SelectedValue) @@ -13799,7 +13790,7 @@ Partial Class Ventas TrRFC.Visible = False 'RBLPago.Enabled = False RBLPago.SelectedValue = "2" - TxtFechaVencimientoCotizacion.Text = Now.ToString + TxtFechaVencimientoCotizacion.Text = Now.ToString() GvPS.Columns(5).Visible = True ThTiempoEntrega.Visible = True ThTiempoEntrega2.Visible = True @@ -13818,7 +13809,7 @@ Partial Class Ventas TrRFC.Visible = False 'RBLPago.Enabled = False 'RBLPago.SelectedValue = "2" - TxtFechaVencimientoCotizacion.Text = Now.ToString + TxtFechaVencimientoCotizacion.Text = Now.ToString() GvPS.Columns(5).Visible = True ThTiempoEntrega.Visible = True ThTiempoEntrega2.Visible = True @@ -13870,16 +13861,16 @@ Partial Class Ventas ' TrAlmacenAsignado.Visible = True 'End If - Dim CveAlmacenDestino As Integer = DtContratos.FiltroPrimeroValor("CveAlmacenDestino", $"CveContrato = {If(DdlContratosModal.Items.Count > 0, DdlContratosModal.SelectedValue, "0")}").ToEntero + Dim CveAlmacenDestino As Integer = DtContratos.FiltroPrimeroValor("CveAlmacenDestino", $"CveContrato = {If(DdlContratosModal.Items.Count > 0, DdlContratosModal.SelectedValue, "0")}").ToEntero() If CveAlmacenDestino > 0 Then DdlAlmacenAsignado.Items.Clear() - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero} And CveTipoAlmacen In (4,10)") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} And CveTipoAlmacen In (4,10)") DdlAlmacenAsignado.DataBind() - DdlAlmacenAsignado.Items.Insert(0, New ListItem(DtContratos.FiltroPrimeroValor("Almacen", $"CveContrato = {DdlContratosModal.SelectedValue}"), CveAlmacenDestino.ToString)) - DdlAlmacenAsignado.SelectedValue = CveAlmacenDestino.ToString + DdlAlmacenAsignado.Items.Insert(0, New ListItem(DtContratos.FiltroPrimeroValor("Almacen", $"CveContrato = {DdlContratosModal.SelectedValue}"), CveAlmacenDestino.ToString())) + DdlAlmacenAsignado.SelectedValue = CveAlmacenDestino.ToString() Else DdlAlmacenAsignado.Items.Clear() - DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero} AND CveTipoAlmacen IN (10)") + DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} AND CveTipoAlmacen IN (10)") DdlAlmacenAsignado.DataBind() End If UpParametros.Update() @@ -13950,7 +13941,7 @@ Partial Class Ventas UpPS.Update() End Sub Protected Sub DdlSucursalCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSucursalCliente.SelectedIndexChanged - CargaClienteSucursal(DdlSucursalCliente.SelectedValue.ToEntero) + CargaClienteSucursal(DdlSucursalCliente.SelectedValue.ToEntero()) 'If Me.CveVenta > 0 Then ' CargaRestriccionesCreditoCliente(Alertas:=True) 'End If @@ -13960,14 +13951,14 @@ Partial Class Ventas Dim CveProyecto As String = DirectCast(sender, DropDownList).SelectedValue gvr.FCDropDownList("DDlSubProyecto").Items.Clear() - gvr.FCDropDownList("DDlSubProyecto").DataSource = GlobalDTSubProyectos(CveProyecto.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa) + gvr.FCDropDownList("DDlSubProyecto").DataSource = GlobalDTSubProyectos(CveProyecto.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa) gvr.FCDropDownList("DDlSubProyecto").DataBind() gvr.FCDropDownList("DDlSubProyecto").Items.Insert(0, New ListItem("Sin SubProyecto Asignado", "-1")) End Sub Protected Sub DdlClasificacion_SelectedIndexChanged1(sender As Object, e As EventArgs) Dim gvr As GridViewRow = DirectCast(DirectCast(sender, DropDownList).BindingContainer, GridViewRow) - CargaPS(gvr.FCDropDownList("DdlClasificacion").SelectedValue.ToEntero, gvr.FCDropDownLost("DdlPS")) + CargaPS(gvr.FCDropDownList("DdlClasificacion").SelectedValue.ToEntero(), gvr.FCDropDownLost("DdlPS")) End Sub Protected Sub BtnEstimacion_Click(sender As Object, e As EventArgs) Handles BtnEstimacion.Click Dim Contrato As String = "" @@ -13989,31 +13980,31 @@ Partial Class Ventas If Row.FCCheckBox("Chk").Checked Then Importe += Row.FCLiteral("LtlImporte").Text.ToDecimal Contrato = Row.DataKey("NumeroContrato") - CveContrato = Row.DataKey("CveContrato").ToEntero - FechaInicial = Row.DataKey("FechaInicial").ToString.ToDate.ToString("dd MMMM yyyy") - CveSubProyecto = Row.DataKey("CveSubProyecto").ToEntero + CveContrato = Row.DataKey("CveContrato").ToEntero() + FechaInicial = Row.DataKey("FechaInicial").ToString().ToDate.ToString("dd MMMM yyyy") + CveSubProyecto = Row.DataKey("CveSubProyecto").ToEntero() End If Next If Importe > 0 Then - CvePS = UsuarioActual.Empresa.Funcionalidad(106).ToEntero + CvePS = UsuarioActual.Empresa.Funcionalidad(106).ToEntero() If CvePS > 0 Then Dim rowPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If rowPS IsNot Nothing Then - PS = rowPS("PS").ToString - PSCodigo = rowPS("PSCodigo").ToString - CveUM = rowPS("CveUM").ToString.ToEntero - UM = rowPS("UnidadMedida").ToString - CveClasificacion = rowPS("CveClasificacion").ToString.ToEntero - Clasificacion = rowPS("Clasificacion").ToString + PS = rowPS("PS").ToString() + PSCodigo = rowPS("PSCodigo").ToString() + CveUM = rowPS("CveUM").ToString().ToEntero() + UM = rowPS("UnidadMedida").ToString() + CveClasificacion = rowPS("CveClasificacion").ToString().ToEntero() + Clasificacion = rowPS("Clasificacion").ToString() Dim rowSP As DataRow = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto={0}", CveSubProyecto)) - Proyecto = rowSP("Proyecto").ToString - CveProyecto = rowSP("CveProyecto").ToString.ToEntero - SubProyecto = rowSP("SubProyecto").ToString + Proyecto = rowSP("Proyecto").ToString() + CveProyecto = rowSP("CveProyecto").ToString().ToEntero() + SubProyecto = rowSP("SubProyecto").ToString() AgregarProductoServicio(1, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, String.Format("{0} - {1}, con un importe de {2}", Contrato, FechaInicial, Importe.FormatoNumero), Importe, 0, CveProyecto, Proyecto, CveSubProyecto, SubProyecto) - 'AddPS(1, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, String.Format("{0} - {1}, con un importe de {2}", Contrato, FechaInicial, Importe.FormatoNumero), Importe, 0.16, 0, 0, 1, 0, True, "", CveProyecto, Proyecto, CveSubProyecto, SubProyecto, rowPS("CveTipoPS").ToString.ToEntero, rowPS("Inv_CveMetodoInventario").ToString.ToEntero, CodigoPS:=PSCodigo) + 'AddPS(1, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, String.Format("{0} - {1}, con un importe de {2}", Contrato, FechaInicial, Importe.FormatoNumero), Importe, 0.16, 0, 0, 1, 0, True, "", CveProyecto, Proyecto, CveSubProyecto, SubProyecto, rowPS("CveTipoPS").ToString().ToEntero(), rowPS("Inv_CveMetodoInventario").ToString().ToEntero(), CodigoPS:=PSCodigo) DdlTipoComprobante.SelectedValue = "Rem" @@ -14043,7 +14034,7 @@ Partial Class Ventas Dim ObjSubProyectos As New ClsSubProyectos 'Dim ObjSucursal As New ClsSucursales If ObjSubProyectos.GetSubProyectos() Then - DTSucursal = ObjSubProyectos.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyectoDatos.SelectedValue.ToEntero)) + DTSucursal = ObjSubProyectos.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyectoDatos.SelectedValue.ToEntero())) 'Dim drc As DataRow 'drc = DTSucursal(0) @@ -14060,10 +14051,10 @@ Partial Class Ventas UpDetalle.Update() 'If ObjSucursal.GetSucursales(UsuarioActual.CveEmpresa) Then - ' DTSucursal = ObjSucursal.DtResultados.FiltraParametros(String.Format("CveSucursal = {0}", drc("CveSucursal").ToString.ToEntero)) + ' DTSucursal = ObjSucursal.DtResultados.FiltraParametros(String.Format("CveSucursal = {0}", drc("CveSucursal").ToString().ToEntero())) ' Dim dre As DataRow ' dre = DTSucursal(0) - ' DdlSucursal.SelectedValue = dre("CveSucursal").ToString + ' DdlSucursal.SelectedValue = dre("CveSucursal").ToString() ' CambiaSucursal() 'End If End If @@ -14086,7 +14077,7 @@ Partial Class Ventas If ExFolioFactura Then Exit Sub End If - If DdlSubProyectoDatos.SelectedValue.ToEntero <= 0 Then + If DdlSubProyectoDatos.SelectedValue.ToEntero() <= 0 Then Alert("No se tienen asignadas sucursales", TipoMensaje.MsgError) Exit Sub End If @@ -14100,12 +14091,12 @@ Partial Class Ventas If ObjFolios.GetFolios(TipoDoctoConsulta, UsuarioActual.CveEmpresa) Then Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue)) If DT.Rows.Count > 0 Then - ViewState("CveFolio") = DT.Rows(0)("CveFolio").ToString.ToEntero - 'ViewState("NumAprobacion") = CLng(DT.Rows(0)("Aprobacion").ToString) - 'ViewState("FechaAprobacion") = DT.Rows(0)("FechaAprobacion").ToString.ToDate - ViewState("FolioActual") = DT.Rows(0)("FActual").ToString - LblSerie.Text = DT.Rows(0)("Serie").ToString - TxtFolio.Text = DT.Rows(0)("FActual").ToString + ViewState("CveFolio") = DT.Rows(0)("CveFolio").ToString().ToEntero() + 'ViewState("NumAprobacion") = CLng(DT.Rows(0)("Aprobacion").ToString()) + 'ViewState("FechaAprobacion") = DT.Rows(0)("FechaAprobacion").ToString().ToDate + ViewState("FolioActual") = DT.Rows(0)("FActual").ToString() + LblSerie.Text = DT.Rows(0)("Serie").ToString() + TxtFolio.Text = DT.Rows(0)("FActual").ToString() BtnCrearApartirDe.Enabled = True BtnEmitirImprimir.Visible = True TrVistaPrevia.Visible = True @@ -14139,36 +14130,36 @@ Partial Class Ventas ViewState("FormatoFactura") = dr("FormatoFactura") ViewState("IVA") = dr("IVA") DdlIVA.Visible = False - Select Case ViewState("IVA").ToString.ToDouble + Select Case ViewState("IVA").ToString().ToDouble Case 0 DdlIVA.SelectedValue = "1" - PorcentajeIVA = ViewState("IVA").ToString.ToDecimal + PorcentajeIVA = ViewState("IVA").ToString().ToDecimal Case 0.08 - DdlIVA.SelectedValue = If(EsCreaApartirDe, $"{(TmpDT.MAX("PorcentajeIVA").ToDecimal + 1).ToString}", "1.08") - PorcentajeIVA = If(EsCreaApartirDe, TmpDT.MAX("PorcentajeIVA").ToDecimal, ViewState("IVA").ToString.ToDecimal) + DdlIVA.SelectedValue = If(EsCreaApartirDe, $"{(TmpDT.MAX("PorcentajeIVA").ToDecimal + 1).ToString()}", "1.08") + PorcentajeIVA = If(EsCreaApartirDe, TmpDT.MAX("PorcentajeIVA").ToDecimal, ViewState("IVA").ToString().ToDecimal) DdlIVA.Visible = If(Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0, True, False) Case 0.16 DdlIVA.SelectedValue = "1.16" - PorcentajeIVA = ViewState("IVA").ToString.ToDecimal + PorcentajeIVA = ViewState("IVA").ToString().ToDecimal End Select If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 AndAlso (Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0) Then RecalculaIVA() 'ViewState("SubProyectoPorcentajeIVA") = dr("IVA") ViewState("TipoFormato") = dr("TipoFormato") ViewState("Serie") = dr("Serie") - LblSerie.Text = dr("Serie").ToString + LblSerie.Text = dr("Serie").ToString() If SerieXML <> "" Then LblSerie.Text = SerieXML Dim CveSubProyecto As Integer = GetSubProyectoSucursal() If CveSubProyecto > 0 Then CargaSubProyecto(CveSubProyecto) UPPProy.Update() - TipoVentaSucursal = dr("TipoVenta").ToString.ToEntero + TipoVentaSucursal = dr("TipoVenta").ToString().ToEntero() - If dr("TipoVenta").ToString = "1" Then + If dr("TipoVenta").ToString() = "1" Then LiBuscarPrecio.Visible = True UpnTools.Update() 'activa el modo de pago efectivo directamente, y es venta nueva - If ViewState("CveVenta").ToString.ToEntero < 0 Then InicializaCondicionesPago() + If ViewState("CveVenta").ToString().ToEntero() < 0 Then InicializaCondicionesPago() RBLPago.SelectedValue = "2" LimpiaEscondeContado() @@ -14190,7 +14181,7 @@ Partial Class Ventas Dim CveVendedorActual = DdlVendedor.SelectedValue DdlVendedor.Items.Clear() - If UsuarioActual.Empresa.Funcionalidad(302) = "1" AndAlso DdlSubProyectoDatos.SelectedValue.ToEntero > 0 Then + If UsuarioActual.Empresa.Funcionalidad(302) = "1" AndAlso DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyectoDatos.SelectedValue)).FiltraParametros("VendedorTipo = 1") Else DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros("VendedorTipo = 1") @@ -14202,8 +14193,8 @@ Partial Class Ventas DdlVendedor.SelectedValueExist(CveVendedorActual) - If Not DdlVendedor.SelectedValue.ToEntero > 0 Then - DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString) + If Not DdlVendedor.SelectedValue.ToEntero() > 0 Then + DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) End If End Sub #End Region @@ -14226,13 +14217,13 @@ Partial Class Ventas End If 'SI USA CONTABILIDAD LA CLASIFICACION ES OBLIGATORIA - If DdlClasificacion.SelectedValue.ToEntero <= 0 AndAlso UsuarioActual.Empresa.UsaContabilidad Then + If DdlClasificacion.SelectedValue.ToEntero() <= 0 AndAlso UsuarioActual.Empresa.UsaContabilidad Then Alert("La Clasificación es obligatoria, favor de seleccionarla", TipoMensaje.MsgAdvertencia) Return False End If 'SUBPROYECTO OBLIGATORIO - If DdlSubProyecto.SelectedValue.ToEntero <= 0 AndAlso UsuarioActual.Empresa.Funcionalidad(120) = "1" Then + If DdlSubProyecto.SelectedValue.ToEntero() <= 0 AndAlso UsuarioActual.Empresa.Funcionalidad(120) = "1" Then Alert("El Subproyecto es obligatorio, favor de seleccionarlo", TipoMensaje.MsgAdvertencia) Return False End If @@ -14249,13 +14240,13 @@ Partial Class Ventas 'VALIDA PROMOCIONES Dim ObjVentas As New ClsVentas - If ObjVentas.GetPromocionesPS(-1, TxtFecha.Text.ToDateTime, DdlSubProyectoDatos.SelectedValue.ToEntero, CveCliente, DdlVendedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetPromocionesPS(-1, TxtFecha.Text.ToDateTime, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveCliente, DdlVendedor.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then DtPromociones = ObjVentas.DtResultados End If ObjVentas.Dispose() 'VALIDA PRECIO CERO (0) - If UsuarioActual.Empresa.Funcionalidad(139).ToString.ToEntero > 0 And PU = 0 And DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal > 0 Then + If UsuarioActual.Empresa.Funcionalidad(139).ToString().ToEntero() > 0 And PU = 0 And DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal > 0 Then Alert($"El producto {HdnPS.Value}. No se puede vender a un importe de cero ($0)", TipoMensaje.MsgAdvertencia) Return False End If @@ -14265,7 +14256,7 @@ Partial Class Ventas If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count >= 1 Then Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0) If DrPS IsNot Nothing Then - If DrPS("CveMoneda").ToString.ToEntero <> DdlMoneda.SelectedValue.ToEntero Then + If DrPS("CveMoneda").ToString().ToEntero() <> DdlMoneda.SelectedValue.ToEntero() Then Alert("No puede agregar un producto de diferente moneda a la ya seleccionada", TipoMensaje.MsgAdvertencia) Return False End If @@ -14278,8 +14269,8 @@ Partial Class Ventas 'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then Dim ObjInventarios As New ClsInventarios - Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) - Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero, CveTipoAlmacen:=1) + Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) + Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, 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 Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1) @@ -14290,7 +14281,7 @@ Partial Class Ventas If UsuarioActual.CveEmpresa = 119 Then 'Dim CvePrecioLista As Integer = 38 Dim objPS As New ClsProductosServicios - If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) Then + If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero()) Then PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal 'If PrecioMinimo > 0 Then ' Costo = PrecioMinimo @@ -14320,7 +14311,7 @@ Partial Class Ventas Dim CostoMayor As Decimal = 0.0D 'PRECIO MINIMO - If UsuarioActual.Empresa.Funcionalidad(129).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then + If UsuarioActual.Empresa.Funcionalidad(129).ToEntero() > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then '' NOTA. si tiene preciominimo, debe de validarlos e ignorar el costo, pero se debe de considerar el TC, para el costo If PrecioMinimo > 0 Then 'SI EL PRECIO ES MAYOR AL COSTO, SI PASA @@ -14330,7 +14321,7 @@ Partial Class Ventas Else CostoMenor = Costo + ((UsuarioActual.Empresa.Funcionalidad(129).ToDecimal / 100) * Costo) 'SI EL PRECIO ES MAYOR AL COSTO, SI PASA - If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= CostoMenor Then + If PU * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal) >= CostoMenor Then EsValido = True End If End If @@ -14339,10 +14330,10 @@ Partial Class Ventas End If 'PRECIO MAXIMO - If UsuarioActual.Empresa.Funcionalidad(133).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then + If UsuarioActual.Empresa.Funcionalidad(133).ToEntero() > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then CostoMayor = Costo + ((UsuarioActual.Empresa.Funcionalidad(133).ToDecimal / 100) * Costo) 'SI EL PRECIO ES MAYOR AL COSTO MAXIMO, SI PASA - If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) <= CostoMayor Then + If PU * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal) <= CostoMayor Then EsValidoMayor = True End If Else @@ -14353,18 +14344,18 @@ Partial Class Ventas 'SIRVE PARA VALIDAR PRECIOS DEBAJO DEL PRECIO MINIMO PERMITIDO If Not EsValido Then If DtPromociones.FiltraParametros($"CvePS = {CvePS}").Rows.Count > 0 Then - If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal Then + If PU * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal) >= DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal Then EsValido = True End If Else Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") 'valida sino tiene promocion la clasificacion If DrPS IsNot Nothing Then - If DtPromociones.FiltraParametros(String.Format("CveClasificacion = {0}", DdlClasificacion.SelectedValue.ToEntero)).Rows.Count > 0 Then + If DtPromociones.FiltraParametros(String.Format("CveClasificacion = {0}", DdlClasificacion.SelectedValue.ToEntero())).Rows.Count > 0 Then ''falta aplicar si tiene promocion - Dim drPromo As DataRow = DtPromociones.FiltroPrimero(String.Format("CveClasificacion = {0}", DdlClasificacion.SelectedValue.ToEntero)) + Dim drPromo As DataRow = DtPromociones.FiltroPrimero(String.Format("CveClasificacion = {0}", DdlClasificacion.SelectedValue.ToEntero())) If drPromo IsNot Nothing Then - If drPromo("CveMarca").ToString = DrPS("CveMarca").ToString Then + If drPromo("CveMarca").ToString() = DrPS("CveMarca").ToString() Then End If End If @@ -14382,11 +14373,11 @@ Partial Class Ventas MensajeCosto.AppendFormat("El Producto {0}-{1}. No se puede vender a un precio menor de su Costo
    ", HdnCodigoPS.Value, HdnPS.Value) If TienePermisoImportes Then MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
    ", Costo) - MensajeCosto.AppendFormat("El rango menor aceptado es: {0}% ${1:#,###.00}
    ", UsuarioActual.Empresa.Funcionalidad(129).ToEntero, CostoMenor) + MensajeCosto.AppendFormat("El rango menor aceptado es: {0}% ${1:#,###.00}
    ", UsuarioActual.Empresa.Funcionalidad(129).ToEntero(), CostoMenor) MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
    ", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) End If - Alert(String.Format(MensajeCosto.ToString), TipoMensaje.MsgAdvertencia) + Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) Return False End If @@ -14395,10 +14386,10 @@ Partial Class Ventas MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
    ", HdnPS.Value) If TienePermisoImportes Then MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
    ", Costo) - MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
    ", UsuarioActual.Empresa.Funcionalidad(133).ToEntero, CostoMayor) + MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
    ", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
    ", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) End If - Alert(MensajeCosto.ToString, TipoMensaje.MsgAdvertencia) + Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) Return False End If @@ -14443,9 +14434,9 @@ Partial Class Ventas Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If DrPS IsNot Nothing Then - CveMarcaPS = DrPS("CveMarca").ToString.ToEntero - CveClasifPS = DrPS("CveClasificacion").ToString.ToEntero - CveRinTamañoPS = DrPS("CveRinTamaño").ToString.ToEntero + CveMarcaPS = DrPS("CveMarca").ToString().ToEntero() + CveClasifPS = DrPS("CveClasificacion").ToString().ToEntero() + CveRinTamañoPS = DrPS("CveRinTamaño").ToString().ToEntero() If CveClasifPS = 20636 Then ValidaCondicionesComerciales = False @@ -14466,16 +14457,16 @@ Partial Class Ventas Dim Cant As Integer = 1 If dr IsNot Nothing Then - TipoPromo = dr("TipoPromocion").ToString.ToEntero - CantMinima = dr("CantidadMinima").ToString.ToEntero - IncluyeImpuestos = dr("IncluyeImpuestos").ToString = "True" - PromocionPorcentaje = dr("Promocion").ToString.ToDecimal - PUPromocion = dr("PUPromocion").ToString.ToDecimal - CvePromocionDetalle = dr("CvePromocionDetalle").ToString.ToEntero - TipoAplicacion = dr("TipoAplicacion").ToString.ToEntero + TipoPromo = dr("TipoPromocion").ToString().ToEntero() + CantMinima = dr("CantidadMinima").ToString().ToEntero() + IncluyeImpuestos = dr("IncluyeImpuestos").ToString() = "True" + PromocionPorcentaje = dr("Promocion").ToString().ToDecimal + PUPromocion = dr("PUPromocion").ToString().ToDecimal + CvePromocionDetalle = dr("CvePromocionDetalle").ToString().ToEntero() + TipoAplicacion = dr("TipoAplicacion").ToString().ToEntero() If CantMinima > 0 Then - Cant = Math.Floor(TxtCantidad.Text.ToDecimal / CantMinima).ToEntero + Cant = Math.Floor(TxtCantidad.Text.ToDecimal / CantMinima).ToEntero() End If End If @@ -14509,13 +14500,13 @@ Partial Class Ventas Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}") 'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA If RowPorcentaje IsNot Nothing Then - 'LIMPIAR LOS DESCUENTOS - Descuento = 0 + '(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 TotalInicial As Decimal = (Cantidad * (PU)) - Descuento + Dim TotalInicial As Decimal = (Cantidad * (PU)) '- Descuento Dim TotalFinal = TotalInicial 'SI APLICA EL PRIMER DESCUENTO If PorcentajeProducto > 0 Then @@ -14541,7 +14532,9 @@ Partial Class Ventas TotalFinal = TotalInicial End If - Descuento += ((Cantidad * PU) - TotalFinal) + If PorcentajeProducto > 0 Then + Descuento += ((Cantidad * PU) - TotalFinal) + End If End If End If @@ -14562,15 +14555,15 @@ Partial Class Ventas 'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL) Dim CvePS As Integer = -1 If DIVCod.Visible Then - CvePS = HdnCvePS.Value.ToEntero + CvePS = HdnCvePS.Value.ToEntero() Else - CvePS = DdlPS.SelectedValue.ToEntero + CvePS = DdlPS.SelectedValue.ToEntero() End If - If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero, TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero) Then + If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero(), TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero()) Then If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then - CvePSAmortizacion = DdlPS.SelectedValue.ToEntero.ToEntero + CvePSAmortizacion = DdlPS.SelectedValue.ToEntero().ToEntero() End If Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal @@ -14580,9 +14573,9 @@ Partial Class Ventas PU = ObjDescuento.PU End If - AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, + AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero(), DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero(), DdlClasificacion.SelectedItem.Text, CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento, - DdlProyecto.SelectedValue.ToEntero, DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text, + DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text, SerieLote:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle) CalculaUsados() @@ -14604,20 +14597,20 @@ Partial Class Ventas Private Sub AgregarPSPYME() If Modalidad = "A" Then - Dim CveProyecto As Integer = IIf(DdlProyectoPyME.SelectedValue <> "-1", DdlProyectoPyME.SelectedValue, "0").ToString.ToEntero - Dim Proyecto As String = IIf(DdlProyectoPyME.SelectedValue <> "-1", DdlProyectoPyME.SelectedItem.Text, "").ToString + Dim CveProyecto As Integer = IIf(DdlProyectoPyME.SelectedValue <> "-1", DdlProyectoPyME.SelectedValue, "0").ToString().ToEntero() + Dim Proyecto As String = IIf(DdlProyectoPyME.SelectedValue <> "-1", DdlProyectoPyME.SelectedItem.Text, "").ToString() - Dim CveSubProyecto As Integer = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedValue, "0").ToString.ToEntero - Dim SubProyecto As String = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedItem.Text, "").ToString + Dim CveSubProyecto As Integer = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedValue, "0").ToString().ToEntero() + Dim SubProyecto As String = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedItem.Text, "").ToString() Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal() Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal() - Dim CvePS As Integer = DdlPSPyME.SelectedValue.ToEntero + Dim CvePS As Integer = DdlPSPyME.SelectedValue.ToEntero() Dim Descuento As Descuentos = CalcularDescuentos(CvePS, Cantidad, PU) - AgregarProductoServicio(Cantidad, DdlUMPyME.SelectedValue.ToEntero, DdlUMPyME.SelectedItem.Text, DdlClasificacionPyME.SelectedValue.ToEntero, DdlClasificacionPyME.SelectedItem.Text, + AgregarProductoServicio(Cantidad, DdlUMPyME.SelectedValue.ToEntero(), DdlUMPyME.SelectedItem.Text, DdlClasificacionPyME.SelectedValue.ToEntero(), DdlClasificacionPyME.SelectedItem.Text, CvePS, DdlPSPyME.SelectedText, TxtObsPyME.Text, PU, Descuento.ImporteDescuento, CveProyecto, Proyecto, CveSubProyecto, SubProyecto) CalculaUsados() @@ -14628,7 +14621,7 @@ Partial Class Ventas Dim ErrorEdit As Boolean = True Dim Contador As Integer = 0 For Each row As DataRow In TmpDT.Rows - If row("Consec").ToString.ToEntero = Index Then + If row("Consec").ToString().ToEntero() = Index Then ErrorEdit = False Exit For End If @@ -14653,7 +14646,7 @@ Partial Class Ventas DdlClasificacion.SelectedIndex = 0 - If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then + If Not UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1" Then DdlPS.SelectedValue = "-1" Else DdlPS.SelectedValue = "" @@ -14774,37 +14767,37 @@ Partial Class Ventas Return False End If - If (DrPS("SATClaveUnidadMedida").ToString = "" Or DrPS("SATClavePS").ToString = "") Then + If (DrPS("SATClaveUnidadMedida").ToString() = "" Or DrPS("SATClavePS").ToString() = "") Then 'VALIDA CLAVESAT If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then 'DOCUMENTOS DONDE NO SE VALIDA - If DrPS("SATClavePS").ToString = "" Then - MensajeCveSAT.AppendFormat("{0}-{1}: Sin producto SAT
    ", DrPS("Codigo").ToString, DrPS("PS").ToString) + If DrPS("SATClavePS").ToString() = "" Then + MensajeCveSAT.AppendFormat("{0}-{1}: Sin producto SAT
    ", DrPS("Codigo").ToString(), DrPS("PS").ToString()) Return False - ElseIf DrPS("SATClaveUnidadMedida").ToString = "" Then - MensajeCveSAT.AppendFormat("{0}-{1}: Sin Unidad Medida SAT
    ", DrPS("Codigo").ToString, DrPS("PS").ToString) + ElseIf DrPS("SATClaveUnidadMedida").ToString() = "" Then + MensajeCveSAT.AppendFormat("{0}-{1}: Sin Unidad Medida SAT
    ", DrPS("Codigo").ToString(), DrPS("PS").ToString()) Return False End If End If End If 'verifica si tiene ventaminima - If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then + If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString().ToDecimal > 0 Then 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... - If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then - Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString)) + If Cantidad Mod DrPS("VentaMinima").ToString().ToDecimal <> 0 Then + Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString())) Return False End If End If If Not ClienteDesglosaIEPS Then If Not RegeneraIEPS Then - PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal) + PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) End If DrPS("IEPSPorcentaje") = 0 End If TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento - TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal) + TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) Row("PU") = PU Row("Codigo") = DrPS("Codigo") @@ -14820,7 +14813,7 @@ Partial Class Ventas End If Row("PS") = DrPS("PS") - Row("CodigoPS") = DrPS("PSCodigo").ToString + Row("CodigoPS") = DrPS("PSCodigo").ToString() Row("CveTipoPS") = DrPS("CveTipoPS") Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") Row("CveTamaño") = DrPS("CveTamaño") @@ -14828,7 +14821,7 @@ Partial Class Ventas If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion") If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") - If DrPS("IVA").ToString.Contiene("-1", "") Then + If DrPS("IVA").ToString().Contiene("-1", "") Then Row("PorcentajeIVA") = PorcentajeIVA Else Row("PorcentajeIVA") = DrPS("IVA") @@ -14854,13 +14847,13 @@ Partial Class Ventas End If Row("IVA") = Row("PorcentajeIVA") - Row("ImporteIVA") = (Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) + Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) Row("PorcentajeRetIVA") = ClienteRetIVA Row("PorcentajeRetISR") = ClienteRetISR Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") - Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) Row("IEPS") = Row("ImporteIEPS") Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales) Row("TipoDescuento") = HdnTipoDescuento.Value @@ -14895,15 +14888,15 @@ Partial Class Ventas 'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then - If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString Then - Alert($"La moneda base del producto: {DrPS("PSCodigo").ToString} es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia) + If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString() Then + Alert($"La moneda base del producto: {DrPS("PSCodigo").ToString()} es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia) Return False End If End If 'ACTIVA PRODUCTOS DE LA MISMA MONEDA If TmpDT.Rows.Count = 0 And CveVenta < 0 Then - DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString) + DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString()) CambiaMoneda() DdlMoneda.Enabled = False End If @@ -14916,21 +14909,21 @@ Partial Class Ventas 'AGREGA PS ADICIONAL - If UsuarioActual.Empresa.Funcionalidad(561).ToString = "1" AndAlso Not UsuarioActual.TienePermisoProceso(285) AndAlso GlobalDTPSAdicionales(CvePS, UsuarioActual.CveEmpresa).Rows.Count > 0 AndAlso Not SeActualiza Then + If UsuarioActual.Empresa.Funcionalidad(561).ToString() = "1" AndAlso Not UsuarioActual.TienePermisoProceso(285) AndAlso GlobalDTPSAdicionales(CvePS, UsuarioActual.CveEmpresa).Rows.Count > 0 AndAlso Not SeActualiza Then For Each Dr As DataRow In GlobalDTPSAdicionales(CvePS, UsuarioActual.CveEmpresa).Rows - Dim CvePSAdicional As Integer = Dr("CvePSAdicional").ToString.ToEntero + 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) If DrPSAdicional IsNot Nothing Then DrPoliza("CvePS") = CvePSAdicional - DrPoliza("PS") = DrPSAdicional("PS").ToString - DrPoliza("CveUM") = DrPSAdicional("CveUM").ToString.ToEntero - DrPoliza("UM") = DrPSAdicional("UnidadMedida").ToString - DrPoliza("CveClasificacion") = DrPSAdicional("CveClasificacion").ToString.ToEntero - DrPoliza("Clasificacion") = DrPSAdicional("Clasificacion").ToString - DrPoliza("CodigoPS") = DrPSAdicional("PSCodigo").ToString + DrPoliza("PS") = DrPSAdicional("PS").ToString() + DrPoliza("CveUM") = DrPSAdicional("CveUM").ToString().ToEntero() + DrPoliza("UM") = DrPSAdicional("UnidadMedida").ToString() + DrPoliza("CveClasificacion") = DrPSAdicional("CveClasificacion").ToString().ToEntero() + DrPoliza("Clasificacion") = DrPSAdicional("Clasificacion").ToString() + DrPoliza("CodigoPS") = DrPSAdicional("PSCodigo").ToString() DrPoliza("CveTipoPS") = DrPSAdicional("CveTipoPS") DrPoliza("CveTipoInvPS") = DrPSAdicional("Inv_CveMetodoInventario") DrPoliza("NoIdentificacion") = DrPSAdicional("Codigo") @@ -14940,11 +14933,11 @@ Partial Class Ventas DrPoliza("Consec") = TmpDT.Rows.Count + 1 End If Row("Orden") = TmpDT.Rows.Count + 1 - DrPoliza("Cantidad") = If(Dr("Cantidad").ToString.ToDecimal > 0, Dr("Cantidad").ToString.ToDecimal, Cantidad) + DrPoliza("Cantidad") = If(Dr("Cantidad").ToString().ToDecimal > 0, Dr("Cantidad").ToString().ToDecimal, Cantidad) PU = 0 Dim PrecioSugerido As Decimal = 0 - 'Dim CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CvePrecioLista", $"CveCliente = {CveCliente}").ToEntero + 'Dim CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CvePrecioLista", $"CveCliente = {CveCliente}").ToEntero() If CvePrecioLista > 0 Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, CvePS:=CvePSAdicional) Then @@ -14952,10 +14945,10 @@ 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 = 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) + 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 @@ -14973,26 +14966,26 @@ Partial Class Ventas End If PU = Math.Round(PU, 6) DrPoliza("PU") = PU - TotalCalculableImpuestos = (DrPoliza("Cantidad").ToString.ToDecimal * (PU)) + TotalCalculableImpuestos = (DrPoliza("Cantidad").ToString().ToDecimal * (PU)) - If DrPSAdicional("IVA").ToString.Contiene("-1", "") Then + If DrPSAdicional("IVA").ToString().Contiene("-1", "") Then DrPoliza("PorcentajeIVA") = PorcentajeIVA Else DrPoliza("PorcentajeIVA") = DrPSAdicional("IVA") End If DrPoliza("IVA") = DrPoliza("PorcentajeIVA") - DrPoliza("ImporteIVA") = Math.Round(DrPoliza("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + DrPoliza("ImporteIVA") = Math.Round(DrPoliza("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales) DrPoliza("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales) DrPoliza("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales) DrPoliza("PorcentajeRetIVA") = ClienteRetIVA DrPoliza("PorcentajeRetISR") = ClienteRetISR DrPoliza("PorcentajeIEPS") = DrPSAdicional("IEPSPorcentaje") - DrPoliza("ImporteIEPS") = Math.Round(DrPSAdicional("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + DrPoliza("ImporteIEPS") = Math.Round(DrPSAdicional("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos, NumeroDecimales) DrPoliza("IEPS") = DrPoliza("ImporteIEPS") DrPoliza("Descuento") = 0 ' Descuento DrPoliza("TipoDescuento") = HdnTipoDescuento.Value - DrPoliza("Total") = (DrPoliza("Cantidad").ToString.ToDecimal * PU) - DrPoliza("TotalImporte") = Math.Round(DrPoliza("Cantidad").ToString.ToDecimal * PU, NumeroDecimales) + DrPoliza("Total") = (DrPoliza("Cantidad").ToString().ToDecimal * PU) + DrPoliza("TotalImporte") = Math.Round(DrPoliza("Cantidad").ToString().ToDecimal * PU, NumeroDecimales) DrPoliza("SATClaveProdServ") = DrPSAdicional("SATClavePS") DrPoliza("SATClaveUM") = DrPSAdicional("SATClaveUnidadMedida") @@ -15163,7 +15156,7 @@ Partial Class Ventas 'End Function 'Private Sub ActualizaCadenaOriginal(CadenaOriginal As String, CveVenta As Integer) ' Dim ObjVentas As New ClsVentas() - ' ObjVentas.UpdateVentaCadenaOriginal(CadenaOriginal.ToString, CveVenta) + ' ObjVentas.UpdateVentaCadenaOriginal(CadenaOriginal.ToString(), CveVenta) ' ObjVentas.Dispose() 'End Sub 'Private Sub ActualizaEstatus(CveEstatus As Integer, FolioFiscal As String, CveVenta As Integer) @@ -15214,7 +15207,7 @@ Partial Class Ventas Dim CtaCliente As Integer = factura.Cliente.IdCtaContClientes Dim CtaISSSTESON As Integer = 643 Dim CtaISPT As Integer = 1745 - ' Dim NombreCliente As String = ViewState("NombreCliente").ToString + ' Dim NombreCliente As String = ViewState("NombreCliente").ToString() If IDPoliza > 0 Then Retorno.IdPoliza = IDPoliza @@ -15222,7 +15215,7 @@ Partial Class Ventas 'Orden de PAGO If factura.TipoDocto = "OP" Then - If DdlOrdenPago.SelectedValue.ToEntero = 1 Then + If DdlOrdenPago.SelectedValue.ToEntero() = 1 Then 'ISSSTESON If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then @@ -15249,7 +15242,7 @@ Partial Class Ventas Else Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)() Group gvr By Grp = New With { - Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero + Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero() } Into Group Select Grp.CvePresupuestoIngreso, TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble) @@ -15259,14 +15252,14 @@ Partial Class Ventas ' Case "Ing", "Egs" For Each grp In Detalles dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso)) - Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text) + Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString(), TxtFolio.Text) - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString().ToEntero(), False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString().ToEntero(), True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then 'CARGO la deuda del cliente If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then 'abono, - If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString().ToEntero(), Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then ErrorAC = True End If Else @@ -15328,22 +15321,22 @@ Partial Class Ventas TipoMovto = True End If - Dim TipoPoliza = If(DdlTipoComprobante.SelectedValue.ToString = "OP" Or DdlTipoComprobante.SelectedValue.ToString = "Com", 3, 1) + Dim TipoPoliza = If(DdlTipoComprobante.SelectedValue.ToString() = "OP" Or DdlTipoComprobante.SelectedValue.ToString() = "Com", 3, 1) IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, TxtTotal.Text.ToDouble * 2, TxtTotal.Text.ToDouble * 2, UsuarioActual.CveUsuario, Fecha) Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue)) 'Dim Importe As Double = TxtTotal.Text.ToDouble - Dim CtaCliente As Integer = ViewState("IdCtaContClientes").ToString.ToEntero + Dim CtaCliente As Integer = ViewState("IdCtaContClientes").ToString().ToEntero() Dim CtaISSSTESON As Integer = 643 Dim CtaISPT As Integer = 1745 - ' Dim NombreCliente As String = ViewState("NombreCliente").ToString + ' Dim NombreCliente As String = ViewState("NombreCliente").ToString() If IDPoliza > 0 Then 'Orden de PAGO - If DdlTipoComprobante.SelectedValue.ToString = "OP" Then + If DdlTipoComprobante.SelectedValue.ToString() = "OP" Then - If DdlOrdenPago.SelectedValue.ToEntero = 1 Then + If DdlOrdenPago.SelectedValue.ToEntero() = 1 Then 'ISSSTESON If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then @@ -15370,7 +15363,7 @@ Partial Class Ventas Else Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)() Group gvr By Grp = New With { - Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero + Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero() } Into Group Select Grp.CvePresupuestoIngreso, TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble) @@ -15380,14 +15373,14 @@ Partial Class Ventas ' Case "Ing", "Egs" For Each grp In Detalles dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso)) - Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text) + Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString(), TxtFolio.Text) - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString().ToEntero(), False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString().ToEntero(), True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then 'CARGO la deuda del cliente If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then 'abono, - If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString().ToEntero(), Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then ErrorAC = True End If Else @@ -15541,7 +15534,7 @@ Partial Class Ventas If RecalculaImpuestosLocales AndAlso TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then If TotalSubTotal <> TotalAmortizacion Then For Each drt As DataRow In TmpDTImpuestos.Rows - drt("Importe") = drt("Porcentaje").ToString.ToDecimal * TotalSubTotal / 100 + drt("Importe") = drt("Porcentaje").ToString().ToDecimal * TotalSubTotal / 100 Next End If @@ -15567,7 +15560,7 @@ Partial Class Ventas If TotalRetIVA > 0 Then GvPS.Columns(ColumnaRetIVA).Visible = True Else GvPS.Columns(ColumnaRetIVA).Visible = False If TotalRetISR > 0 Then GvPS.Columns(ColumnaRetISR).Visible = True Else GvPS.Columns(ColumnaRetISR).Visible = False - If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero.Contiene(2, 1) Then + If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero().Contiene(2, 1) Then TotalAmortizacion = 0 End If @@ -15585,17 +15578,17 @@ Partial Class Ventas LblAmort.Text = TxtSubTotal.Text If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then - HdnVentaSaldo.Value = Total.ToString + HdnVentaSaldo.Value = Total.ToString() Else - HdnVentaSaldo.Value = SaldoVenta.ToString + HdnVentaSaldo.Value = SaldoVenta.ToString() End If HdnIVAOriginal.Value = TxtIVA.Text 'JJMQ 20160506: Se agrego para la validacion de pago de contado. - 'CVImporteContado.ValueToCompare = Total.ToString + 'CVImporteContado.ValueToCompare = Total.ToString() - If MensajeCveSAT IsNot Nothing AndAlso MensajeCveSAT.ToString.Length > 0 Then - Alert($"Los siguientes conceptos hace falta especificar clave SAT

    {MensajeCveSAT.ToString}", TipoMensaje.MsgAdvertencia) + If MensajeCveSAT IsNot Nothing AndAlso MensajeCveSAT.ToString().Length > 0 Then + Alert($"Los siguientes conceptos hace falta especificar clave SAT

    {MensajeCveSAT.ToString()}", TipoMensaje.MsgAdvertencia) MensajeCveSAT.Clear() End If @@ -15703,7 +15696,7 @@ Partial Class Ventas End Function Private Sub VinculaCotizacionVenta() Dim ObjVentas As New ClsVentas() - ObjVentas.UpdateVentaCotizacion(CveVenta, Request("CveVenta").ToEntero) + ObjVentas.UpdateVentaCotizacion(CveVenta, Request("CveVenta").ToEntero()) ObjVentas.Dispose() End Sub Private Sub GeneraAddenda7Eleven(Archivo As String) @@ -15731,7 +15724,7 @@ Partial Class Ventas For Each Row As DataRow In TmpDT.Rows - SB.AppendFormat("", Row("Codigo"), Row("PS"), Row("Cantidad").ToString.ToDouble.FormatoNumero(), Row("PU").ToString.ToDouble.FormatoNumero()) + SB.AppendFormat("", Row("Codigo"), Row("PS"), Row("Cantidad").ToString().ToDouble.FormatoNumero(), Row("PU").ToString().ToDouble.FormatoNumero()) Next @@ -15801,7 +15794,7 @@ Partial Class Ventas End Sub Protected Sub DdlFR_SelectedIndexChanged(sender As Object, e As EventArgs) Dim DdlFR_Gv As DropDownList = CType(sender, DropDownList) - Dim index As Integer = CType(DdlFR_Gv.NamingContainer, GridViewRow).FCLiteral("LtlConsecutivo").Text.ToString.ToEntero + Dim index As Integer = CType(DdlFR_Gv.NamingContainer, GridViewRow).FCLiteral("LtlConsecutivo").Text.ToString().ToEntero() If UsuarioActual.Empresa.UsaAC Then TmpDT(index - 1)("CvePresupuestoIngreso") = DdlFR_Gv.SelectedValue @@ -15846,7 +15839,7 @@ Partial Class Ventas UpFacturar.Update() Exit Sub Else - HdnCveCliente.Value = ObjClientes.CveCliente.ToString + HdnCveCliente.Value = ObjClientes.CveCliente.ToString() End If BtnBuscarCliente_Click(sender, e) Else @@ -15901,7 +15894,7 @@ Partial Class Ventas ElseIf DdlTipoComprobante.SelectedValue = "Com" Then BtnEmitirImprimir.Text = "Registrar" 'TdReferencia.Style.Add("display", "none") - ElseIf DdlTipoComprobante.SelectedValue.ToString = "OP" Then + ElseIf DdlTipoComprobante.SelectedValue.ToString() = "OP" Then BtnEmitirImprimir.Text = "Registrar" TdOrdenPago.Visible = True End If @@ -15955,7 +15948,7 @@ Partial Class Ventas Protected Sub DdlPS_SelectedIndexChanged1(sender As Object, e As EventArgs) Dim Ddl As DropDownList = CType(sender, DropDownList) Dim gvr As GridViewRow = CType(Ddl.BindingContainer, GridViewRow) - gvr.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(Ddl.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) + gvr.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(Ddl.SelectedValue.ToEntero(), -1, UsuarioActual.CveEmpresa) gvr.FCDropDownList("DdlUnidadMedida").DataBind() End Sub @@ -15976,7 +15969,7 @@ Partial Class Ventas 'Si estamos facturando remisiones ajustamos por ventadetalle If RemisionesLista.Count > 0 AndAlso DtRemisionesTmpDT IsNot Nothing AndAlso DtRemisionesTmpDT.Rows.Count > 0 AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then Dim resultados = From DtRemisiones In DtRemisionesTmpDT - Join DtMovDet In ObjInventario.DtResultados.FiltraParametros("CvePS > 0") On DtRemisiones("CveVentaDetalleRemision").ToString.ToEntero Equals DtMovDet("CveVentaDetalle").ToString.ToEntero + Join DtMovDet In ObjInventario.DtResultados.FiltraParametros("CvePS > 0") On DtRemisiones("CveVentaDetalleRemision").ToString().ToEntero() Equals DtMovDet("CveVentaDetalle").ToString().ToEntero() Select DtMovDet Try If resultados.Count > 0 Then @@ -15998,15 +15991,15 @@ Partial Class Ventas Dim GeneroMovimientoAlmacen As Boolean = False For Each dr As DataRow In DtMovimientos.Rows 'Obtenemos los Movimientos de salida - If ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, ConceptoMovimiento, -1, UsuarioActual.CveEmpresa) Then + If ObjInventario.GetMovimientos(dr("CveMovimiento").ToString().ToEntero(), ConceptoMovimiento, -1, UsuarioActual.CveEmpresa) Then If ObjInventario.DtResultados.Rows.Count > 0 AndAlso DtMovimientosDetalles.Rows.Count > 0 Then Dim RowMovimiento As DataRow = ObjInventario.DtResultados(0) - Dim CveAlmacenSalida As Integer = RowMovimiento("CveAlmacen").ToString.ToEntero() - Dim CveAlmacenEntrada As Integer = RowMovimiento("CveAlmacenRelacionado").ToString.ToEntero() - Dim CveMoneda As Integer = RowMovimiento("CveMoneda").ToString.ToEntero() - Dim CveTipoAlmacen As Integer = RowMovimiento("CveTipoAlmacen").ToString.ToEntero() + Dim CveAlmacenSalida As Integer = RowMovimiento("CveAlmacen").ToString().ToEntero() + Dim CveAlmacenEntrada As Integer = RowMovimiento("CveAlmacenRelacionado").ToString().ToEntero() + Dim CveMoneda As Integer = RowMovimiento("CveMoneda").ToString().ToEntero() + Dim CveTipoAlmacen As Integer = RowMovimiento("CveTipoAlmacen").ToString().ToEntero() If (CveAlmacenEntrada > 0 AndAlso CveTipoAlmacen <> 1) Or RemisionesLista.Count = 0 Then 'Con remisiones parciales ignoramos las surtidas ya realizadas @@ -16092,7 +16085,7 @@ Partial Class Ventas End If - ElseIf ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, 3, -1, UsuarioActual.CveEmpresa) Then + ElseIf ObjInventario.GetMovimientos(dr("CveMovimiento").ToString().ToEntero(), 3, -1, UsuarioActual.CveEmpresa) Then 'Esquema viejo, evitamos que aparezca por surtir If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then OcurrioError = True @@ -16143,12 +16136,12 @@ Partial Class Ventas 'Si no se ha terminado de surtir agregamos el movimiento If Indice >= 0 Then - ' rowSurtidos("Surtido").ToString.ToDouble < rowSurtidos("Cantidad").ToString.ToDouble AndAlso (dr("CantidadDisponible").ToString.ToDouble - rowSurtidos("Surtido").ToString.ToDouble > 0 Or dr("SerieLote").ToString <> "") - If rowSurtidos("Surtido").ToString.ToDecimal < rowSurtidos("Cantidad").ToString.ToDecimal Then - Dim CantidadSurtida As Double = If(dr("CantidadDisponible").ToString.ToDecimal < rowSurtidos("Cantidad").ToString.ToDouble, dr("CantidadDisponible").ToString.ToDecimal, rowSurtidos("Cantidad").ToString.ToDecimal) + ' rowSurtidos("Surtido").ToString().ToDouble < rowSurtidos("Cantidad").ToString().ToDouble AndAlso (dr("CantidadDisponible").ToString().ToDouble - rowSurtidos("Surtido").ToString().ToDouble > 0 Or dr("SerieLote").ToString() <> "") + If rowSurtidos("Surtido").ToString().ToDecimal < rowSurtidos("Cantidad").ToString().ToDecimal Then + Dim CantidadSurtida As Double = If(dr("CantidadDisponible").ToString().ToDecimal < rowSurtidos("Cantidad").ToString().ToDouble, dr("CantidadDisponible").ToString().ToDecimal, rowSurtidos("Cantidad").ToString().ToDecimal) MovDTCuadrados.ImportRow(dr) MovDTCuadrados(MovDTCuadrados.Rows.Count - 1)("Cantidad") = CantidadSurtida - DtRemConceptosSurtidos(Indice)("Surtido") = rowSurtidos("Surtido").ToString.ToDecimal + CantidadSurtida + DtRemConceptosSurtidos(Indice)("Surtido") = rowSurtidos("Surtido").ToString().ToDecimal + CantidadSurtida End If Else ErrorList.Add("Ocurrió un error al traspasar el inventario de la remisión") @@ -16174,10 +16167,10 @@ Partial Class Ventas For Each dr As DataRow In DtMovimientos.Rows 'Obtenemos los Movimientos de salida - If ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, 3, -1, UsuarioActual.CveEmpresa) Then + If ObjInventario.GetMovimientos(dr("CveMovimiento").ToString().ToEntero(), 3, -1, UsuarioActual.CveEmpresa) Then - Dim CveAlmacenSalida As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString.ToEntero - Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString.ToEntero + Dim CveAlmacenSalida As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString().ToEntero() + Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString().ToEntero() 'Le damos entrada If Not GenerarMovimientoAlmacen(ObjInventario, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"), CveAlmacenSalida, 2, CveMoneda, CveRemision) > 0 Then @@ -16214,8 +16207,8 @@ Partial Class Ventas For Each MovDet As DataRow In DtMovDetalle.Rows Dim Cantidad = 0.0 - Dim CantidadRemision = DtRemisionesTmpDT.FiltroPrimeroValor("Cantidad", $"CveVentaDetalleRemision={MovDet("CveVentaDetalle").ToString}").ToDouble - Dim CantidadInventario = MovDet("Cantidad").ToString.ToDecimal + Dim CantidadRemision = DtRemisionesTmpDT.FiltroPrimeroValor("Cantidad", $"CveVentaDetalleRemision={MovDet("CveVentaDetalle").ToString()}").ToDouble + Dim CantidadInventario = MovDet("Cantidad").ToString().ToDecimal If RemisionesLista.Count > 0 AndAlso ChkRemProductos.Checked AndAlso CantidadInventario >= CantidadRemision Then Cantidad = CantidadRemision @@ -16223,15 +16216,15 @@ Partial Class Ventas Cantidad = CantidadInventario End If - Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero - Dim PU As Decimal = MovDet("PU").ToString.ToDecimal - Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero - Dim Serie As String = MovDet("Serie").ToString - Dim Consec As Integer = DtRemisionesTmpDT.FiltroPrimeroValor("Consec", $"CveVentaDetalle = {MovDet("CveVentaDetalle").ToString}").ToEntero + Dim CveUnidad As Integer = MovDet("CveUM").ToString().ToEntero() + Dim PU As Decimal = MovDet("PU").ToString().ToDecimal + Dim CveProducto As Integer = MovDet("CvePS").ToString().ToEntero() + Dim SerieLote As String = MovDet("SerieLote").ToString() + Dim Consec As Integer = DtRemisionesTmpDT.FiltroPrimeroValor("Consec", $"CveVentaDetalle = {MovDet("CveVentaDetalle").ToString()}").ToEntero() 'COMIENZA: VENTADETALLE 'CUANDO SEA SALIDA VA POR LA VENTA DETALLE DE LA FACTURA DE LA REMISION - OJO!! SOLO FUNCIONA HASTA ORITA QUE SE HACE SALIDA SOLO CUANDO SE FACTURA LA REMISION - Dim CveVentaDetalle = If(ConceptoEntrada.Contiene(3, 40), TmpDT.FiltroPrimeroValor("CveVentaDetalle", $"Consec={Consec}").ToEntero, MovDet("CveVentaDetalle").ToString.ToEntero) + Dim CveVentaDetalle = If(ConceptoEntrada.Contiene(3, 40), TmpDT.FiltroPrimeroValor("CveVentaDetalle", $"Consec={Consec}").ToEntero(), MovDet("CveVentaDetalle").ToString().ToEntero()) 'CUANDO LA VENTADETALLE NO TENGA VALOR DEBE MARCAR ERROR, NUEVA RESTRICCION DE ALMACEN If CveVentaDetalle < 0 Then Alert("no se encontro la venta detalle. Por favor comuniquese con atención SIG.", TipoMensaje.ToastError) @@ -16249,10 +16242,10 @@ Partial Class Ventas 'CUANDO SEA REMISION FACTURADA DEBE RELACIONAR LOS NUEVOS MOVIMIENTOS POR EL DETALLE Dim CveMovimientoDetalleEntrada As Integer = -1 If AplicaMovimientoDetalleEntrada Then - CveMovimientoDetalleEntrada = MovDet("CveMovimientoDetalle").ToString.ToEntero + CveMovimientoDetalleEntrada = MovDet("CveMovimientoDetalle").ToString().ToEntero() End If - If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then + If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then ContadorMovtosDetalles += 1 Else OcurrioError = True @@ -16276,8 +16269,8 @@ Partial Class Ventas For Each RowInv As DataRow In DtCostosDistinct.Rows ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero + IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() + CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() TotalCostoAcumulado += ValorInventario 'cuando es el último movimiento y hay diferencias en los importes @@ -16287,7 +16280,7 @@ Partial Class Ventas Try 'If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then OcurrioError = True Exit For End If @@ -16300,7 +16293,7 @@ Partial Class Ventas Next If Not OcurrioError Then - IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero + IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero() If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then OcurrioError = True End If @@ -16369,8 +16362,8 @@ Partial Class Ventas For Each RowInv As DataRow In DtCostosDistinct.Rows ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero + IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() + CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() TotalCostoAcumulado += ValorInventario 'cuando es el último movimiento y hay diferencias en los importes @@ -16380,7 +16373,7 @@ Partial Class Ventas Try 'If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then OcurrioError = True Exit For End If @@ -16393,7 +16386,7 @@ Partial Class Ventas Next If Not OcurrioError Then - IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero + IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero() If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then OcurrioError = True End If @@ -16494,8 +16487,8 @@ Partial Class Ventas For Each RowInv As DataRow In DtCostosDistinct.Rows ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero + IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() + CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() TotalCostoAcumulado += ValorInventario 'cuando es el último movimiento y hay diferencias en los importes @@ -16505,7 +16498,7 @@ Partial Class Ventas Try 'If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then OcurrioError = True Exit For End If @@ -16518,7 +16511,7 @@ Partial Class Ventas Next If Not OcurrioError Then - IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacenVirtual)).ToEntero + IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacenVirtual)).ToEntero() If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then OcurrioError = True End If @@ -16560,11 +16553,11 @@ Partial Class Ventas 'Obtenemos los movimientos detalle If ObjInventario.GetMovimientosOS(9, CveOS, UsuarioActual.CveEmpresa) Then If ObjInventario.DtResultados.Rows.Count > 0 Then - Dim CveMovimiento As Integer = ObjInventario.DtResultados(0)("CveMovimiento").ToString.ToEntero - Dim CveAlmacenOrigen As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString.ToEntero - Dim CveAlmacenDestino As Integer = ObjInventario.DtResultados(0)("AlmacenDestino2").ToString.ToEntero - Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString.ToEntero - Dim CveTipoAlmacen As Integer = ObjInventario.DtResultados(0)("CveTipoAlmacen").ToString.ToEntero + Dim CveMovimiento As Integer = ObjInventario.DtResultados(0)("CveMovimiento").ToString().ToEntero() + Dim CveAlmacenOrigen As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString().ToEntero() + Dim CveAlmacenDestino As Integer = ObjInventario.DtResultados(0)("AlmacenDestino2").ToString().ToEntero() + Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString().ToEntero() + Dim CveTipoAlmacen As Integer = ObjInventario.DtResultados(0)("CveTipoAlmacen").ToString().ToEntero() 'AGREGAMOS LA ENTRADA Movto 1 If Not TieneError Then @@ -16582,7 +16575,7 @@ Partial Class Ventas If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, -1) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, -1, -1) Then TieneError = True TextoError = "Ocurrió un Error al guardar los movimientos de entrada" Exit For @@ -16610,7 +16603,7 @@ Partial Class Ventas If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada2, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, -1) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada2, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, -1, -1) Then TieneError = True TextoError = "Ocurrió un Error al guardar los movimientos de entrada" Exit For @@ -16638,7 +16631,7 @@ Partial Class Ventas If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada2, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada3, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, -1) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada3, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, -1, -1) Then TieneError = True TextoError = "Ocurrió un Error al guardar los movimientos de entrada" Exit For @@ -16674,12 +16667,12 @@ Partial Class Ventas Dim TipoComprobante = "" - If DdlTipoComprobante.SelectedValue.ToString = "Ing" Then TipoComprobante = "Factura" - If DdlTipoComprobante.SelectedValue.ToString = "Egs" Then TipoComprobante = "Nota de Crédito" - If DdlTipoComprobante.SelectedValue.ToString = "Dev" Then TipoComprobante = "Nota de Devolución" - If DdlTipoComprobante.SelectedValue.ToString = "Rem" Then TipoComprobante = "Remisión" - If DdlTipoComprobante.SelectedValue.ToString = "Cot" Then TipoComprobante = "Cotización" - If DdlTipoComprobante.SelectedValue.ToString = "Ant" Then TipoComprobante = "Anticipo" + If DdlTipoComprobante.SelectedValue.ToString() = "Ing" Then TipoComprobante = "Factura" + If DdlTipoComprobante.SelectedValue.ToString() = "Egs" Then TipoComprobante = "Nota de Crédito" + If DdlTipoComprobante.SelectedValue.ToString() = "Dev" Then TipoComprobante = "Nota de Devolución" + If DdlTipoComprobante.SelectedValue.ToString() = "Rem" Then TipoComprobante = "Remisión" + If DdlTipoComprobante.SelectedValue.ToString() = "Cot" Then TipoComprobante = "Cotización" + If DdlTipoComprobante.SelectedValue.ToString() = "Ant" Then TipoComprobante = "Anticipo" If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta @@ -16723,10 +16716,10 @@ Partial Class Ventas 'CASO ESPECIAL If CveUsuarioActual = 1446 Then ' Flora - Dim str As String = "Flora Envio: Correo:" & Mail & " - CorreosCC: " & MailCC & " RM:" & ResultadoMail.ToString + Dim str As String = "Flora Envio: Correo:" & Mail & " - CorreosCC: " & MailCC & " RM:" & ResultadoMail.ToString() str.GuardaLog() ElseIf CveUsuarioActual = 1513 Then ' Flora - Dim str As String = "Flora Envio (secundario): Correo:" & Mail & " - CorreosCC: " & MailCC & " RM:" & ResultadoMail.ToString + Dim str As String = "Flora Envio (secundario): Correo:" & Mail & " - CorreosCC: " & MailCC & " RM:" & ResultadoMail.ToString() str.GuardaLog() End If @@ -16748,9 +16741,9 @@ Partial Class Ventas Dim valueselect = DdlContrato.SelectedValue CargaDatosEstimaciones(CveCliente) DdlContrato.SelectedValue = valueselect - If DdlContrato.SelectedValue.ToEntero > 0 Then + If DdlContrato.SelectedValue.ToEntero() > 0 Then For Each gvr As GridViewRow In GvEst.Rows - If gvr.DataKey("CveContratoAvance").ToEntero > 0 Then + If gvr.DataKey("CveContratoAvance").ToEntero() > 0 Then gvr.FCCheckBox("Chk").Checked = True gvr.FCCheckBox("Chk").Visible = True End If @@ -16764,7 +16757,7 @@ Partial Class Ventas Exit Sub End If Dim Con As New ClsContratos - If Con.GetEstimacionesPorFacturar(-1, CveCliente, DdlContrato.SelectedValue.ToEntero, 0, UsuarioActual.CveEmpresa) Then + If Con.GetEstimacionesPorFacturar(-1, CveCliente, DdlContrato.SelectedValue.ToEntero(), 0, UsuarioActual.CveEmpresa) Then GvEst.DataSource = Con.DtResultados If Con.DtResultados.Rows.Count > 0 Then 'BtnEstimacion.Visible = True @@ -16786,13 +16779,13 @@ Partial Class Ventas e.Row.Cells(2).Width = Unit.Pixel(100) 'Cantidad e.Row.CssClass = "Totales" Else - If e.Row.DBCampo("CveContratoAvance").ToString.ToEntero > 0 Then + If e.Row.DBCampo("CveContratoAvance").ToString().ToEntero() > 0 Then ' e.Row.FCCheckBox("Chk").Visible = True Else - If e.Row.DBCampo("CveSubFamilias").ToString.ToEntero > 0 Then + If e.Row.DBCampo("CveSubFamilias").ToString().ToEntero() > 0 Then e.Row.CssClass = "SubTotales3" Else - If e.Row.DBCampo("CveFamilias").ToString.ToEntero > 0 Then + If e.Row.DBCampo("CveFamilias").ToString().ToEntero() > 0 Then e.Row.CssClass = "SubTotales2" Else e.Row.CssClass = "SubTotales" @@ -16807,7 +16800,7 @@ Partial Class Ventas Try Dim CerFile As New FileStream(Ruta & "Certificados\" & UsuarioActual.Empresa.ArchivoCer, FileMode.Open, FileAccess.Read) - Dim Size As Integer = CerFile.Length.ToString.ToEntero() + Dim Size As Integer = CerFile.Length.ToString().ToEntero() Dim Data As Byte() = New Byte(Size - 1) {} Size = CerFile.Read(Data, 0, Size) CerFile.Close() @@ -16840,9 +16833,9 @@ Partial Class Ventas e.Row.Cells(3).Width = Unit.Pixel(500) End If - If e.Row.DBCampo("Archivo").ToString <> "" Then + If e.Row.DBCampo("Archivo").ToString() <> "" Then e.Row.FCLinkButton("LinkArchivo").Visible = True - e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString) + e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString()) ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione End If @@ -16863,7 +16856,7 @@ Partial Class Ventas Dim ObjEventos As New ClsOIEventos() If ObjEventos.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}", ObjEventos.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + Filename.FilesMove(String.Format("OI{0}", ObjEventos.CveEvento.ToString()), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) End If End If ObjEventos.Dispose() @@ -16876,7 +16869,7 @@ Partial Class Ventas Dim ObjEventoBitacora As New ClsOIEventos() If ObjEventoBitacora.GetAgendaBitacora(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then - GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2") + GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento IN(6,2,1)") Else GvEB.DataSource = Nothing End If @@ -16905,9 +16898,9 @@ Partial Class Ventas #Region "BTN 'S" Protected Sub LnkActualizarOrdenProduccion_Click(sender As Object, e As EventArgs) - If DdlOrdenProduccion.SelectedValue.ToEntero > 0 Then + If DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then Dim ObjCGame As New ClsCGame - If ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero, CveVenta) Then + If ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then Alert("La orden de producción fue actualizada con exito.") End If ObjCGame.Dispose() @@ -16918,7 +16911,7 @@ Partial Class Ventas Protected Sub LnkContratoAcptar_Click(sender As Object, e As EventArgs) Handles LnkContratoAcptar.Click Dim objcontra As New ClsContratos objcontra.IniciaTransacSQL() - If objcontra.AddContratosAceptados(ViewState("CveVenta").ToString.ToEntero, TxtNombreContrato.Text, 13, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then '-----------------------------------------------Falata la CveContrato!!!!!!!!!!!!!! + If objcontra.AddContratosAceptados(ViewState("CveVenta").ToString().ToEntero(), TxtNombreContrato.Text, 13, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then '-----------------------------------------------Falata la CveContrato!!!!!!!!!!!!!! objcontra.Commit() Alert("La cotización fue aceptada" & objcontra.CveContrato, TipoMensaje.MsgInformacion) Else @@ -17028,7 +17021,7 @@ Partial Class Ventas DtDetalle = TmpDT.Copy For Each Row As DataRow In DtDetalle.Rows - If OS.GetDetalleMateriales(Row("CveOSDetalle").ToString.ToEntero, CveOS) Then + If OS.GetDetalleMateriales(Row("CveOSDetalle").ToString().ToEntero(), CveOS) Then Dim Cons As Integer = TmpDT.Rows.Count + 1 For Each dr As DataRow In OS.DtResultados.FiltraParametros("SeFacturara = 1 ").Rows @@ -17079,9 +17072,9 @@ Partial Class Ventas 'SI EL DETALLE NO TIENE MOVIMIENTOS DE INVENTARIO ES VISIBLE Dim CantidadFacturadaRemision = 0.0 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 + 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 '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." @@ -17122,22 +17115,22 @@ Partial Class Ventas Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL()) Dim ObjAC As ClsContPAQi = Nothing - Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero + Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero() Dim TipoCambio As Double = TxtTipoCambio.Text.ToDouble EditoRemision = True Try 'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS - If DdlMoneda.SelectedValue.ToEntero <> 2 AndAlso ChkConvertirDolares.Checked Then + If DdlMoneda.SelectedValue.ToEntero() <> 2 AndAlso ChkConvertirDolares.Checked Then For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6) - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales) Next Dim ImpuestosLocales As Double = 0 @@ -17162,19 +17155,19 @@ Partial Class Ventas End If 'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES - If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then + If DdlMoneda.SelectedValue.ToEntero() <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then Dim Importe As Decimal Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TCC, 6) - Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) - Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal * TCC, NumeroDecimales) - Importe = Row("Total").ToString.ToDecimal - Row("Descuento").ToString.ToDecimal - Row("ImporteIEPS") = Math.Round(Importe * Row("PorcentajeIEPS").ToString.ToDecimal, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Importe * Row("PorcentajeIVA").ToString.ToDecimal, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Importe * Row("PorcentajeRetIVA").ToString.ToDecimal, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Importe * Row("PorcentajeRetISR").ToString.ToDecimal, NumeroDecimales) + Row("PU") = Math.Round(Row("PU").ToString().ToDecimal * TCC, 6) + Row("Total") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales) + Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDecimal * TCC, NumeroDecimales) + Importe = Row("Total").ToString().ToDecimal - Row("Descuento").ToString().ToDecimal + Row("ImporteIEPS") = Math.Round(Importe * Row("PorcentajeIEPS").ToString().ToDecimal, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Importe * Row("PorcentajeIVA").ToString().ToDecimal, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Importe * Row("PorcentajeRetIVA").ToString().ToDecimal, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Importe * Row("PorcentajeRetISR").ToString().ToDecimal, NumeroDecimales) Next Dim ImpuestosLocales As Double = 0 @@ -17203,8 +17196,8 @@ Partial Class Ventas If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDecimal, LblDescuentos.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtIEPS.Text.ToDecimal, TxtTotal.Text.ToDecimal, Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim, UsuarioActual.CveEmpresa, CveVenta, 0, 0, Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1), - PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero, - CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, TipoDocto:="Rem", CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, + PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(), + CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(), TipoDocto:="Rem", CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, Kilometraje:=TxtKilometraje.Text.ToDouble) Then OcurrioError = True End If @@ -17213,18 +17206,18 @@ Partial Class Ventas If Not OcurrioError Then Dim index As Integer = 0 For Each Row As DataRow In TmpDT.Rows - Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero() + Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString().ToEntero() If CveVentaDetalle > 0 Then - If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then + If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then OcurrioError = True Exit For End If Else - If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero, - Row("PU").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString.ToDouble, Math.Round((Row("Total").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6), - Row("Obs").ToString, Row("Descuento").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero, PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal, IEPS:=Row("ImporteIEPS").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString, - CveVentaDetallePadre:=Row("CveVentaDetalle").ToString.ToEntero, CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString}").ToEntero, -1), - ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDouble, CuentaPredial:=Row("CuentaPredial").ToString) Then + If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(), + Row("PU").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6), + Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, IEPS:=Row("ImporteIEPS").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString(), + CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(), CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString()}").ToEntero(), -1), + ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString()) Then OcurrioError = True Exit For Else @@ -17242,7 +17235,7 @@ Partial Class Ventas DtEliminados = ObjVentas.DtResultados.FiltraParametros("", "", {"CveVentaDetalle"}) For Each Dr1 As DataRow In DtEliminados.Rows If TmpDT.FiltraParametros($"CveVentaDetalle = {Dr1("CveVentaDetalle")}").Rows.Count = 0 Then - If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString().ToEntero()) Then OcurrioError = True End If End If @@ -17258,7 +17251,7 @@ Partial Class Ventas If Not OcurrioError Then For Each gvr As GridViewRow In GvImpuestosLocales2.Rows If gvr.RowType = DataControlRowType.DataRow Then - If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString.ToEntero, gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal) Then + If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString().ToEntero(), gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal) Then OcurrioError = True End If End If @@ -17268,7 +17261,7 @@ Partial Class Ventas 'Orden Produccion' If Not OcurrioError Then If UsuarioActual.CveEmpresa.Contiene(126) Then - If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero > 0 Then + If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then OcurrioError = True End If @@ -17315,7 +17308,7 @@ Partial Class Ventas ObjVentas.IniciaTransacSQL() Dim TieneError = False - If Not ObjVentas.UpdateVentaCuentaTerminal(DdlCuentaTerminalModal.SelectedValue.ToEntero, CveVenta) Then + If Not ObjVentas.UpdateVentaCuentaTerminal(DdlCuentaTerminalModal.SelectedValue.ToEntero(), CveVenta) Then TieneError = True End If @@ -17349,7 +17342,7 @@ Partial Class Ventas Dim TipoVenta As Integer = 0 Dim drSucursal As DataRow = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", If(DdlSubProyectoDatos.SelectedValue = "", "-1", DdlSubProyectoDatos.SelectedValue))) - If drSucursal IsNot Nothing Then TipoVenta = drSucursal("TipoVenta").ToString.ToEntero + If drSucursal IsNot Nothing Then TipoVenta = drSucursal("TipoVenta").ToString().ToEntero() If TipoVenta = 1 Then ChkClasificacion.Checked = True @@ -17367,7 +17360,7 @@ Partial Class Ventas Dim DrProducto As DataRow = Nothing If TxtCantidad.Text.Trim.ToDouble <= 0 Then TxtCantidad.Text = "1" - Dim Serie As String = "" + Dim SerieLote As String = "" Dim CodigoBarras As String = "" Dim CvePS As Integer @@ -17376,10 +17369,10 @@ Partial Class Ventas 'BUSCA POR SERIE E IGNORA CODIGO DE BARRAS (LIMPIA) If TxtCodigoSerie.Text.Trim <> "" Then - Serie = TxtCodigoSerie.Text.Trim().ToUpper() + SerieLote = TxtCodigoSerie.Text.Trim().ToUpper() Dim Objinventarios As New ClsInventarios - Dim Existencia = Objinventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, -1, Serie:=Serie, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) - Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Serie)) + Dim Existencia = Objinventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, -1, SerieLote:=SerieLote, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero()) + Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", SerieLote)) CvePS = Objinventarios.CvePS Objinventarios.Dispose() @@ -17387,14 +17380,14 @@ Partial Class Ventas If CvePS > 0 Then DrProducto = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If DrProducto IsNot Nothing Then - HdnCvePS.Value = CvePS.ToString + HdnCvePS.Value = CvePS.ToString() TxtCantidad.Text = "1" Else - Alert($"No se encontró un producto con la serie: {Serie}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia) + Alert($"No se encontró un producto con la serie: {SerieLote}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia) End If End If Else - Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", Serie), TipoMensaje.MsgAdvertencia) + Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", SerieLote), TipoMensaje.MsgAdvertencia) TxtCodigoSerie.Focus() RegistraScript($"$('#{TxtCodigoSerie.ClientID}').select();") Exit Sub @@ -17407,17 +17400,17 @@ Partial Class Ventas CodigoBarras = TxtCodigoBarras.Text.Trim() DrProducto = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"CodigoBarras = '{CodigoBarras}'") If DrProducto IsNot Nothing Then - If DrProducto("Inv_CveMetodoInventario").ToString = "5" Then 'si es serie + If DrProducto("Inv_CveMetodoInventario").ToString() = "5" Then 'si es serielote TxtCodigoSerie.Focus() Exit Sub Else - CvePS = DrProducto("CvePS").ToString.ToEntero - HdnCvePS.Value = CvePS.ToString + CvePS = DrProducto("CvePS").ToString().ToEntero() + HdnCvePS.Value = CvePS.ToString() End If Else TxtCodigoBarras.Focus() RegistraScript($"$('#{TxtCodigoBarras.ClientID}').select();") - Alert($"No se encontró un producto con el código de barras: {Serie}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia) + Alert($"No se encontró un producto con el código de barras: {SerieLote}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia) Exit Sub End If End If @@ -17444,12 +17437,12 @@ Partial Class Ventas 'BUSCA EL PRECIO DE LA SUCURSAL Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSSucursales(DrProducto("CvePS").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlSubProyectoDatos.SelectedValue.ToEntero) Then + If ObjPS.GetPSSucursales(DrProducto("CvePS").ToString().ToEntero(), UsuarioActual.CveEmpresa, DdlSubProyectoDatos.SelectedValue.ToEntero()) Then Dim dtt As DataTable = ObjPS.DtResultados Dim drPrecio As DataRow = dtt.FiltroPrimero("") If drPrecio IsNot Nothing And TxtPrecio.Enabled = False Then - TxtPrecio.Text = drPrecio("Importe").ToString.ToDouble.ToString("N4") + TxtPrecio.Text = drPrecio("Importe").ToString().ToDouble.ToString("N4") End If dtt.Dispose() End If @@ -17457,36 +17450,36 @@ Partial Class Ventas 'SI NO CARGA PRECIO DE LA SUCURSAL TOMA EL DEL PS If TxtPrecio.Text.ToDouble <= 0 Then - TxtPrecio.Text = DrProducto("Precio").ToString.ToDouble.ToString("N4") + TxtPrecio.Text = DrProducto("Precio").ToString().ToDouble.ToString("N4") End If - HdnPS.Value = DrProducto("PS").ToString - HdnCodigoPS.Value = DrProducto("PSCodigo").ToString - HdnTipoPS.Value = DrProducto("CveTipoPS").ToString - HdnTipoInv.Value = DrProducto("Inv_CveMetodoInventario").ToString - HdnAplicaIEPS.Value = DrProducto("AplicaIEPS").ToString - HdnPorcentajeIEPS.Value = DrProducto("IEPSPorcentaje").ToString - HdnIVAPS.Value = If(DrProducto("IVA").ToString = "-1", ViewState("IVA"), DrProducto("IVA").ToString).ToString - HdnIVARetAPS.Value = DrProducto("RetIVA").ToString - HdnAsientoContable.Value = DrProducto("AsientoContableVentas").ToString - HdnCtaContable.Value = DrProducto("IdCtaContVentas").ToString - HdnAplicaParaConcepto.Value = DrProducto("AplicaParaConcepto").ToString - HdnCodigo.Value = DrProducto("Codigo").ToString + HdnPS.Value = DrProducto("PS").ToString() + HdnCodigoPS.Value = DrProducto("PSCodigo").ToString() + HdnTipoPS.Value = DrProducto("CveTipoPS").ToString() + HdnTipoInv.Value = DrProducto("Inv_CveMetodoInventario").ToString() + HdnAplicaIEPS.Value = DrProducto("AplicaIEPS").ToString() + HdnPorcentajeIEPS.Value = DrProducto("IEPSPorcentaje").ToString() + HdnIVAPS.Value = If(DrProducto("IVA").ToString() = "-1", ViewState("IVA"), DrProducto("IVA").ToString()).ToString() + HdnIVARetAPS.Value = DrProducto("RetIVA").ToString() + HdnAsientoContable.Value = DrProducto("AsientoContableVentas").ToString() + HdnCtaContable.Value = DrProducto("IdCtaContVentas").ToString() + HdnAplicaParaConcepto.Value = DrProducto("AplicaParaConcepto").ToString() + HdnCodigo.Value = DrProducto("Codigo").ToString() - If ValidaAgregarPS(DrProducto("CvePS").ToString.ToEntero, DrProducto("CveUM").ToString.ToEntero, TxtPrecio.Text.Trim.ToDouble, DrProducto("CveTipoPS").ToString.ToEntero) Then + If ValidaAgregarPS(DrProducto("CvePS").ToString().ToEntero(), DrProducto("CveUM").ToString().ToEntero(), TxtPrecio.Text.Trim.ToDouble, DrProducto("CveTipoPS").ToString().ToEntero()) Then If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then - CvePSAmortizacion = DdlPS.SelectedValue.ToEntero.ToEntero + CvePSAmortizacion = DdlPS.SelectedValue.ToEntero().ToEntero() End If - AgregarProductoServicio(TxtCantidad.Text.Trim.ToDecimal, DrProducto("CveUM").ToString.ToEntero, DrProducto("UnidadMedida").ToString, DrProducto("CveClasificacion").ToString.ToEntero, DrProducto("Clasificacion").ToString, - DrProducto("CvePS").ToString.ToEntero, DrProducto("PS").ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDecimal, 0, - DdlProyecto.SelectedValue.ToEntero, DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text) + AgregarProductoServicio(TxtCantidad.Text.Trim.ToDecimal, DrProducto("CveUM").ToString().ToEntero(), DrProducto("UnidadMedida").ToString(), DrProducto("CveClasificacion").ToString().ToEntero(), DrProducto("Clasificacion").ToString(), + DrProducto("CvePS").ToString().ToEntero(), DrProducto("PS").ToString(), TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDecimal, 0, + DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text) - 'AddPS(TxtCantidad.Text.Trim.ToDouble, DrProducto("CveUM").ToString.ToEntero, DrProducto("UnidadMedida").ToString, DrProducto("CveClasificacion").ToString.ToEntero, DrProducto("Clasificacion").ToString, - ' DrProducto("CvePS").ToString.ToEntero, DrProducto("PS").ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, HdnIVAPS.Value.ToDouble, 0, 0, - ' -1, -1, True, DrProducto("Codigo").ToString, DdlProyecto.SelectedValue.ToEntero, - ' DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text, DrProducto("CveTipoPS").ToString.ToEntero, DrProducto("Inv_CveMetodoInventario").ToString.ToEntero, SerieLote:=SerieLote, CodigoPS:=DrProducto("PSCodigo").ToString) + 'AddPS(TxtCantidad.Text.Trim.ToDouble, DrProducto("CveUM").ToString().ToEntero(), DrProducto("UnidadMedida").ToString(), DrProducto("CveClasificacion").ToString().ToEntero(), DrProducto("Clasificacion").ToString(), + ' DrProducto("CvePS").ToString().ToEntero(), DrProducto("PS").ToString(), TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, HdnIVAPS.Value.ToDouble, 0, 0, + ' -1, -1, True, DrProducto("Codigo").ToString(), DdlProyecto.SelectedValue.ToEntero(), + ' DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text, DrProducto("CveTipoPS").ToString().ToEntero(), DrProducto("Inv_CveMetodoInventario").ToString().ToEntero(), SerieLote:=SerieLote, CodigoPS:=DrProducto("PSCodigo").ToString()) LimpiaAgregar() End If @@ -17510,14 +17503,14 @@ Partial Class Ventas Select Case DdlMoneda.SelectedValue Case "1" TxtTipoCambio.Text = "1" - TxtTipoCambioDlls.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString + TxtTipoCambioDlls.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString() TrConversionDolares.Visible = True Case "2" TxtTipoCambioDlls.Text = "1" - TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString + TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString() TrConversionTipoCambio.Visible = True Case Else - TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString + TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString() TrConversionTipoCambio.Visible = True End Select UpPS.Update() @@ -17529,12 +17522,12 @@ Partial Class Ventas Private Sub btnBuscarPrecio_Click(sender As Object, e As EventArgs) Handles btnBuscarPrecio.Click Dim Codigo, CodigoBarras As String Dim CvePS As Integer - CvePS = If(DdlBPPS.SelectedValue.ToEntero > 0, DdlBPPS.SelectedValue.ToEntero, -1) + CvePS = If(DdlBPPS.SelectedValue.ToEntero() > 0, DdlBPPS.SelectedValue.ToEntero(), -1) Codigo = If(TxtBPCodigo.Text.Trim.Length = 0, "", TxtBPCodigo.Text) CodigoBarras = If(TxtBPCodigoBarras.Text.Trim.Length = 0, "", TxtBPCodigoBarras.Text) Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSSucursalesALL(DdlPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, Codigo:=Codigo, CodigoBarras:=CodigoBarras) Then + If ObjPS.GetPSSucursalesALL(DdlPS.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), Codigo:=Codigo, CodigoBarras:=CodigoBarras) Then GVBuscarPrecio.DataSource = ObjPS.DtResultados Else GVBuscarPrecio.DataSource = Nothing @@ -17585,11 +17578,11 @@ Partial Class Ventas If DtPagos IsNot Nothing Then DtPagos.Rows.Clear() CargaGridContado() - Select Case RBLPago.SelectedValue.ToEntero + Select Case RBLPago.SelectedValue.ToEntero() Case 1 'CREDITO TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString Case 2 'CONTADO - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Or (UsuarioActual.Empresa.Funcionalidad(558).ToEntero = 1 And DdlTipoComprobante.SelectedValue = "Cot") Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Or (UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And DdlTipoComprobante.SelectedValue = "Cot") Then DivContado.Visible = True TxtImporteContado.Text = TxtTotal.Text End If @@ -17611,11 +17604,11 @@ Partial Class Ventas DdlCuentaTransferencia.Items.Clear() - DdlCuentaEfectivo.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(DdlMoneda.SelectedValue.ToEntero <= 0, 1, DdlMoneda.SelectedValue.ToEntero))) - DdlCuentaTarjetaCredito.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero <= 0, 1, DdlMoneda.SelectedValue.ToEntero))) - DdlCuentaTarjetaDebito.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero <= 0, 1, DdlMoneda.SelectedValue.ToEntero))) - DdlCuentaCheque.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(DdlMoneda.SelectedValue.ToEntero <= 0, 1, DdlMoneda.SelectedValue.ToEntero))) - DdlCuentaTransferencia.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero <= 0, 1, DdlMoneda.SelectedValue.ToEntero))) + DdlCuentaEfectivo.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) + DdlCuentaTarjetaCredito.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) + DdlCuentaTarjetaDebito.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) + DdlCuentaCheque.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) + DdlCuentaTransferencia.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) DdlCuentaEfectivo.DataBind() DdlCuentaTarjetaCredito.DataBind() @@ -17631,17 +17624,17 @@ Partial Class Ventas DivContadoOtrosCuenta.Attributes.Add("class", "col-md-6") DivMesesSinIntereses2.Visible = False - Select Case DdlOtroFormaPago.SelectedValue.ToEntero + Select Case DdlOtroFormaPago.SelectedValue.ToEntero() Case 1 DivContadoOtrosCuenta.Attributes.Add("class", "col-md-3") DivMesesSinIntereses2.Visible = True - DdlCuentaOtrosContado.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero <= 0, 1, DdlMoneda.SelectedValue.ToEntero))) + DdlCuentaOtrosContado.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) Exit Select Case 2 - DdlCuentaOtrosContado.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero <= 0, 1, DdlMoneda.SelectedValue.ToEntero))) + DdlCuentaOtrosContado.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) Exit Select Case 3 - DdlCuentaOtrosContado.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(DdlMoneda.SelectedValue.ToEntero <= 0, 1, DdlMoneda.SelectedValue.ToEntero))) + DdlCuentaOtrosContado.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) Exit Select Case -1 DdlCuentaOtrosContado.DataSource = Nothing @@ -17680,7 +17673,7 @@ Partial Class Ventas '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 - 'CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString + 'CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString() CargaGridContado() UpContado.Update() @@ -17711,7 +17704,7 @@ Partial Class Ventas Exit Sub End If - If (DtPagos.SUM("Importe").ToString.ToDecimal + total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then + If (DtPagos.SUM("Importe").ToString().ToDecimal + total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor rectifique.", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -17725,7 +17718,7 @@ Partial Class Ventas DrEfectivo("CveCuenta") = DdlCuentaEfectivo.SelectedValue DrEfectivo("Cuenta") = DdlCuentaEfectivo.SelectedItem.Text DrEfectivo("Importe") = TxtImporteEfectivo.Text.ToDecimal - TxtCambio.Text.ToDecimal - DrEfectivo("Folio") = CargaFolioContado(DdlCuentaEfectivo.SelectedValue.ToEntero, 6) + DrEfectivo("Folio") = CargaFolioContado(DdlCuentaEfectivo.SelectedValue.ToEntero(), 6) DrEfectivo("Observaciones") = "" DrEfectivo("Tipo") = "Caja Chica" DrEfectivo("CveMetodoPago") = 1 @@ -17747,13 +17740,13 @@ Partial Class Ventas DrCredito("CveCuenta") = DdlCuentaTarjetaCredito.SelectedValue DrCredito("Cuenta") = DdlCuentaTarjetaCredito.SelectedItem.Text DrCredito("Importe") = TxtImporteCredito.Text - DrCredito("Folio") = CargaFolioContado(DdlCuentaTarjetaCredito.SelectedValue.ToEntero, 12) + DrCredito("Folio") = CargaFolioContado(DdlCuentaTarjetaCredito.SelectedValue.ToEntero(), 12) DrCredito("Observaciones") = "" DrCredito("Tipo") = "Tarjeta de Crédito" DrCredito("CveMetodoPago") = 4 - If UsuarioActual.Empresa.Funcionalidad(558).ToEntero = 1 Then - DrCredito("MesesSinIntereses") = DDlMesesSinIntereses.SelectedValue.ToEntero + If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 Then + DrCredito("MesesSinIntereses") = DDlMesesSinIntereses.SelectedValue.ToEntero() Else DrCredito("MesesSinIntereses") = -1 End If @@ -17776,7 +17769,7 @@ Partial Class Ventas DrDebito("CveCuenta") = DdlCuentaTarjetaDebito.SelectedValue DrDebito("Cuenta") = DdlCuentaTarjetaDebito.SelectedItem.Text DrDebito("Importe") = TxtImporteDebito.Text - DrDebito("Folio") = CargaFolioContado(DdlCuentaTarjetaDebito.SelectedValue.ToEntero, 11) + DrDebito("Folio") = CargaFolioContado(DdlCuentaTarjetaDebito.SelectedValue.ToEntero(), 11) DrDebito("Observaciones") = "" DrDebito("Tipo") = "Tarjeta de Débito" DrDebito("CveMetodoPago") = 5 @@ -17797,7 +17790,7 @@ Partial Class Ventas DrCheque("CveCuenta") = DdlCuentaCheque.SelectedValue DrCheque("Cuenta") = DdlCuentaCheque.SelectedItem.Text DrCheque("Importe") = TxtImporteCheque.Text - DrCheque("Folio") = CargaFolioContado(DdlCuentaCheque.SelectedValue.ToEntero, 3) + DrCheque("Folio") = CargaFolioContado(DdlCuentaCheque.SelectedValue.ToEntero(), 3) DrCheque("Observaciones") = "" DrCheque("Tipo") = "Cheque" DrCheque("CveMetodoPago") = 2 @@ -17818,7 +17811,7 @@ Partial Class Ventas DrCheque("CveCuenta") = DdlCuentaTransferencia.SelectedValue DrCheque("Cuenta") = DdlCuentaTransferencia.SelectedItem.Text DrCheque("Importe") = TxtImporteTransferencia.Text - DrCheque("Folio") = CargaFolioContado(DdlCuentaTransferencia.SelectedValue.ToEntero, 8) + DrCheque("Folio") = CargaFolioContado(DdlCuentaTransferencia.SelectedValue.ToEntero(), 8) DrCheque("Observaciones") = "" DrCheque("Tipo") = "Transferencia" DrCheque("CveMetodoPago") = 3 @@ -17832,7 +17825,7 @@ Partial Class Ventas 'Otro Metodo de pago - Select Case DdlOtroFormaPago.SelectedValue.ToEntero + Select Case DdlOtroFormaPago.SelectedValue.ToEntero() Case -1 Exit Select Case 1 @@ -17844,12 +17837,12 @@ Partial Class Ventas DrCredito("CveCuenta") = DdlCuentaOtrosContado.SelectedValue DrCredito("Cuenta") = DdlCuentaOtrosContado.SelectedItem.Text DrCredito("Importe") = TxtImporteOtrosContado.Text - DrCredito("Folio") = CargaFolioContado(DdlCuentaOtrosContado.SelectedValue.ToEntero, 12) + DrCredito("Folio") = CargaFolioContado(DdlCuentaOtrosContado.SelectedValue.ToEntero(), 12) DrCredito("Observaciones") = "" DrCredito("Tipo") = "Tarjeta de Crédito" DrCredito("CveMetodoPago") = 4 - If UsuarioActual.Empresa.Funcionalidad(558).ToEntero = 1 Then - DrCredito("MesesSinIntereses") = DdlMesesSinIntereses2.SelectedValue.ToEntero + If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 Then + DrCredito("MesesSinIntereses") = DdlMesesSinIntereses2.SelectedValue.ToEntero() Else DrCredito("MesesSinIntereses") = -1 End If @@ -17871,7 +17864,7 @@ Partial Class Ventas DrDebito("CveCuenta") = DdlCuentaOtrosContado.SelectedValue DrDebito("Cuenta") = DdlCuentaOtrosContado.SelectedItem.Text DrDebito("Importe") = TxtImporteOtrosContado.Text - DrDebito("Folio") = CargaFolioContado(DdlCuentaOtrosContado.SelectedValue.ToEntero, 11) + DrDebito("Folio") = CargaFolioContado(DdlCuentaOtrosContado.SelectedValue.ToEntero(), 11) DrDebito("Observaciones") = "" DrDebito("Tipo") = "Tarjeta de Débito" DrDebito("CveMetodoPago") = 5 @@ -17892,7 +17885,7 @@ Partial Class Ventas DrCheque("CveCuenta") = DdlCuentaOtrosContado.SelectedValue DrCheque("Cuenta") = DdlCuentaOtrosContado.SelectedItem.Text DrCheque("Importe") = TxtImporteOtrosContado.Text - DrCheque("Folio") = CargaFolioContado(DdlCuentaOtrosContado.SelectedValue.ToEntero, 3) + DrCheque("Folio") = CargaFolioContado(DdlCuentaOtrosContado.SelectedValue.ToEntero(), 3) DrCheque("Observaciones") = "" DrCheque("Tipo") = "Cheque" DrCheque("CveMetodoPago") = 2 @@ -17909,7 +17902,7 @@ Partial Class Ventas 'JJMQ 20160506: Validacion para no pagar de mas a peticion de I.P. abonado = DtPagos.SUM("Importe") saldo = TxtTotal.Text.Replace(",", "").ToDouble - abonado - 'CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString + 'CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString() CargaGridContado() UpContado.Update() @@ -17966,18 +17959,18 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, LblTotalNC.Text.Trim().ToDecimal(), 0) If TotalNC > 0 Then - If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TotalNC Then + If (DtPagos.SUM("Importe").ToString().ToDecimal + Total - TxtCambio.Text.ToDecimal) > TotalNC Then Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) Retorno = True End If Else - If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then + If (DtPagos.SUM("Importe").ToString().ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) Retorno = True End If End If Else - If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then + If (DtPagos.SUM("Importe").ToString().ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) Retorno = True End If @@ -17997,12 +17990,12 @@ Partial Class Ventas Dim Index = 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("SerieLote = '{0}'", Row.FCTextBox("TxtSerie").Text.ToString)) + Dim Existencia = ObjInventarios.GetExistenciasPSSerie(Row.FCTextBox("TxtSerie").Text.ToString(), ddlAlmacen.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) + Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", Row.FCTextBox("TxtSerie").Text.ToString())) 'Valida Existencia If Existencia - ExistenciaActual <= 0 Then - Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", Row.FCTextBox("TxtSerie").Text.ToString), TipoMensaje.MsgAdvertencia) + Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", Row.FCTextBox("TxtSerie").Text.ToString()), TipoMensaje.MsgAdvertencia) Row.FCTextBox("TxtSerie").Text = "" Row.FCHiddenField("HdnSerie").Value = "" TmpDT.Rows(Index)("SerieLote") = "" @@ -18034,12 +18027,12 @@ Partial Class Ventas 'SIN EXISTENCIA 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)) + Existencia = ObjInventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, ddlAlmacen.SelectedValue.ToEntero(), SerieLote:=Gvr.FCTextBox("TxtSerie").Text.ToString(), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) + ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim)) 'Valida Existencia If Existencia - ExistenciaActual < 0 Then - Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", Gvr.FCTextBox("TxtSerie").Text.ToString), TipoMensaje.MsgAdvertencia) + Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", Gvr.FCTextBox("TxtSerie").Text.ToString()), TipoMensaje.MsgAdvertencia) Gvr.FCTextBox("TxtSerie").Text = "" Retorno = True Exit For @@ -18057,9 +18050,9 @@ Partial Class Ventas #Region " BUSCAR CLIENTE " Protected Sub BtnBuscarCliente_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnBuscarCliente.Click - ViewState("CveCliente") = HdnCveCliente.Value.ToEntero - CargaCliente(HdnCveCliente.Value.ToEntero) - If DdlPS.SelectedValue IsNot Nothing AndAlso DdlPS.SelectedValue.ToEntero > 0 Then + ViewState("CveCliente") = HdnCveCliente.Value.ToEntero() + CargaCliente(HdnCveCliente.Value.ToEntero()) + If DdlPS.SelectedValue IsNot Nothing AndAlso DdlPS.SelectedValue.ToEntero() > 0 Then DdlPS_SelectedIndexChanged(sender, e) DdlPS.Focus() Else @@ -18116,8 +18109,8 @@ Partial Class Ventas If ObjCliente.ValidaClienteRFC(TxtRFCCliente.Text, UsuarioActual.CveEmpresa) Then If ObjCliente.DtResultados.Rows.Count > 0 Then RegistraScript("hideDivEC();") - ViewState("CveCliente") = ObjCliente.DtResultados(0)("CveCliente").ToString.ToEntero - HdnCveCliente.Value = ObjCliente.DtResultados(0)("CveCliente").ToString + ViewState("CveCliente") = ObjCliente.DtResultados(0)("CveCliente").ToString().ToEntero() + HdnCveCliente.Value = ObjCliente.DtResultados(0)("CveCliente").ToString() CargaCliente(CveCliente) UpCliente.Update() Else @@ -18151,11 +18144,11 @@ Partial Class Ventas Private Sub BtnAgregarCliente_Click(sender As Object, e As EventArgs) Handles BtnAgregarCliente.Click Dim CvePrecioLista As Integer = -1 - If DdlSubProyectoDatos.SelectedValue.ToEntero > 0 Then - Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows(0) + If DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then + Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa).Rows(0) If Dr IsNot Nothing Then - If Dr("CvePrecioLista").ToString.ToEntero > 0 Then - CvePrecioLista = Dr("CvePrecioLista").ToString.ToEntero + If Dr("CvePrecioLista").ToString().ToEntero() > 0 Then + CvePrecioLista = Dr("CvePrecioLista").ToString().ToEntero() End If End If End If @@ -18165,11 +18158,11 @@ Partial Class Ventas If ObjCliente.AgregarClienteNoFrecuente(TxtNombreCliente.Text.Trim, TxtDireccionCliente.Text.Trim, TxtNumExtCliente.Text.Trim, TxtNumIntCliente.Text.Trim, TxtColoniaCliente.Text.Trim, TxtLocalidadCliente.Text.Trim, TxtCiudadCliente.Text.Trim, TxtEstadoCliente.Text.Trim, TxtPaisCliente.Text.Trim, TxtRFCCliente.Text.Trim, TxtCPCliente.Text.Trim, TxtTelefonoCliente.Text.Trim, TxtCorreoCliente.Text.Trim, - DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, CvePrecioLista:=CvePrecioLista) Then + DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, CvePrecioLista:=CvePrecioLista) Then If ObjCliente.DtResultados.Rows.Count > 0 Then RegistraScript("hideDivEC();") - ViewState("CveCliente") = ObjCliente.DtResultados(0)("CveCliente").ToString.ToEntero - HdnCveCliente.Value = ObjCliente.DtResultados(0)("CveCliente").ToString + ViewState("CveCliente") = ObjCliente.DtResultados(0)("CveCliente").ToString().ToEntero() + HdnCveCliente.Value = ObjCliente.DtResultados(0)("CveCliente").ToString() CargaCliente(CveCliente) UpCliente.Update() End If @@ -18233,13 +18226,13 @@ Partial Class Ventas DtTemporal.Columns.Add("Lote", Type.GetType("System.String")) End If - If Not DtTemporal.Columns.Contains("FechaCaducidad") Then - DtTemporal.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime")) + If Not DtTemporal.Columns.Contains("Batch") Then + DtTemporal.Columns.Add("Batch", Type.GetType("System.String")) End If GvInv.Columns(4).Visible = DtTemporal.MAX("SerieLote", "SerieLote <> ''") <> "" Or CveVenta <= 0 GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> "" - GvInv.Columns(6).Visible = DtTemporal.MAX("FechaCaducidad", "FechaCaducidad <> ''") <> "" + GvInv.Columns(6).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> "" GvInv.DataSource = DtTemporal GvInv.DataBind() @@ -18250,7 +18243,7 @@ Partial Class Ventas #Region "IMPUESTOS LOCALES" Private Sub GvImpuestosLocales2_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvImpuestosLocales2.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - 'e.Row.FCTextBox("TxtImpuestoLocalPS").Text = (TxtSubTotal.Text.ToDouble - (TxtSubTotal.Text.ToDouble * (e.Row.DBCampo("Porcentaje").ToString.ToDouble) / 100)).ToString + 'e.Row.FCTextBox("TxtImpuestoLocalPS").Text = (TxtSubTotal.Text.ToDouble - (TxtSubTotal.Text.ToDouble * (e.Row.DBCampo("Porcentaje").ToString().ToDouble) / 100)).ToString() e.Row.FCTextBox("TxtImpuestoLocalPS").Attributes.Add("onKeyUp", String.Format("FnSuma();")) End If @@ -18318,7 +18311,7 @@ Partial Class Ventas If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then If ObjVentas.DtResultados.Rows.Count > 0 Then Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0) - Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString.ToEntero + Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero() End If End If @@ -18382,7 +18375,7 @@ Partial Class Ventas Dim TieneError = False Dim CveDireccionEnvio As Integer - CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(CveCliente, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtCiudad.Text.Trim, TxtEstado.Text.Trim, TxtCP.Text.ToEntero, TxtContacto.Text.Trim, UsuarioActual.CveUsuario, 1, CveClienteSucursal:=CveClienteSucursal, EnvioDepartamento:=If(TxtDepartamento.Text.Trim = "", "-1", TxtDepartamento.Text.Trim)) + CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(CveCliente, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtCiudad.Text.Trim, TxtEstado.Text.Trim, TxtCP.Text.ToEntero(), TxtContacto.Text.Trim, UsuarioActual.CveUsuario, 1, CveClienteSucursal:=CveClienteSucursal, EnvioDepartamento:=If(TxtDepartamento.Text.Trim = "", "-1", TxtDepartamento.Text.Trim)) If CveDireccionEnvio < 0 Then TieneError = True @@ -18422,7 +18415,7 @@ Partial Class Ventas Private Sub CargaFacturaOC() - CveOC = IfNull(Request("CveOC"), -1).ToString.ToEntero + CveOC = IfNull(Request("CveOC"), -1).ToString().ToEntero() If CveOC > 0 Then Dim tDT As DataTable = Nothing @@ -18442,22 +18435,22 @@ Partial Class Ventas ViewState("CveCliente") = ObjOC.DtResultados.Rows(0)("CveCliente") - HdnCveCliente.Value = CveCliente.ToString + HdnCveCliente.Value = CveCliente.ToString() CargaCliente(CveCliente) For Each Dr As DataRow In tDT.Rows - AgregarProductoServicio(Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("UM").ToString, Dr("CveClasificacion").ToString.ToEntero, Dr("Clasificacion").ToString, - Dr("CvePS").ToString.ToEntero, Dr("PS").ToString, Dr("Obs").ToString, Dr("PU").ToString.ToDecimal, Dr("Descuento").ToString.ToDecimal, - Dr("CveProyecto").ToString.ToEntero, Dr("Proyecto").ToString, Dr("CveSubProyecto").ToString.ToEntero, Dr("SubProyecto").ToString, - CveContratoDetalle:=Dr("CveContratoDetalle").ToString.ToEntero, CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) + AgregarProductoServicio(Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(), + Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal, + Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(), + CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero(), CveOrdenCompraDetalle:=Dr("CveOrdenCompraDetalle").ToString().ToEntero()) Next 'GvPS.DataSource = TmpDT 'GvPS.DataBind() 'TxtSubTotal.Text = TmpDT.SUM("Total").FormatoNumero(2) - 'TxtIVA.Text = (TxtSubTotal.Text.ToDecimal * ViewState("IVA").ToString.ToDecimal).ToString + 'TxtIVA.Text = (TxtSubTotal.Text.ToDecimal * ViewState("IVA").ToString().ToDecimal).ToString() 'CalculaTotalesImpuestosLocales() 'CalculaTotales(False) UpPS.Update() @@ -18496,7 +18489,7 @@ Partial Class Ventas Dim RFC As String = "" Dim XMLDoc As New XmlDocument - Dim Archivo As String = String.Format("{0}Empresas\{1}\Ventas\{2}\{3}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, Request("RFC"), $"{Request("CveFactura")}.xml") + Dim Archivo As String = String.Format("{0}Empresas\{1}\Ventas\{2}\{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, Request("RFC"), $"{Request("CveFactura")}.xml") If IO.File.Exists(Archivo) Then Dim Validada As Boolean = True @@ -18523,7 +18516,7 @@ Partial Class Ventas RFC = ReceptorRFC TxtFecha.Text = Fecha - TxtFolio.Text = FolioXML.ToString + TxtFolio.Text = FolioXML.ToString() If (FolioXML <> "") Then ViewState("ExFolioFactura") = True End If @@ -18690,29 +18683,29 @@ Partial Class Ventas 'BUSCA UM EN CATALOGO UMM = UMM.ToUpper.Replace(".", "").Replace(",", "") Dim fUM = (From u In DtUM - Where String.Compare(u!UnidadMedida.ToString.ToUpper.Trim, UMM, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 OrElse - String.Compare(u!Abreviatura.ToString.ToUpper.Trim, UMM, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 + Where String.Compare(u!UnidadMedida.ToString().ToUpper.Trim, UMM, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 OrElse + String.Compare(u!Abreviatura.ToString().ToUpper.Trim, UMM, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 Select CveUnidadMedida = u!CveUnidadMedida, UnidadMedida = u!UnidadMedida).FirstOrDefault() - If fUM IsNot Nothing AndAlso fUM.CveUnidadMedida.ToString.ToEntero > 0 Then - CveUM = fUM.CveUnidadMedida.ToString.ToEntero - UMM = fUM.UnidadMedida.ToString + If fUM IsNot Nothing AndAlso fUM.CveUnidadMedida.ToString().ToEntero() > 0 Then + CveUM = fUM.CveUnidadMedida.ToString().ToEntero() + UMM = fUM.UnidadMedida.ToString() Else 'BUSCA UM EN ALIAS Dim fUMAlias = (From u In DtUMAlias - Where String.Compare(u!UnidadMedidaAlias.ToString.ToUpper.Trim, UMM, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 + Where String.Compare(u!UnidadMedidaAlias.ToString().ToUpper.Trim, UMM, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 Select u!CveUnidadMedida, u!UnidadMedida).FirstOrDefault() If fUMAlias IsNot Nothing Then - CveUM = fUMAlias.CveUnidadMedida.ToString.ToEntero - UMM = fUMAlias.UnidadMedida.ToString + CveUM = fUMAlias.CveUnidadMedida.ToString().ToEntero() + UMM = fUMAlias.UnidadMedida.ToString() End If End If 'se le puso una condicion de que ignorara los acentos, porque en la bd, marcaria error porque no distingue acentos 'CONCEPTO PRUEBA "TRABAJOS DE CONSTRUCCION", RM/Compras/Compras.aspx?CveFactura=13402&RFC=ECO061206QW7 - '' u!PS.ToString.ToUpper.Trim = PSS + '' u!PS.ToString().ToUpper.Trim = PSS 'BUSCA PS @@ -18725,29 +18718,29 @@ Partial Class Ventas 'BUSCA PS EN CATALOGO Dim fPS = (From u In DtPS - Where String.Compare(u!PS.ToString.ToUpper.Trim, PSS, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 + Where String.Compare(u!PS.ToString().ToUpper.Trim, PSS, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 Select u!CvePS, u!CveClasificacion, u!Clasificacion, u!CveTipoPS, u!PSCodigo).FirstOrDefault() If fPS IsNot Nothing Then - PSS = fPS.PSCodigo.ToString - tCvePS = fPS.CvePS.ToString.ToEntero - TipoPS = fPS.CveTipoPS.ToString.ToEntero - tCveClasif = fPS.CveClasificacion.ToString.ToEntero - Clasif = fPS.Clasificacion.ToString - tPSCodigo = fPS.PSCodigo.ToString + PSS = fPS.PSCodigo.ToString() + tCvePS = fPS.CvePS.ToString().ToEntero() + TipoPS = fPS.CveTipoPS.ToString().ToEntero() + tCveClasif = fPS.CveClasificacion.ToString().ToEntero() + Clasif = fPS.Clasificacion.ToString() + tPSCodigo = fPS.PSCodigo.ToString() Else 'BUSCA PS EN ALIAS Dim fPSAlias = (From u In DtPSAlias - Where String.Compare(u!PSAlias.ToString.ToUpper.Trim, PSS, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 + Where String.Compare(u!PSAlias.ToString().ToUpper.Trim, PSS, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 Select u!CvePS, u!PS, u!CveClasificacion, u!Clasificacion, u!CveTipoPS, u!PSCodigo).FirstOrDefault() If fPSAlias IsNot Nothing Then Obs = PSS - PSS = fPSAlias.PS.ToString - tCvePS = fPSAlias.CvePS.ToString.ToEntero - TipoPS = fPSAlias.CveTipoPS.ToString.ToEntero - tCveClasif = fPSAlias.CveClasificacion.ToString.ToEntero - Clasif = fPSAlias.Clasificacion.ToString - tPSCodigo = fPSAlias.PSCodigo.ToString + PSS = fPSAlias.PS.ToString() + tCvePS = fPSAlias.CvePS.ToString().ToEntero() + TipoPS = fPSAlias.CveTipoPS.ToString().ToEntero() + tCveClasif = fPSAlias.CveClasificacion.ToString().ToEntero() + Clasif = fPSAlias.Clasificacion.ToString() + tPSCodigo = fPSAlias.PSCodigo.ToString() Else tCvePS = 20168 End If @@ -18994,11 +18987,11 @@ Partial Class Ventas Protected Sub OrdenarGvPS(ByVal sender As Object, ByVal e As EventArgs) For Each row As GridViewRow In GvPS.Rows - TmpDT.Rows(row.RowIndex)("Orden") = row.FCTextBox("TxtOrden").Text.ToEntero + TmpDT.Rows(row.RowIndex)("Orden") = row.FCTextBox("TxtOrden").Text.ToEntero() Next Dim resultados = From OrdenDT In TmpDT - Order By OrdenDT("Orden").ToString.ToEntero + Order By OrdenDT("Orden").ToString().ToEntero() Select OrdenDT TmpDT = resultados.CopyToDataTable CalculaTotalesVenta() @@ -19023,13 +19016,13 @@ Partial Class Ventas Dim ObjVentas As New ClsVentas If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) - Dim FolioFiscal = drv("FolioFiscal").ToString - Dim SelloCancelacion = drv("SelloCancelacion").ToString - Dim FechaCancelacion = drv("FechaCancelacion").ToString.ToDateTime.ToString("dd/MM/yyyy HH:mm:ss") + Dim FolioFiscal = drv("FolioFiscal").ToString() + Dim SelloCancelacion = drv("SelloCancelacion").ToString() + Dim FechaCancelacion = drv("FechaCancelacion").ToString().ToDateTime.ToString("dd/MM/yyyy HH:mm:ss") Dim RFC = UsuarioActual.Empresa.RFC Dim Archivo As New System.IO.FileInfo("Empresas\Grales\Formatos\AcuseCancelacion.rdlc") Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("FechaCancelacion", FechaCancelacion.ToString)) + params.Add(New ReportParameter("FechaCancelacion", FechaCancelacion.ToString())) params.Add(New ReportParameter("FolioFiscal", FolioFiscal)) params.Add(New ReportParameter("RFCEmisor", RFC)) params.Add(New ReportParameter("SelloCancelacion", SelloCancelacion)) @@ -19084,7 +19077,7 @@ Partial Class Ventas sb.Append("") End If Asunto = $"Acuse de Cancelacion {Serie}-{Folio}" - Cuerpo = sb.ToString + Cuerpo = sb.ToString() Dim DisplayName As String = "" If UsuarioActual.CveEmpresa = 119 Then DisplayName = "Facturación Agroquímicos JAM" LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ObjetoPDF, .NombreArchivo = $"AcuseCancelacion{Serie}-{Folio}.pdf"}) @@ -19272,7 +19265,7 @@ Partial Class Ventas ' MensajeAlert.Append("El Documento se canceló correctamente.") ' MensajeAlert.Append($"
    Imprimir Acuse") ' MensajeAlert.Append("

    ¿Desea enviar el Acuse de Cancelación al Cliente?") - ' Alert(MensajeAlert.ToString, TipoMensaje.MsgConfirmacion, "BtnEnviarMailCancelacion()", TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") + ' Alert(MensajeAlert.ToString(), TipoMensaje.MsgConfirmacion, "BtnEnviarMailCancelacion()", TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") ' Else ' Alert("El documento se canceló exitosamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:="location.reload();") ' End If @@ -19318,7 +19311,7 @@ Partial Class Ventas If ChkCanRem.Checked Then For Each Gvr As GridViewRow In GvCancelarRemisiones.Rows If Gvr.FCCheckBox("ChkCancelarRemision").Checked Then - ListaRemisionesCancelar.Add(Gvr.DataKey("CveVenta").ToEntero) + ListaRemisionesCancelar.Add(Gvr.DataKey("CveVenta").ToEntero()) End If Next End If @@ -19389,12 +19382,12 @@ Partial Class Ventas 'Cargamos los datos del Cliente DtContratos = ObjContratos.DtResultados - If ObjContratos.DtResultados(0)("IVA").ToString.ToDecimal > 0 Then - ViewState("IVA") = ObjContratos.DtResultados(0)("IVA").ToString.ToDecimal + If ObjContratos.DtResultados(0)("IVA").ToString().ToDecimal > 0 Then + ViewState("IVA") = ObjContratos.DtResultados(0)("IVA").ToString().ToDecimal End If - ViewState("CveCliente") = ObjContratos.DtResultados(0)("CveCliente").ToString.ToEntero - ViewState("CveContrato") = ObjContratos.DtResultados(0)("CveContrato").ToString.ToEntero - HdnCveCliente.Value = ObjContratos.DtResultados(0)("CveCliente").ToString + ViewState("CveCliente") = ObjContratos.DtResultados(0)("CveCliente").ToString().ToEntero() + ViewState("CveContrato") = ObjContratos.DtResultados(0)("CveContrato").ToString().ToEntero() + HdnCveCliente.Value = ObjContratos.DtResultados(0)("CveCliente").ToString() CargaCliente(CveCliente) DdlTipoComprobante.Items.Insert(0, New ListItem("Ingresos", "Ing")) DdlTipoComprobante.SelectedValue = "Ing" @@ -19402,9 +19395,9 @@ Partial Class Ventas DdlAlmacenAsignado.Enabled = False 'CARGO DATOS DE PS/CONTRATO - SubProyecto = ObjContratos.DtResultados(0)("SubProyectoContrato").ToString - CveSubProyecto = ObjContratos.DtResultados(0)("CveSubProyecto").ToString.ToEntero - Proyecto = ObjContratos.DtResultados(0)("ProyectoContrato").ToString + SubProyecto = ObjContratos.DtResultados(0)("SubProyectoContrato").ToString() + CveSubProyecto = ObjContratos.DtResultados(0)("CveSubProyecto").ToString().ToEntero() + Proyecto = ObjContratos.DtResultados(0)("ProyectoContrato").ToString() DdlSubProyectoDatos.SelectedValueExist(CveSubProyecto) ContratoDetalles.Visible = True DivEstimaciones.Visible = False @@ -19419,13 +19412,13 @@ Partial Class Ventas Updatetabs.Update() DdlContratosModal.DataSource = ObjContratos.DtResultados - DdlContratosModal.SelectedValue = ObjContratos.DtResultados(0)("CveContrato").ToString + DdlContratosModal.SelectedValue = ObjContratos.DtResultados(0)("CveContrato").ToString() DdlContratosModal_SelectedIndexChanged(Nothing, Nothing) GvContratoDetalles.HeaderRow.Cells(1).Style.Add("display", "none") BtnCargarContratoDetalles_Click(Nothing, Nothing) LbAgregar.Visible = True UpPS.Update() - 'AplicaGastoContrato = If(ObjContratos.DtResultados(0)("CveContratoTipo").ToString.Contiene("9", "10", "13"), True, False) 'Arrendamiento, Servicios De Impresion, Financiamiento + 'AplicaGastoContrato = If(ObjContratos.DtResultados(0)("CveContratoTipo").ToString().Contiene("9", "10", "13"), True, False) 'Arrendamiento, Servicios De Impresion, Financiamiento Else Alert("Ocurrió un error al carga la información del contrato. Por favor vuelva a intentar.", TipoMensaje.MsgError) huboerror = True @@ -19440,7 +19433,7 @@ Partial Class Ventas #Region "DESCARGAR E IMPRIMIR LISTADO" Public Sub DescargarFormato() - Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\Formatos\FormatoVentas.xlsx" + Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\Formatos\FormatoVentas.xlsx" Dim Archivo As New IO.FileInfo(Directorio) If Archivo.Exists Then @@ -19530,15 +19523,15 @@ Partial Class Ventas Dim RowNoEncontrados As String = "" Dim NumAgregados As Integer = 0 For Each Row As DataRow In dt.Rows - Dim Cantidad As Decimal = Row("Cantidad").ToString.ToDecimal - Dim UM As String = Row("UM").ToString - Dim Codigo As String = Row("Código").ToString.Trim.ToUpper - Dim CodigoBarras As String = Row("Codigo Barras").ToString.Trim.ToUpper - Dim ProductoServicio As String = Row("Producto/Servicio").ToString.Trim.ToUpper - Dim PrecioUnitario As Decimal = Row("Precio Unitario").ToString.ToDecimal - Dim Proyecto As String = Row("Proyecto").ToString.Trim.ToUpper - Dim Observaciones As String = Row("Observaciones").ToString.Trim.ToUpper - Dim TiempoEntrega As String = Row("Tiempo Entrega").ToString + Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal + Dim UM As String = Row("UM").ToString() + Dim Codigo As String = Row("Código").ToString().Trim.ToUpper + Dim CodigoBarras As String = Row("Codigo Barras").ToString().Trim.ToUpper + Dim ProductoServicio As String = Row("Producto/Servicio").ToString().Trim.ToUpper + Dim PrecioUnitario As Decimal = Row("Precio Unitario").ToString().ToDecimal + Dim Proyecto As String = Row("Proyecto").ToString().Trim.ToUpper + Dim Observaciones As String = Row("Observaciones").ToString().Trim.ToUpper + Dim TiempoEntrega As String = Row("Tiempo Entrega").ToString() Dim CvePS As Integer = 0 Dim CveUM As Integer = 0 Dim CodigoPS As Integer = 0 @@ -19551,9 +19544,9 @@ Partial Class Ventas If Proyecto <> "" Then DrProyecto = DtSubProyecto.FiltroPrimero($"(SubProyecto) = '{Proyecto}'") If DrProyecto IsNot Nothing Then - CveSubProyecto = DrProyecto("CveSubProyecto").ToString.ToEntero - CveProyecto = DrProyecto("CveProyecto").ToString.ToEntero - SubProyecto = DrProyecto("SubProyecto").ToString + CveSubProyecto = DrProyecto("CveSubProyecto").ToString().ToEntero() + CveProyecto = DrProyecto("CveProyecto").ToString().ToEntero() + SubProyecto = DrProyecto("SubProyecto").ToString() End If Else CveProyecto = -1 @@ -19579,7 +19572,7 @@ Partial Class Ventas 'Dim StrArray() As String = GetPS("Codigo", Codigo).Split("|"c) 'If StrArray.Length > 0 Then ' If CBool(StrArray(0)) = True Then - ' CvePS = StrArray(1).ToEntero + ' CvePS = StrArray(1).ToEntero() ' Else ' RowNoEncontrados &= StrArray(1) & "<\BR>" ' End If @@ -19602,7 +19595,7 @@ Partial Class Ventas 'Dim StrArray() As String = GetPS("CodigoBarras", CodigoBarras).Split("|"c) 'If StrArray.Length > 0 Then ' If CBool(StrArray(0)) = True Then - ' CvePS = StrArray(1).ToEntero + ' CvePS = StrArray(1).ToEntero() ' Else ' RowNoEncontrados &= StrArray(1) & "<\BR>" ' End If @@ -19624,7 +19617,7 @@ Partial Class Ventas 'Dim StrArray() As String = GetPS("PS", ProductoServicio).Split("|"c) 'If StrArray.Length > 0 Then ' If CBool(StrArray(0)) = True Then - ' CvePS = StrArray(1).ToEntero + ' CvePS = StrArray(1).ToEntero() ' Else ' RowNoEncontrados &= StrArray(1) & "<\BR>" ' End If @@ -19634,7 +19627,7 @@ Partial Class Ventas End If If CvePS > 0 Then - 'CveUM = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"CvePS = '{CvePS}'").ToString.ToEntero + 'CveUM = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"CvePS = '{CvePS}'").ToString().ToEntero() AgregarProductoServicio(Cantidad, CveUM, UM, -1, "", CvePS, HdnPS.Value, Observaciones, PrecioUnitario, HdnDescuento.Value.ToDecimal, @@ -19644,16 +19637,16 @@ Partial Class Ventas 'If TmpDT IsNot Nothing Then ' Dim dr As DataRow = TmpDT.NewRow - ' TxtCantidad.Text = Cantidad.ToString - ' DdlPS.SelectedValue = CvePS.ToString + ' TxtCantidad.Text = Cantidad.ToString() + ' DdlPS.SelectedValue = CvePS.ToString() ' DdlPS_SelectedIndexChanged(Nothing, Nothing) - ' DdlUnidadMedida.SelectedValueExist(CveUM.ToString) + ' DdlUnidadMedida.SelectedValueExist(CveUM.ToString()) ' TxtObsPS.Text = Observaciones - ' DdlProyecto.SelectedValue = CveProyecto.ToString + ' DdlProyecto.SelectedValue = CveProyecto.ToString() ' DdlProyecto_SelectedIndexChanged(Nothing, Nothing) - ' DdlSubProyecto.SelectedValue = CveSubProyecto.ToString - ' TxtPrecio.Text = PrecioUnitario.ToString - ' TxtTiempoEntrega.Text = TiempoEntrega.ToString + ' DdlSubProyecto.SelectedValue = CveSubProyecto.ToString() + ' TxtPrecio.Text = PrecioUnitario.ToString() + ' TxtTiempoEntrega.Text = TiempoEntrega.ToString() ' RegistraScript("Recalcula();") ' LbAgregar_Click(Nothing, Nothing) ' NumAgregados = NumAgregados + 1 @@ -19679,7 +19672,7 @@ Partial Class Ventas Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click If TxtExcel.getfiles().Archivos.Count > 0 Then Dim file As Archivo = TxtExcel.getfiles().Archivos(0) - Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch + Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") CargarArchivo(Directorio, file.filename, Tipo) Else @@ -19695,7 +19688,7 @@ Partial Class Ventas ' If dtps Is Nothing Then dtps = GlobalDTPS(UsuarioActual.CveEmpresa) ' CvePS = dtps.FiltroPrimeroValor("CvePS", Opt & " = '" & Valor & "'").ToString().ToEntero() ' If CvePS > 0 Then - ' StrReturn = "True|" & CvePS.ToString + ' StrReturn = "True|" & CvePS.ToString() ' Else ' StrReturn = "False|    - No se encontró " & Valor & " en la fila " & NumRow & ", columna " & Opt ' End If @@ -19708,7 +19701,7 @@ Partial Class Ventas Dim ObjContratos As New ClsContratos If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then If ObjContratos.DtResultados IsNot Nothing AndAlso ObjContratos.DtResultados.Rows.Count > 0 Then - CorreoNotificacionPedDev = ObjContratos.DtResultados(0)("CorreoNotificacionPedDev").ToString + CorreoNotificacionPedDev = ObjContratos.DtResultados(0)("CorreoNotificacionPedDev").ToString() End If End If ObjContratos.Dispose() @@ -19820,7 +19813,7 @@ Partial Class Ventas strBody.Append("") - Return strBody.ToString + Return strBody.ToString() End Function #End Region @@ -19848,7 +19841,7 @@ Partial Class Ventas #Region "D E V O L U C I O N D E P E D I D O " Private Sub CargaFacturaDevolucionPedido() Dim CveVenta As Integer = Me.CveVenta - Dim MovInv As Integer = ViewState("MovInv").ToString.ToEntero + Dim MovInv As Integer = ViewState("MovInv").ToString().ToEntero() Dim ObjVentas As New ClsVentas() Dim ObjInventarios As New ClsInventarios @@ -19858,44 +19851,44 @@ Partial Class Ventas Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0) 'CargaCliente - Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString.ToEntero + Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString().ToEntero() If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then Exit Sub ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then Exit Sub End If - HdnCveCliente.Value = CveCliente.ToString + HdnCveCliente.Value = CveCliente.ToString() ViewState("CveCliente") = CveCliente CargaCliente(CveCliente, -1) 'Estatus activo, se requiere para cargar una factura en la que el cliente a sido eliminado TxtFecha.Text = Now.ToShortDateString - 'TxtSubTotal.Text = DbRowVenta("SubTotal").ToString.FormatoNumero(2) - 'LblDescuentos.Text = DbRowVenta("Descuento").ToString.FormatoNumero(2) - 'LblAmortizacion.Text = DbRowVenta("Amortizacion").ToString.FormatoNumero(2) + 'TxtSubTotal.Text = DbRowVenta("SubTotal").ToString().FormatoNumero(2) + 'LblDescuentos.Text = DbRowVenta("Descuento").ToString().FormatoNumero(2) + 'LblAmortizacion.Text = DbRowVenta("Amortizacion").ToString().FormatoNumero(2) 'TxtSubTotal2.Text = (TxtSubTotal.Text.Replace(",", "").Trim.Trim.ToDouble - LblDescuentos.Text.Replace(",", "").Trim.Trim.ToDouble - LblAmortizacion.Text.Replace(",", "").Trim.Trim.ToDouble).FormatoNumero(2) - 'TxtIVA.Text = DbRowVenta("IVA").ToString.FormatoNumero(2) - 'TxtRetIVA.Text = DbRowVenta("RetIVA").ToString.FormatoNumero(2) - 'TxtRetISR.Text = DbRowVenta("RetISR").ToString.FormatoNumero(2) - 'TxtIEPS.Text = DbRowVenta("IEPS").ToString.FormatoNumero(2) - CveContrato = DbRowVenta("CveContrato").ToString.ToEntero - TxtMotivoDescuento.Text = DbRowVenta("MotivoDescuento").ToString - TxtObsFact.Text = DbRowVenta("Observaciones").ToString + 'TxtIVA.Text = DbRowVenta("IVA").ToString().FormatoNumero(2) + 'TxtRetIVA.Text = DbRowVenta("RetIVA").ToString().FormatoNumero(2) + 'TxtRetISR.Text = DbRowVenta("RetISR").ToString().FormatoNumero(2) + 'TxtIEPS.Text = DbRowVenta("IEPS").ToString().FormatoNumero(2) + CveContrato = DbRowVenta("CveContrato").ToString().ToEntero() + TxtMotivoDescuento.Text = DbRowVenta("MotivoDescuento").ToString() + TxtObsFact.Text = DbRowVenta("Observaciones").ToString() HdnIVAOriginal.Value = TxtIVA.Text - TxtPedidoContrato.Text = DbRowVenta("PedidoContrato").ToString + TxtPedidoContrato.Text = DbRowVenta("PedidoContrato").ToString() TxtPedidoContrato.Enabled = False - TxtOrdenCompra.Text = DbRowVenta("OrdenCompra").ToString + TxtOrdenCompra.Text = DbRowVenta("OrdenCompra").ToString() TxtOrdenCompra.Enabled = False - TxtObsAlmacen.Text = DbRowVenta("ObservacionesAlmacen").ToString - TxtFechaEjecucion.Text = DbRowVenta("FechaEjecucion").ToString.ToDateTime.ToString("dd/MM/yyyy") - 'DdlSucursalEjecucion.SelectedValueExist(DbRowVenta("CveSucursalEjecucion").ToString) - 'DdlSucursalCobranza.SelectedValueExist(DbRowVenta("CveSucursalCobranza").ToString) - DdlSucursalCliente.SelectedValueExist(DbRowVenta("CveClienteSucursal").ToString) - 'DdlSucursal.SelectedValueExist(DbRowVenta("CveSucursal").ToString) - DdlSubProyectoDatos.SelectedValueExist(DbRowVenta("CveSubProyecto").ToString) - DdlSubProyectoCobranza.SelectedValueExist(DbRowVenta("CveSubProyectoCobranza").ToString) - DdlSubProyectoEjecucion.SelectedValueExist(DbRowVenta("CveSubProyectoEjecucion").ToString) - CargaClienteSucursal(DbRowVenta("CveClienteSucursal").ToString.ToEntero) + TxtObsAlmacen.Text = DbRowVenta("ObservacionesAlmacen").ToString() + TxtFechaEjecucion.Text = DbRowVenta("FechaEjecucion").ToString().ToDateTime.ToString("dd/MM/yyyy") + 'DdlSucursalEjecucion.SelectedValueExist(DbRowVenta("CveSucursalEjecucion").ToString()) + 'DdlSucursalCobranza.SelectedValueExist(DbRowVenta("CveSucursalCobranza").ToString()) + DdlSucursalCliente.SelectedValueExist(DbRowVenta("CveClienteSucursal").ToString()) + 'DdlSucursal.SelectedValueExist(DbRowVenta("CveSucursal").ToString()) + DdlSubProyectoDatos.SelectedValueExist(DbRowVenta("CveSubProyecto").ToString()) + DdlSubProyectoCobranza.SelectedValueExist(DbRowVenta("CveSubProyectoCobranza").ToString()) + DdlSubProyectoEjecucion.SelectedValueExist(DbRowVenta("CveSubProyectoEjecucion").ToString()) + CargaClienteSucursal(DbRowVenta("CveClienteSucursal").ToString().ToEntero()) DdlMetodoPago33.SelectedIndex = 1 DdlFormaPago33.SelectedIndex = 1 @@ -19906,16 +19899,16 @@ Partial Class Ventas DdlAlmacenAsignado.Items.Insert(0, New ListItem(" Seleccione ", "-1")) DdlAlmacenAsignado.SelectedValue = "-1" DdlAlmacenAsignado.DataBind() - DdlAlmacenAsignado.Items.Insert(0, New ListItem("Almacen", DbRowVenta("CveAlmacenTraspasoOrigen").ToString)) - DdlAlmacenAsignado.SelectedValueExist(DbRowVenta("CveAlmacenTraspasoOrigen").ToString) + DdlAlmacenAsignado.Items.Insert(0, New ListItem("Almacen", DbRowVenta("CveAlmacenTraspasoOrigen").ToString())) + DdlAlmacenAsignado.SelectedValueExist(DbRowVenta("CveAlmacenTraspasoOrigen").ToString()) RequiereAlmacenOrigen = True DdlAlmacenOrigen.Items.Clear() DdlAlmacenOrigen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) DdlAlmacenOrigen.SelectedValue = "-1" DdlAlmacenOrigen.DataBind() - DdlAlmacenOrigen.Items.Insert(0, New ListItem("Almacen", DbRowVenta("CveAlmacenTraspasoDestino").ToString)) - DdlAlmacenOrigen.SelectedValueExist(DbRowVenta("CveAlmacenTraspasoDestino").ToString) + DdlAlmacenOrigen.Items.Insert(0, New ListItem("Almacen", DbRowVenta("CveAlmacenTraspasoDestino").ToString())) + DdlAlmacenOrigen.SelectedValueExist(DbRowVenta("CveAlmacenTraspasoDestino").ToString()) If ObjInventarios.GetMovimientosDetalle(MovInv, UsuarioActual.CveEmpresa) AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then @@ -19924,14 +19917,14 @@ Partial Class Ventas Dim Cantidad = 0.0D, PU = 0.0D, Descuento = 0.0D Dim Filtro As String = "" - If ViewState("CveMovimientoDetalle").ToString.ToEntero > 0 Then - Filtro = $"AND CveMovimientoDetalle = {ViewState("CveMovimientoDetalle").ToString.ToEntero}" + If ViewState("CveMovimientoDetalle").ToString().ToEntero() > 0 Then + Filtro = $"AND CveMovimientoDetalle = {ViewState("CveMovimientoDetalle").ToString().ToEntero()}" End If For Each dr As DataRow In ObjInventarios.DtResultados.FiltraParametros($"ExistenciaPedido > 0 {Filtro}").Rows - AgregarProductoServicio(dr("Cantidad").ToString.ToDecimal, dr("CveUM").ToString.ToEntero, dr("UnidadMedida").ToString, dr("CveClasificacion").ToString.ToEntero, dr("Clasificacion").ToString, - dr("CvePS").ToString.ToEntero, dr("PS").ToString, dr("Serie").ToString, dr("PU").ToString.ToDecimal, 0.0D, - dr("CveProyecto").ToString.ToEntero, dr("Proyecto").ToString, dr("CveSubProyecto").ToString.ToEntero, dr("SubProyecto").ToString, - CveMovimientoDetallePedido:=dr("CveMovimientoDetalle").ToString.ToEntero) + AgregarProductoServicio(dr("Cantidad").ToString().ToDecimal, dr("CveUM").ToString().ToEntero(), dr("UnidadMedida").ToString(), dr("CveClasificacion").ToString().ToEntero(), dr("Clasificacion").ToString(), + dr("CvePS").ToString().ToEntero(), dr("PS").ToString(), dr("SerieLote").ToString(), dr("PU").ToString().ToDecimal, 0.0D, + dr("CveProyecto").ToString().ToEntero(), dr("Proyecto").ToString(), dr("CveSubProyecto").ToString().ToEntero(), dr("SubProyecto").ToString(), + CveMovimientoDetallePedido:=dr("CveMovimientoDetalle").ToString().ToEntero()) Next CalculaTotalesVenta() End If @@ -19942,7 +19935,7 @@ Partial Class Ventas GvPS.Columns(19).Visible = False GvPS.Columns(20).Visible = False - DdlVendedor.SelectedValue = DbRowVenta("CveVendedor").ToString + DdlVendedor.SelectedValue = DbRowVenta("CveVendedor").ToString() DdlTipoComprobante.Enabled = False 'DdlSucursal.Enabled = False DdlSubProyectoDatos.Enabled = False @@ -20126,19 +20119,19 @@ Partial Class Ventas If ChkRequiereSerie.Checked Then CveMetodoInventario = 5 Else CveMetodoInventario = 1 Dim CveMarca As Integer = 0 - If UsuarioActual.CveEmpresa.Contiene(72, 80) Then CveMarca = DdlMarcaPSDes.SelectedValue.ToEntero Else CveMarca = DdlMarca.SelectedValue.ToEntero + If UsuarioActual.CveEmpresa.Contiene(72, 80) Then CveMarca = DdlMarcaPSDes.SelectedValue.ToEntero() Else CveMarca = DdlMarca.SelectedValue.ToEntero() Dim ObjProductosServicios As New ClsProductosServicios() - If ObjProductosServicios.AddPS(DdlClasificacionPS.SelectedValue.ToEntero, -1, DdlUnidadMedidaPS.SelectedValue.ToEntero, TxtCodigoPS.Text.Trim, "", TxtCodigoBarrasPS.Text.Trim, TxtPS.Text.Trim, 0, -1, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveMetodoInventario, 0, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero, CveMarca:=CveMarca, CveSATPS:=DdlSATPS.SelectedValue.ToEntero, CveClasificacionDetalle:=DdlTipo.SelectedValue.ToEntero) > 0 Then - DdlClasificacion.SelectedValueExist(DdlClasificacionPS.SelectedValue.ToEntero) + If ObjProductosServicios.AddPS(DdlClasificacionPS.SelectedValue.ToEntero(), -1, DdlUnidadMedidaPS.SelectedValue.ToEntero(), TxtCodigoPS.Text.Trim, "", TxtCodigoBarrasPS.Text.Trim, TxtPS.Text.Trim, 0, -1, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveMetodoInventario, 0, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero(), CveMarca:=CveMarca, CveSATPS:=DdlSATPS.SelectedValue.ToEntero(), CveClasificacionDetalle:=DdlTipo.SelectedValue.ToEntero()) > 0 Then + DdlClasificacion.SelectedValueExist(DdlClasificacionPS.SelectedValue.ToEntero()) DdlClasificacion_SelectedIndexChanged(DdlClasificacionPS, e) 'SI ES DDLOST - If UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then - DdlPS.SelectedValue = ObjProductosServicios.CvePS.ToString + If UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1" Then + DdlPS.SelectedValue = ObjProductosServicios.CvePS.ToString() DdlPS.SelectedText = TxtPS.Text.Trim Else - DdlPS.ddl.Items.Insert(2, New ListItem(TxtPS.Text.Trim, ObjProductosServicios.CvePS.ToString)) + DdlPS.ddl.Items.Insert(2, New ListItem(TxtPS.Text.Trim, ObjProductosServicios.CvePS.ToString())) DdlPS.ddl.SelectedValueExist(ObjProductosServicios.CvePS) End If @@ -20149,7 +20142,7 @@ Partial Class Ventas HdnPS.Value = TxtPS.Text.Trim HdnCodigoPS.Value = $"{TxtCodigoPS.Text.Trim}-{TxtPS.Text.Trim}" HdnTipoPS.Value = DdlTipoPS.SelectedValue - HdnTipoInv.Value = CveMetodoInventario.ToString + HdnTipoInv.Value = CveMetodoInventario.ToString() HdnAplicaIEPS.Value = "False" HdnPorcentajeIEPS.Value = "-1" HdnIVAPS.Value = "0.16" @@ -20196,7 +20189,7 @@ Partial Class Ventas TxtPrecioPyME.Text = "0.00" TxtDescuentoPyME.Text = "0.00" LblTotalPyME.Text = "0.00" - If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then + If Not UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1" Then DdlPSPyME.SelectedValue = "-1" Else DdlPSPyME.SelectedValue = "" @@ -20216,12 +20209,12 @@ Partial Class Ventas Public Sub Edit_Click(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Modalidad = "U" - Index = GvRow.DataKey("Consec").ToEntero + Index = GvRow.DataKey("Consec").ToEntero() LnkAgregarPyME.Text = "Actualizar" DdlClasificacionPyME.SelectedValueExist(GvRow.DataKey("CveClasificacion")) - CargaPSPyME(DdlClasificacionPyME.SelectedValue.ToEntero, DdlPSPyME) + CargaPSPyME(DdlClasificacionPyME.SelectedValue.ToEntero(), DdlPSPyME) UpClasificacionPyME.Update() - If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then + If Not UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1" Then DdlPSPyME.SelectedValue = GvRow.DataKey("CvePS") Else DdlPSPyME.SelectedValue = GvRow.DataKey("CvePS") @@ -20252,7 +20245,7 @@ Partial Class Ventas TxtObsPyME.Text = "" TxtPrecioPyME.Text = "0.00" LblTotalPyME.Text = "0.00" - If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then + If Not UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1" Then DdlPSPyME.SelectedValue = "-1" Else DdlPSPyME.SelectedValue = "" @@ -20281,7 +20274,7 @@ Partial Class Ventas DdlPSPyME.setEsWebService(True) DdlPSPyME.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue) - DdlPSPyME.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString) + DdlPSPyME.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString()) DdlPSPyME.ddlWS.Attributes.Add("data-pagina", "ventas/ventas") DdlPSPyME.ddlWS.Attributes.Add("data-Estatus", "1") @@ -20289,35 +20282,35 @@ Partial Class Ventas Private Sub DdlPSPyMEIndexChange() If CveCliente > 0 OrElse DdlPSPyME.SelectedValue = "-2" Then - If DdlPSPyME.SelectedValue IsNot Nothing AndAlso DdlPSPyME.SelectedValue.ToEntero > 0 Then - Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPSPyME.SelectedValue.ToEntero).FiltroPrimero("") + If DdlPSPyME.SelectedValue IsNot Nothing AndAlso DdlPSPyME.SelectedValue.ToEntero() > 0 Then + Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPSPyME.SelectedValue.ToEntero()).FiltroPrimero("") If drPS IsNot Nothing Then - 'HdnUnidadMedida.Value = PS.Rows(0)("CveUnidadMedida").ToString - HdnPS.Value = drPS("PS").ToString - HdnCodigoPS.Value = drPS("PSCodigo").ToString - HdnTipoPS.Value = drPS("CveTipoPS").ToString - HdnTipoInv.Value = drPS("Inv_CveMetodoInventario").ToString - HdnAplicaIEPS.Value = drPS("AplicaIEPS").ToString - HdnPorcentajeIEPS.Value = drPS("IEPSPorcentaje").ToString + 'HdnUnidadMedida.Value = PS.Rows(0)("CveUnidadMedida").ToString() + HdnPS.Value = drPS("PS").ToString() + HdnCodigoPS.Value = drPS("PSCodigo").ToString() + HdnTipoPS.Value = drPS("CveTipoPS").ToString() + HdnTipoInv.Value = drPS("Inv_CveMetodoInventario").ToString() + HdnAplicaIEPS.Value = drPS("AplicaIEPS").ToString() + HdnPorcentajeIEPS.Value = drPS("IEPSPorcentaje").ToString() DdlUMPyME.Items.Clear() If UsuarioActual.Empresa.UsaInventarios Then - DdlUMPyME.DataSource = GlobalDTProductosServiciosEquivalencias(DdlPSPyME.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) + DdlUMPyME.DataSource = GlobalDTProductosServiciosEquivalencias(DdlPSPyME.SelectedValue.ToEntero(), -1, UsuarioActual.CveEmpresa) Else DdlUMPyME.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) End If DdlUMPyME.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlUMPyME.SelectedValue = "-1" DdlUMPyME.DataBind() - DdlUMPyME.SelectedValueExist(drPS("CveUnidadMedida").ToString) + DdlUMPyME.SelectedValueExist(drPS("CveUnidadMedida").ToString()) - 'LblUnidadMedida.Text = PS.Rows(0)("UnidadMedida").ToString - TxtPrecioPyME.Text = drPS("Precio").ToString.FormatoNumero(2).Replace(","c, "") + 'LblUnidadMedida.Text = PS.Rows(0)("UnidadMedida").ToString() + TxtPrecioPyME.Text = drPS("Precio").ToString().FormatoNumero(2).Replace(","c, "") Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal() Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal() - Dim ObjDescuento As Descuentos = CalcularDescuentos(DdlPSPyME.SelectedValue.ToEntero, Cantidad, PU) + Dim ObjDescuento As Descuentos = CalcularDescuentos(DdlPSPyME.SelectedValue.ToEntero(), Cantidad, PU) TxtDescuentoPyME.Text = ObjDescuento.ImporteDescuento.FormatoNumero(2).Replace(","c, "") @@ -20326,12 +20319,12 @@ Partial Class Ventas If UsuarioActual.CveEmpresa = 80 Then 'busca el precio de la sucursal Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSSucursales(DdlPSPyME.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlSubProyectoDatos.SelectedValue.ToEntero) Then + If ObjPS.GetPSSucursales(DdlPSPyME.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, DdlSubProyectoDatos.SelectedValue.ToEntero()) Then Dim dtt As DataTable = ObjPS.DtResultados Dim drPrecio As DataRow = dtt.FiltroPrimero("") If drPrecio IsNot Nothing Then - TxtPrecioPyME.Text = drPrecio("Importe").ToString.ToDouble.ToString("N4") + TxtPrecioPyME.Text = drPrecio("Importe").ToString().ToDouble.ToString("N4") End If dtt.Dispose() End If @@ -20340,17 +20333,17 @@ Partial Class Ventas End If 'If IsNumeric(TxtCantidad.Text.Trim) Then - ' LblTotalPyME.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString.FormatoNumero(2) + ' LblTotalPyME.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString().FormatoNumero(2) 'End If - HdnIVAPS.Value = If(drPS("IVA").ToString = "-1", ViewState("IVA"), drPS("IVA").ToString).ToString - HdnIVARetAPS.Value = drPS("RetIVA").ToString - HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString - HdnCtaContable.Value = drPS("IdCtaContVentas").ToString - HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString - HdnCodigo.Value = drPS("Codigo").ToString + HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString() + HdnIVARetAPS.Value = drPS("RetIVA").ToString() + HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString() + HdnCtaContable.Value = drPS("IdCtaContVentas").ToString() + HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString() + HdnCodigo.Value = drPS("Codigo").ToString() If DdlClasificacionPyME.SelectedIndex = 0 Then - If drPS("CveClasificacion").ToString IsNot Nothing Then - DdlClasificacionPyME.SelectedValueExist(drPS("CveClasificacion").ToString) + If drPS("CveClasificacion").ToString() IsNot Nothing Then + DdlClasificacionPyME.SelectedValueExist(drPS("CveClasificacion").ToString()) Else Alert("El Productos/Servicio no tiene asignada una Clasificación.") End If @@ -20372,7 +20365,7 @@ Partial Class Ventas End Sub Private Sub DdlClasificacionPyME_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClasificacionPyME.SelectedIndexChanged - CargaPSPyME(DdlClasificacionPyME.SelectedValue.ToEntero, DdlPSPyME) + CargaPSPyME(DdlClasificacionPyME.SelectedValue.ToEntero(), DdlPSPyME) UpClasificacionPyME.Update() End Sub @@ -20388,7 +20381,7 @@ Partial Class Ventas Dim Consec As Integer = 1 For Each indice As String In sArray If IsNumeric(indice) Then - Dim dr As DataRow = TmpDT.Rows(indice.ToEntero) + Dim dr As DataRow = TmpDT.Rows(indice.ToEntero()) dr("Consec") = Consec dr.AcceptChanges() DTClon.ImportRow(dr) @@ -20425,32 +20418,32 @@ Partial Class Ventas Dim Cantidad As Double Dim Existencia As Double For Each Dr As DataRow In TmpDT.Rows - CveProducto = Dr("CvePS").ToString.ToEntero - CveUnidad = Dr("CveUM").ToString.ToEntero - Cantidad = Dr("Cantidad").ToString.ToDouble + CveProducto = Dr("CvePS").ToString().ToEntero() + CveUnidad = Dr("CveUM").ToString().ToEntero() + Cantidad = Dr("Cantidad").ToString().ToDouble If Not CveProducto > 0 Then Return False End If - If Dr("CveTipoInvPS").ToString.ToEntero = 5 Then + If Dr("CveTipoInvPS").ToString().ToEntero() = 5 Then For Each Dr2 As DataRow In DtContratosSerieDetalle.FiltraParametros($"ConsecId = {Dr("CveContratoDetalle")}").Rows - Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, Serie:=Dr2("Serie").ToString, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) + Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, SerieLote:=Dr2("Serie").ToString(), FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) If Existencia < 1 Then Return False End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, Serie:=Dr2("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, SerieLote:=Dr2("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then Return False End If Next Else - Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) + Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) If Existencia < Cantidad Then Return False End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, Cantidad, CveUnidad, CveProducto, 0, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, Cantidad, CveUnidad, CveProducto, 0, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then Return False End If End If @@ -20465,7 +20458,7 @@ Partial Class Ventas If CveMovimientoEntradaGeneral > 0 Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, Dr("CveAF").ToString().ToEntero(), Dr("CveSeccionAlmacen").ToString().ToEntero(), Dr("SerieLote").ToString(), Lote:=Dr("Lote").ToString(), Batch:=Dr("Batch").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then Return False End If Next @@ -20479,7 +20472,7 @@ Partial Class Ventas If CveMovimientoEntradaGeneral > 0 Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, Dr("CveAF").ToString().ToEntero(), Dr("CveSeccionAlmacen").ToString().ToEntero(), Dr("SerieLote").ToString(), Lote:=Dr("Lote").ToString(), Batch:=Dr("Batch").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then Return False End If Next @@ -20513,12 +20506,12 @@ Partial Class Ventas Protected Sub BtnSerieConsignacion_Click(sender As Object, e As EventArgs) Dim Argumentos = CType(sender, Button).CommandArgument.Split("°"c) - CveConsecSerieLote = Argumentos(0).ToEntero - CvePSSerieLote = Argumentos(1).ToEntero - CveUMSerieLote = Argumentos(2).ToEntero + CveConsecSerieLote = Argumentos(0).ToEntero() + CvePSSerieLote = Argumentos(1).ToEntero() + CveUMSerieLote = Argumentos(2).ToEntero() LbProducto.Text = Argumentos(3) LbCantidad.Text = If(Argumentos(4).ToDecimal < 0.0D, 0, Argumentos(4).ToDecimal).FormatoNumero - LimitaCantidadSerieLote = Argumentos(5).ToEntero + LimitaCantidadSerieLote = Argumentos(5).ToEntero() CargaSerie() End Sub @@ -20529,9 +20522,9 @@ Partial Class Ventas GvSerie.DataSource = DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerieLote), "Consec DESC") GvSerie.DataBind() - lblSerieTotal.Text = GvSerie.Rows.Count.ToString + lblSerieTotal.Text = GvSerie.Rows.Count.ToString() 'VALIDA QUE SIGA AGREGANDO - If DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerieLote)).Rows.Count = LbCantidad.Text.ToEntero And LimitaCantidadSerieLote = 1 Then + If DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerieLote)).Rows.Count = LbCantidad.Text.ToEntero() And LimitaCantidadSerieLote = 1 Then BtnAgregarPS.Enabled = False If CerrarCompletado Then RegistraScript("$('#DivSerieConsignacion').modal('hide');") @@ -20584,7 +20577,7 @@ Partial Class Ventas End If 'PARA VALIDAR SI LA SERIE ES IGUAL AL CODIGO O CODIGOBARRAS - If SerieRow = dr("Codigo").ToString.ToUpper Or SerieRow = dr("CodigoBarras").ToString.ToUpper Then + If SerieRow = dr("Codigo").ToString().ToUpper Or SerieRow = dr("CodigoBarras").ToString().ToUpper Then MensajeAlert.Append($"
    El numero de Serie {SerieRow} coincide con el codigo o codigo de barras del producto. Por favor rectifique y vuelva a intentar.") Continue For End If @@ -20594,8 +20587,8 @@ Partial Class Ventas DtSeriesNuevas.Rows.Add(Row) Next - If MensajeAlert.ToString <> "" Then - Alert(MensajeAlert.ToString, TipoMensaje.MsgAdvertencia) + If MensajeAlert.ToString() <> "" Then + Alert(MensajeAlert.ToString(), TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error") Exit Sub End If @@ -20609,13 +20602,13 @@ Partial Class Ventas Dim Row = DtContratosSerieDetalle.NewRow Index = Index + 1 - If Index > LbCantidad.Text.ToEntero And LimitaCantidadSerieLote = 1 Then + If Index > LbCantidad.Text.ToEntero() And LimitaCantidadSerieLote = 1 Then MensajeSinExistencias.Append($"Serie: {SerieRow} - En esta serie ocurrió un error por favor de comunicarse con soporte tecnico..
    ") Continue For End If 'VERIFICA EXISTENCIAS - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=SerieRow) + Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=SerieRow) If Existencia < 1 Then MensajeSinExistencias.Append($"Serie: {SerieRow}.
    ") Continue For @@ -20637,8 +20630,8 @@ Partial Class Ventas CargaSerie(True) - If MensajeSinExistencias.ToString <> "" Then - Alert($"Las siguientes Series no cuentan con la existencia suficiente por lo cual se omitieron.
    {MensajeSinExistencias.ToString}", TipoMensaje.MsgAdvertencia) + If MensajeSinExistencias.ToString() <> "" Then + Alert($"Las siguientes Series no cuentan con la existencia suficiente por lo cual se omitieron.
    {MensajeSinExistencias.ToString()}", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error") Else RegistraScript("playsonidito('beep-07.wav')", "Existo") @@ -20648,9 +20641,9 @@ Partial Class Ventas Protected Sub GvSerie_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvSerie.RowDeleting Try - Dim keySerieLote As String = e.Keys("Serie").ToString + Dim keySerieLote As String = e.Keys("Serie").ToString() For Each dr As DataRow In DtContratosSerieDetalle.Rows - If dr("Serie").ToString = keySerieLote Then + If dr("Serie").ToString() = keySerieLote Then dr.Delete() End If Next @@ -20665,9 +20658,9 @@ Partial Class Ventas Private Sub CargaCantidadSerieGV() 'MODIFICA CANTIDAD DEL GV CONTRATOS For Each Gvr As GridViewRow In GvContratoDetalles.Rows - If Gvr.DataKey("CvePS").ToEntero = CvePSSerieLote Then + If Gvr.DataKey("CvePS").ToEntero() = CvePSSerieLote Then Dim Contador = DtContratosSerieDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("CveContratoDetalle"))).Rows.Count - Gvr.FCTextBox("TxtCant").Text = Contador.ToString + Gvr.FCTextBox("TxtCant").Text = Contador.ToString() UPEstimaciones.Update() Exit For End If @@ -20746,8 +20739,8 @@ Partial Class Ventas End Sub Protected Sub LnkSendMail_Click(sender As Object, e As EventArgs) Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - HdnSerieFolioPago.Value = gvRow.DataKey("SerieFolio").ToString - TxtParaMail.Text = gvRow.DataKey("CobranzaCorreo").ToString + HdnSerieFolioPago.Value = gvRow.DataKey("SerieFolio").ToString() + TxtParaMail.Text = gvRow.DataKey("CobranzaCorreo").ToString() UpSendMail.Update() RegistraScript("$('#ModalDivMail').modal('show');") End Sub @@ -20831,7 +20824,7 @@ Partial Class Ventas ' End If ' End If ' ObjVentas.Dispose() - ' Alert(dtt.Rows.Count.ToString) + ' Alert(dtt.Rows.Count.ToString()) ' GvRelacionarNC.DataSource = dtt ' GvRelacionarNC.DataBind() @@ -20915,8 +20908,8 @@ Partial Class Ventas Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) IndexDocumentoCliente = GvRow.RowIndex - Dim Documentacion As String = GvRow.DataKey("Documentacion").ToString - AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString + Dim Documentacion As String = GvRow.DataKey("Documentacion").ToString() + AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString() LtlModalTitleUploadDocumentoCliente.Text = "Subir " & Documentacion BtnModalClienteDocumentoCancelar.Visible = True @@ -20947,7 +20940,7 @@ Partial Class Ventas If RequiereOC And Not BtnModalClienteDocumentoCancelar.Visible Then Dim Count = 0 For Each GvRow As GridViewRow In GvDocumentosCliente.Rows - If GvRow.DataKey("Orden").ToEntero = 1 Then + If GvRow.DataKey("Orden").ToEntero() = 1 Then IndexDocumentoCliente = Count CargaDocumentoOC = True Exit For @@ -20955,7 +20948,6 @@ Partial Class Ventas Count = +1 Next End If - DtDocumentacionCliente(IndexDocumentoCliente)("RutaArchivo") = fileItem.FileUrl DtDocumentacionCliente(IndexDocumentoCliente)("UpArchivo") = "1" @@ -20981,10 +20973,10 @@ Partial Class Ventas If e.Row.RowType = DataControlRowType.DataRow Then Dim ArchivoRuta As String = e.Row.DataKey("RutaArchivo") - Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString + Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString() Dim ImgDownLoad As Literal = e.Row.FCLiteral("ImgDownLoad") Dim Chk As CheckBox = e.Row.FCCheckBox("chkEstatus") - Chk.Checked = If(e.Row.DataKey("Estatus").ToString = "1", True, False) + Chk.Checked = If(e.Row.DataKey("Estatus").ToString() = "1", True, False) If ArchivoRuta.Trim.Length > 0 Then @@ -21038,15 +21030,15 @@ Partial Class Ventas If tCveVenta > 0 Then For Each DRow As DataRow In DtDocumentacionCliente.FiltraParametros("RutaArchivo <> '' ").Rows - Dim CveDocumentacion As Integer = DRow("CveDocumentacion").ToString.ToEntero - Dim Estatus As Integer = DRow("Estatus").ToString.ToEntero - Dim Adjunto As String = DRow("Adjunto").ToString + Dim CveDocumentacion As Integer = DRow("CveDocumentacion").ToString().ToEntero() + Dim Estatus As Integer = DRow("Estatus").ToString().ToEntero() + Dim Adjunto As String = DRow("Adjunto").ToString() Dim NombreArchivo As String = "" - Dim ArchivoRuta As String = DRow("RutaArchivo").ToString + Dim ArchivoRuta As String = DRow("RutaArchivo").ToString() If ArchivoRuta.Length > 0 Then Adjunto = ArchivoRuta Dim Extension As String = Path.GetExtension(Adjunto) - Dim CveDocumentacionElectronica As Integer = objDocumentacion.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, -1, 1, DRow("Observacion").ToString, Extension, UsuarioActual.CveUsuario, New Date(1900, 1, 1), CveVenta:=tCveVenta) + Dim CveDocumentacionElectronica As Integer = objDocumentacion.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, -1, 1, DRow("Observacion").ToString(), Extension, UsuarioActual.CveUsuario, New Date(1900, 1, 1), CveVenta:=tCveVenta) If CveDocumentacionElectronica <= 0 Then ErrorList.Add("No se pudo registrar el documento ") NombreArchivo = $"{CveDocumentacionElectronica}{Extension}" @@ -21100,10 +21092,10 @@ Partial Class Ventas RegistraScript("$('#DivDocsCliente').modal({ backdrop: 'static', keyboard: false });", "ModalArchivos") Dim Count = 0 For Each GvRow As GridViewRow In GvDocumentosCliente.Rows - If GvRow.DataKey("Orden").ToEntero = 1 Then + If GvRow.DataKey("Orden").ToEntero() = 1 Then IndexDocumentoCliente = Count - Documentacion = GvRow.DataKey("Documentacion").ToString - AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString + Documentacion = GvRow.DataKey("Documentacion").ToString() + AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString() Exit For End If Count = +1 @@ -21146,8 +21138,8 @@ Partial Class Ventas Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC") If drr IsNot Nothing Then - FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate - TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal + FechaUltimaFluctuacion = drr("Fecha").ToString().ToDate + TipoCambioFluctuacion = drr("TipoCambio").ToString().ToDecimal End If End If @@ -21166,7 +21158,7 @@ Partial Class Ventas Dim TCVenta As Decimal = TxtTipoCambio.Text.ToDecimal Dim FechaVenta As Date = TxtFecha.Text.ToDate Dim FechaPago As Date = TxtFechaSaldarVenta.Text.ToDate - Dim tCveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero + Dim tCveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero() Dim TCPago As Decimal = GlobalTipoCambio(TxtFechaSaldarVenta.Text.ToDate).FormatoNumero(4).ToDecimal Dim CveConceptoDeduccion As Integer = 211 @@ -21187,11 +21179,11 @@ Partial Class Ventas Dim IdCuentaContableNoDeducible As Integer = 0 Dim SerieFolio As String = LblSerie.Text & "-" & TxtFolio.Text Dim ConceptoPartida As String = "saldado " & SerieFolio - ' Dim CveSubProyecto As Integer = gr.DataKey("CveSubProyecto").ToEntero + ' Dim CveSubProyecto As Integer = gr.DataKey("CveSubProyecto").ToEntero() - If CveConceptoDeduccion = 255 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(266).ToEntero - If CveConceptoDeduccion = 211 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(559).ToEntero - If CveConceptoDeduccion = 263 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(537).ToEntero + If CveConceptoDeduccion = 255 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(266).ToEntero() + If CveConceptoDeduccion = 211 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(559).ToEntero() + If CveConceptoDeduccion = 263 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(537).ToEntero() If CveConceptoDeduccion = 252 Then IdCuentaContableNoDeducible = 0 If CveConceptoDeduccion = 78 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.IdCuentaOtrosIngresos @@ -21256,14 +21248,14 @@ Partial Class Ventas ' iva - Dim PorcentajeImpuesto As Decimal = DdlIVA.SelectedValue.ToEntero + Dim PorcentajeImpuesto As Decimal = DdlIVA.SelectedValue.ToEntero() Dim IdCtaIVATrasladado As Integer = 0 Dim CveCuentaIVATrasladado As Integer = 0 If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then - IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVATrasladado").ToString.ToEntero - CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVATrasladado").ToString.ToEntero + IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVATrasladado").ToString().ToEntero() + CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVATrasladado").ToString().ToEntero() End If IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) @@ -21332,10 +21324,10 @@ Partial Class Ventas Dim objInventario As New ClsInventarios Dim CvePaqueteriaGuia As Integer - If objInventario.AddPaqueteriaGuia(DdlPaqueteria.SelectedValue.ToEntero, -1, TxtPaqueteriaGuia.Text.Trim, TxtPaqueteriaNumcajas.Text.ToEntero, TxtPaqueteriaPeso.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, + If objInventario.AddPaqueteriaGuia(DdlPaqueteria.SelectedValue.ToEntero(), -1, TxtPaqueteriaGuia.Text.Trim, TxtPaqueteriaNumcajas.Text.ToEntero(), TxtPaqueteriaPeso.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtRastreo.Text.Trim, TxtDimensiones.Text.Trim, TxtFechaEst.Text.Trim, CveVenta:=CveVenta) Then - CvePaqueteriaGuia = objInventario.DtResultados.Rows(0)(0).ToString.ToEntero + CvePaqueteriaGuia = objInventario.DtResultados.Rows(0)(0).ToString().ToEntero() CargaGvPaqueteria() LimpiacontrolesPaqueteria() @@ -21352,8 +21344,8 @@ Partial Class Ventas Protected Sub LnkRemovePaqueteriaGuia_Click(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim CvePaqueteriaGuia As Integer = GvRow.DataKey("CvePaqueteriaGuia").ToString.ToEntero - Dim Guia As String = GvRow.DataKey("Guia").ToString + Dim CvePaqueteriaGuia As Integer = GvRow.DataKey("CvePaqueteriaGuia").ToString().ToEntero() + Dim Guia As String = GvRow.DataKey("Guia").ToString() Dim objInventario As New ClsInventarios @@ -21419,13 +21411,13 @@ Partial Class Ventas Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim CveMovimiento As Integer = -1 - Dim CvePaqueteriaGuia As Integer = GvRow.DataKey("CvePaqueteriaGuia").ToString.ToEntero - Dim NumCajas As String = GvRow.DataKey("NumCajas").ToString - Dim Guia As String = GvRow.DataKey("Guia").ToString - Dim Peso As String = GvRow.DataKey("Peso").ToString.ToDecimal.ToString("####.00") + Dim CvePaqueteriaGuia As Integer = GvRow.DataKey("CvePaqueteriaGuia").ToString().ToEntero() + Dim NumCajas As String = GvRow.DataKey("NumCajas").ToString() + Dim Guia As String = GvRow.DataKey("Guia").ToString() + Dim Peso As String = GvRow.DataKey("Peso").ToString().ToDecimal.ToString("####.00") Dim DTDatosClienteGuia As New DataTable Dim DTMovimientosDetalle As New DataTable - Dim CvePaqueteria As Integer = GvRow.DataKey("CvePaqueteria").ToString.ToEntero + Dim CvePaqueteria As Integer = GvRow.DataKey("CvePaqueteria").ToString().ToEntero() Dim RutaRdlc As String = Server.MapPath("~") & "\Empresas\Grales\Formatos\GuiasFormato" & CvePaqueteria & ".rdlc" Dim Rastreo As String = GvRow.DataKey("Rastreo") @@ -21470,15 +21462,15 @@ Partial Class Ventas End If If DTDatosClienteGuia.Rows.Count > 0 Then - params.Add(New ReportParameter("NombreComercial", DTDatosClienteGuia.Rows(0)("NombreComercial").ToString)) - params.Add(New ReportParameter("Direccion", DTDatosClienteGuia.Rows(0)("Direccion").ToString)) - params.Add(New ReportParameter("Colonia", DTDatosClienteGuia.Rows(0)("Colonia").ToString)) - params.Add(New ReportParameter("NoExt", DTDatosClienteGuia.Rows(0)("NoExt").ToString)) - params.Add(New ReportParameter("NoInt", DTDatosClienteGuia.Rows(0)("NoInt").ToString)) - params.Add(New ReportParameter("Localidad", DTDatosClienteGuia.Rows(0)("Localidad").ToString)) - params.Add(New ReportParameter("Telefono", DTDatosClienteGuia.Rows(0)("Telefono").ToString)) - params.Add(New ReportParameter("RFCCliente", DTDatosClienteGuia.Rows(0)("RFC").ToString)) - params.Add(New ReportParameter("CiudadCliente", DTDatosClienteGuia.Rows(0)("Ciudad").ToString)) + params.Add(New ReportParameter("NombreComercial", DTDatosClienteGuia.Rows(0)("NombreComercial").ToString())) + params.Add(New ReportParameter("Direccion", DTDatosClienteGuia.Rows(0)("Direccion").ToString())) + params.Add(New ReportParameter("Colonia", DTDatosClienteGuia.Rows(0)("Colonia").ToString())) + params.Add(New ReportParameter("NoExt", DTDatosClienteGuia.Rows(0)("NoExt").ToString())) + params.Add(New ReportParameter("NoInt", DTDatosClienteGuia.Rows(0)("NoInt").ToString())) + params.Add(New ReportParameter("Localidad", DTDatosClienteGuia.Rows(0)("Localidad").ToString())) + params.Add(New ReportParameter("Telefono", DTDatosClienteGuia.Rows(0)("Telefono").ToString())) + params.Add(New ReportParameter("RFCCliente", DTDatosClienteGuia.Rows(0)("RFC").ToString())) + params.Add(New ReportParameter("CiudadCliente", DTDatosClienteGuia.Rows(0)("Ciudad").ToString())) Else Exit Sub End If @@ -21502,7 +21494,7 @@ Partial Class Ventas params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Anio", Now.Year.ToString)) + params.Add(New ReportParameter("Anio", Now.Year.ToString())) params.Add(New ReportParameter("Mes", Now.Month.ToString("00"))) params.Add(New ReportParameter("Dia", Now.Day.ToString("00"))) @@ -21523,7 +21515,7 @@ Partial Class Ventas If e.Row.RowType = DataControlRowType.DataRow Then Dim Lnk As LinkButton = e.Row.FCLinkButton("LnkGuiaPaqueteriaGuia") - Dim Destinatario As String = e.Row.DataKey("Mail").ToString + Dim Destinatario As String = e.Row.DataKey("Mail").ToString() If Destinatario.Length = 0 Then e.Row.FCLinkButton("LnkGuiaPaqueteriaMail").Visible = False @@ -21550,13 +21542,13 @@ Partial Class Ventas Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim SerieFolio As String = GvRow.DataKey("SerieFolio").ToString - Dim NombreComercial As String = GvRow.DataKey("NombreComercial").ToString - Dim Destinatario As String = GvRow.DataKey("Mail").ToString - Dim Paqueteria As String = GvRow.DataKey("Paqueteria").ToString - Dim Guia As String = GvRow.DataKey("Guia").ToString - Dim Rastreo As String = GvRow.DataKey("Rastreo").ToString - Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero + Dim SerieFolio As String = GvRow.DataKey("SerieFolio").ToString() + Dim NombreComercial As String = GvRow.DataKey("NombreComercial").ToString() + Dim Destinatario As String = GvRow.DataKey("Mail").ToString() + Dim Paqueteria As String = GvRow.DataKey("Paqueteria").ToString() + Dim Guia As String = GvRow.DataKey("Guia").ToString() + Dim Rastreo As String = GvRow.DataKey("Rastreo").ToString() + Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero() EnviarCorreoNotificacionGuias(1, SerieFolio, NombreComercial, Destinatario, Paqueteria, Guia, Rastreo, CveVenta, New DataTable) @@ -21578,7 +21570,7 @@ Partial Class Ventas 'Dim FolioOC As String = "" 'Dim FolioPedido As String = "" 'Dim CorreoDestino = "" - 'Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero + 'Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero() 'Dim CorreoVendedor As String = "" 'Dim CorreoVendedorUsuarioActual As String = "" @@ -21588,7 +21580,7 @@ Partial Class Ventas ' DtTemp = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveVendedor={CveVendedor}") ' If DtTemp.Rows.Count > 0 Then - ' CorreoVendedor = DtTemp.Rows(0)("Correo").ToString + ' CorreoVendedor = DtTemp.Rows(0)("Correo").ToString() ' End If 'End If @@ -21599,7 +21591,7 @@ Partial Class Ventas ' DtTemp = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveVendedor={ UsuarioActual.CveVendedor}") ' If DtTemp.Rows.Count > 0 Then - ' CorreoVendedorUsuarioActual = DtTemp.Rows(0)("Correo").ToString + ' CorreoVendedorUsuarioActual = DtTemp.Rows(0)("Correo").ToString() ' End If ' End If @@ -21632,7 +21624,7 @@ Partial Class Ventas 'If CveOC > 0 Then ' Dim ObjOC As New ClsOC ' If ObjOC.GetOC(CveOC, UsuarioActual.CveEmpresa) Then - ' FolioOC = ObjOC.Folio.ToString + ' FolioOC = ObjOC.Folio.ToString() ' End If ' ObjOC.Dispose() 'End If @@ -21641,7 +21633,7 @@ Partial Class Ventas 'If CvePedido > 0 Then ' Dim ObjVenta As New ClsVentas ' If ObjVenta.GetVenta(CvePedido, UsuarioActual.CveEmpresa) Then - ' FolioPedido = ObjVenta.Folio.ToString + ' FolioPedido = ObjVenta.Folio.ToString() ' End If ' ObjVenta.Dispose() 'End If @@ -21654,7 +21646,7 @@ Partial Class Ventas Cuerpo.AppendLine("CantidadProducto") For Each Drow As DataRow In tDtMovimientos.Rows - Cuerpo.AppendLine($"{Drow("Cantidad").ToString.ToEntero }{Drow("PS").ToString}") + Cuerpo.AppendLine($"{Drow("Cantidad").ToString().ToEntero() }{Drow("PS").ToString()}") Next Cuerpo.AppendLine("") End If @@ -21665,7 +21657,7 @@ Partial Class Ventas ' Destinatario = "sig.buzon@gmail.com" - If Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString) Then + If Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) Then GuardarBitacora(CveVenta, "", "Notificación de envío de productos al cliente") Alert("Correo envíado exitosamente a " & Destinatario) Else @@ -21682,11 +21674,11 @@ Partial Class Ventas ' Cuerpo.AppendLine("CantidadProducto") ' For Each Drow As DataRow In tDtMovimientos.Rows - ' Cuerpo.AppendLine($"{Drow("Cantidad").ToString.ToEntero }{Drow("PS").ToString}") + ' Cuerpo.AppendLine($"{Drow("Cantidad").ToString().ToEntero() }{Drow("PS").ToString()}") ' Next ' Cuerpo.AppendLine("") 'End If - 'Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString) + 'Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) 'Exit Select @@ -21698,10 +21690,10 @@ Partial Class Ventas ' Cuerpo.AppendLine("CantidadProducto") ' For Each Drow As DataRow In tDtMovimientos.Rows - ' Cuerpo.AppendLine($"{Drow("Cantidad").ToString.ToEntero }{Drow("PS").ToString}") + ' Cuerpo.AppendLine($"{Drow("Cantidad").ToString().ToEntero() }{Drow("PS").ToString()}") ' Next ' Cuerpo.AppendLine("") - ' Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString) + ' Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) 'End If Exit Select @@ -21718,11 +21710,11 @@ Partial Class Ventas Cuerpo.AppendLine("CantidadProducto") For Each Drow As DataRow In tDtMovimientos.Rows - Cuerpo.AppendLine($"{Drow("Cantidad").ToString.ToEntero }{Drow("PS").ToString}") + Cuerpo.AppendLine($"{Drow("Cantidad").ToString().ToEntero() }{Drow("PS").ToString()}") Next Cuerpo.AppendLine("") End If - Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString) + Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) Exit Select End Select @@ -21783,15 +21775,15 @@ Partial Class Ventas TxtNCPorcentaje.Text = PorcentajeMaximo.FormatoNumero(4) If PorcentajeMaximo < RVNCPorcentaje.MinimumValue.ToDouble Then - RVNCPorcentaje.MinimumValue = PorcentajeMaximo.FormatoNumero(4).ToDouble.ToString + RVNCPorcentaje.MinimumValue = PorcentajeMaximo.FormatoNumero(4).ToDouble.ToString() End If - RVNCPorcentaje.MaximumValue = PorcentajeMaximo.FormatoNumero(4).ToDouble.ToString + RVNCPorcentaje.MaximumValue = PorcentajeMaximo.FormatoNumero(4).ToDouble.ToString() TxtNCImporte.Text = ((PorcentajeMaximo * TxtTotal.Text.ToDouble) / 100).FormatoNumero If ((PorcentajeMaximo * TxtTotal.Text.ToDouble) / 100).FormatoNumero().ToDouble < RVTxtNCImporte.MinimumValue.ToDouble Then - RVTxtNCImporte.MinimumValue = ((PorcentajeMaximo * TxtTotal.Text.ToDouble) / 100).FormatoNumero().ToDouble.ToString + RVTxtNCImporte.MinimumValue = ((PorcentajeMaximo * TxtTotal.Text.ToDouble) / 100).FormatoNumero().ToDouble.ToString() End If - RVTxtNCImporte.MaximumValue = ((PorcentajeMaximo * TxtTotal.Text.ToDouble) / 100).FormatoNumero().ToDouble.ToString + RVTxtNCImporte.MaximumValue = ((PorcentajeMaximo * TxtTotal.Text.ToDouble) / 100).FormatoNumero().ToDouble.ToString() 'RVIRNC.MinimumValue = RVTxtNCImporte.MinimumValue 'RVIRNC.MaximumValue = RVTxtNCImporte.MaximumValue @@ -21829,7 +21821,7 @@ Partial Class Ventas Private Sub CargaCxC() Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero) Then + If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString().ToEntero(), "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero()) Then Dim DtTemporal As DataTable = ObjMovtos.DtResultados.FiltraParametros("TipoDocto <> 'RNC' AND Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento") GvCxC.DataSource = DtTemporal End If @@ -21839,7 +21831,7 @@ Partial Class Ventas Private Sub CargaRNC() Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then + If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then GvRemisionesNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio") End If ObjMovtos.Dispose() @@ -21849,7 +21841,7 @@ Partial Class Ventas Private Sub CargaDescRNC() Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then + If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then GvDescNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio") End If ObjMovtos.Dispose() @@ -21880,10 +21872,10 @@ Partial Class Ventas Protected Sub DdlNCNivelImporte_SelectedIndexChanged(sender As Object, e As EventArgs) Dim ImporteReferencia As Double = 0, PorcentajeMaximo As Double = 0 If Not AplicaNCMasiva Then - ImporteReferencia = If(DdlNCNivelImporte.SelectedValue.ToEntero = 1, TxtTotal.Text.Trim.ToDouble, TxtSubTotal.Text.Trim.ToDouble) + ImporteReferencia = If(DdlNCNivelImporte.SelectedValue.ToEntero() = 1, TxtTotal.Text.Trim.ToDouble, TxtSubTotal.Text.Trim.ToDouble) PorcentajeMaximo = HplSaldoAuxiliar.Text.ToDouble * 100 / TxtTotal.Text.Trim.ToDouble - RVNCPorcentaje.MaximumValue = PorcentajeMaximo.FormatoNumero(4).ToDouble.ToString - RVTxtNCImporte.MaximumValue = ((PorcentajeMaximo * ImporteReferencia) / 100).FormatoNumero().ToDouble.ToString + RVNCPorcentaje.MaximumValue = PorcentajeMaximo.FormatoNumero(4).ToDouble.ToString() + RVTxtNCImporte.MaximumValue = ((PorcentajeMaximo * ImporteReferencia) / 100).FormatoNumero().ToDouble.ToString() End If If AplicaNCMasiva Then RegistraScript($"CalculaImporteNCMasivo()", "CalculaImporteNCMasivo") Else RegistraScript("CalculaImporteNC();", "CalculaImporteNC") @@ -21911,24 +21903,31 @@ Partial Class Ventas End If ObjCliente.Dispose() - AplicarNC(DdlNCPS.SelectedValue.ToEntero, EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales) + Dim AplicaNuevoDocumento As Boolean = False + + 'SOLO APLICA SI NO HAY DOCUMENTOS QUE SELECCIONAR + If UsuarioActual.CveEmpresa = 140 AndAlso GvCxC.Rows.Count = 0 Then + AplicaNuevoDocumento = True + End If + + AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento) RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC") End Sub - Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True) + Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False) Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If DrPS Is Nothing Then Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError) Exit Sub Else 'VALIDA CLAVES SAT - If DrPS("SATClavePS").ToString = "" Then - Alert($"El concepto {DrPS("Codigo").ToString}-{DrPS("PS").ToString} no cuenta con producto SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) + If DrPS("SATClavePS").ToString() = "" Then + Alert($"El concepto {DrPS("Codigo").ToString()}-{DrPS("PS").ToString()} no cuenta con producto SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) Exit Sub End If - If DrPS("SATClaveUnidadMedida").ToString = "" Then - Alert($"El concepto {DrPS("Codigo").ToString}-{DrPS("PS").ToString} no cuenta con Unidad Medida SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) + If DrPS("SATClaveUnidadMedida").ToString() = "" Then + Alert($"El concepto {DrPS("Codigo").ToString()}-{DrPS("PS").ToString()} no cuenta con Unidad Medida SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) Exit Sub End If End If @@ -21959,91 +21958,85 @@ Partial Class Ventas DtImpuestos.AcceptChanges() Dim AcumuladoNC As Decimal = 0 - If AplicaNCMasiva Then - If NCDescuento Then - For Each RNC In ListaNCDesc - DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore) - Next - Else + If Not AplicaNuevoDocumento Then + If AplicaNCMasiva Then + If NCDescuento Then + For Each RNC In ListaNCDesc + DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore) + Next + Else - For Each Gvr As GridViewRow In GvCxC.Rows - If Gvr.FCCheckBox("ChkCxC").Checked Then - DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore) - 'CARGA FACTURA A LA CUAL SE APLICA LA NC - AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal - CargaNCDT(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal) + For Each Gvr As GridViewRow In GvCxC.Rows + If Gvr.FCCheckBox("ChkCxC").Checked Then + DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore) + 'CARGA FACTURA A LA CUAL SE APLICA LA NC + AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal + CargaNCDT(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal) + End If + Next + End If + Else + DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales) + + If EsNCAmortizacion Then + If DtAnticipoAmortizacion Is Nothing Then + InicializaDTAnticiposAmortizacion() End If - Next + Dim PorcentajeAplicado As Decimal = (TxtNCPorcentaje.Text.ToDecimal / 100D) + + Dim RowAnticipo As DataRow = DtAnticipoAmortizacion.NewRow + RowAnticipo("CveVenta") = Me.CveVenta + RowAnticipo("Importe") = TxtNCImporte.Text.Trim.ToDecimal + RowAnticipo("SaldoAnticipo") = SaldoAnticipo * PorcentajeAplicado + + DtAnticipoAmortizacion.Rows.Add(RowAnticipo) + End If + End If Else - DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales) - - If EsNCAmortizacion Then - If DtAnticipoAmortizacion Is Nothing Then - InicializaDTAnticiposAmortizacion() - End If - Dim PorcentajeAplicado As Decimal = (TxtNCPorcentaje.Text.ToDecimal / 100D) - - Dim RowAnticipo As DataRow = DtAnticipoAmortizacion.NewRow - RowAnticipo("CveVenta") = Me.CveVenta - RowAnticipo("Importe") = TxtNCImporte.Text.Trim.ToDecimal - RowAnticipo("SaldoAnticipo") = SaldoAnticipo * PorcentajeAplicado - - DtAnticipoAmortizacion.Rows.Add(RowAnticipo) - End If - + For Each RNC In ListaRemisionesNC + DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore) + Next End If - Dim ImpuestoTolerancia As Decimal = 0.01D ' SI EXCEDE ESA DIFERENCIA, AJUSTA EL IMPUESTO + Dim query = From dr In DtImpuestos - Group By PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal, - PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString.ToDecimal, - PorcentajeRetISR = dr("PorcentajeRetISR").ToString.ToDecimal, - PorcentajeIEPS = dr("PorcentajeIEPS").ToString.ToDecimal + Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal, + PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal, + PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal, + PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal Into x = Group - Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString.ToDecimal), - ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString.ToDecimal), - ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString.ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA, - ImporteIVACalculado = (x.Sum(Function(s) (s("ImportePU").ToString.ToDecimal) * PorcentajeIVA)).RoundSQL(2), - ImporteRetIVA = x.Sum(Function(s) s("ImporteRetIVA").ToString.ToDecimal).RoundSQL(2),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA, - ImporteRetISR = x.Sum(Function(s) s("ImporteRetISR").ToString.ToDecimal).RoundSQL(2),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR, - ImporteIEPS = x.Sum(Function(s) s("ImporteIEPS").ToString.ToDecimal).RoundSQL(2), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS, - ImporteIEPSCalculado = (x.Sum(Function(s) s("ImportePU").ToString.ToDecimal) * PorcentajeIEPS).RoundSQL(2), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS, + Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal), + ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal), + ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA, + ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA, + ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR, + ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS, PorcentajeIVA = PorcentajeIVA, PorcentajeRetIVA = PorcentajeRetIVA, PorcentajeRetISR = PorcentajeRetISR, PorcentajeIEPS = PorcentajeIEPS - 'codigo para ajustar tolerancia. - Dim Impuesto = From dd In query - Select PorcentajeIEPS = dd.PorcentajeIEPS, - PorcentajeIVA = dd.PorcentajeIVA, - PorcentajeRetISR = dd.PorcentajeRetISR, - PorcentajeRetIVA = dd.PorcentajeRetIVA, - ImportePU = dd.ImportePU, - ImporteTotal = dd.ImporteTotal, - ImporteIVA = If((dd.ImporteIVA - dd.ImporteIVACalculado).Abs >= ImpuestoTolerancia, dd.ImporteIVACalculado, dd.ImporteIVA), - ImporteRetIVA = dd.ImporteRetIVA, - ImporteRetISR = dd.ImporteRetISR, - ImporteIEPS = If((dd.ImporteIEPS - dd.ImporteIEPSCalculado).Abs >= ImpuestoTolerancia, dd.ImporteIEPSCalculado, dd.ImporteIEPS) - Order By PorcentajeIVA, PorcentajeIEPS - 'hay una condicion de verificacion arriba, en la que checa si la diferencia en ieps, es menor a 3 centavos, toma el valor recalculado + '(1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) + + 'Dim DrSubProyecto = GlobalDTSubProyectos(-1, TmpDT.FiltroPrimeroValor("CveSubProyecto", "", "ImporteTotal DESC").ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("") + + Dim DrSubProyecto = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("") - Dim DrSubProyecto = GlobalDTSubProyectos(-1, TmpDT.FiltroPrimeroValor("CveSubProyecto", "", "ImporteTotal DESC").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) Exit Sub End If - DtImpuestos = Impuesto.QueryToDataTable(False) + DtImpuestos = query.QueryToDataTable(False) If Not NCDescuento Then 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 = DrSubProyecto("CveSubProyecto").ToString().ToEntero() + Dim SubProyecto = DrSubProyecto("SubProyecto").ToString() + Dim CveProyecto = DrSubProyecto("CveProyecto").ToString().ToEntero() + Dim Proyecto = DrSubProyecto("Proyecto").ToString() AplicaNC = True @@ -22052,11 +22045,11 @@ Partial Class Ventas TmpDTDescNC.Clear() For Each Dr As DataRow In DtImpuestos.Rows - AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero, - DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, Proyecto, CveSubProyecto, SubProyecto, - TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal, - Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImportePU").ToString.ToDecimal, "", "", -1, -1, - DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1) + AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(), + DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, + TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal, + Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal, "", "", -1, -1, + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) Next TrTipoRelacion.Visible = True @@ -22064,7 +22057,7 @@ Partial Class Ventas 'verifica el tipo de cambio que se actualice If DdlMoneda.SelectedValue <> "1" Then - TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString + TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString() End If Else If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta @@ -22076,7 +22069,7 @@ Partial Class Ventas Dim Ajuste As Decimal = 0 For Each Dr As DataRow In DtImpuestos.Rows - Acumulado12 += Dr("ImportePU").ToString.ToDecimal.RoundSQL + Dr("ImporteIVA").ToString.ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString.ToDecimal + Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal If UltimoRenglon = DtImpuestos.Rows.Count Then 'ajusta 5 centavos de diferencia If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then @@ -22084,11 +22077,11 @@ Partial Class Ventas End If End If UltimoRenglon += 1 - AgregaTempDT(TmpDT, DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero, - DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, Proyecto, CveSubProyecto, SubProyecto, - TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal, - Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString.ToDecimal(), "", "", -1, -1, - DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1) + AgregaTempDT(TmpDT, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(), + DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, + TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal, + Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal(), "", "", -1, -1, + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) Next GvPS.DataSource = TmpDT @@ -22108,7 +22101,7 @@ Partial Class Ventas End If 'verifica el tipo de cambio que se actualice If DdlMoneda.SelectedValue <> "1" Then - TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString + TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString() End If LblTCValuacion.Visible = False UpPS.Update() @@ -22124,8 +22117,8 @@ Partial Class Ventas Dim TmpDT As DataTable = Nothing Dim TmpDTImpuestos As DataTable = Nothing - Dim ObjVentas As New ClsVentas + Dim ObjVentas As New ClsVentas If ObjVentas.GetVentaImpuestosLocales(CveVentaNC) Then If ObjVentas.DtResultados.Rows.Count > 0 Then TmpDTImpuestos = ObjVentas.DtResultados.Copy() @@ -22141,8 +22134,8 @@ Partial Class Ventas If AplicaNCMasiva Then If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then If ObjVentas.DtResultados.Rows.Count > 0 Then - Total = ObjVentas.DtResultados()(0)("Total").ToString.ToDecimal - SubTotal = ObjVentas.DtResultados()(0)("SubTotal").ToString.ToDecimal + Total = ObjVentas.DtResultados()(0)("Total").ToString().ToDecimal + SubTotal = ObjVentas.DtResultados()(0)("SubTotal").ToString().ToDecimal End If End If Else @@ -22151,7 +22144,8 @@ Partial Class Ventas End If ObjVentas.Dispose() - Dim DtImpuestosLocal = TmpDT.FiltraParametros("", "", {"PorcentajeIVA", "PorcentajeRetIVA", "PorcentajeRetISR", "PorcentajeIEPS", "CveSubProyecto"}).Copy + + Dim DtImpuestosLocal = 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)) @@ -22159,7 +22153,7 @@ Partial Class Ventas DtImpuestosLocal.Columns.Add("ImporteRetISR", GetType(Decimal)) DtImpuestosLocal.Columns.Add("ImporteIEPS", GetType(Decimal)) - Dim ImporteReferencia As Decimal = If(DdlNCNivelImporte.SelectedValue.ToEntero = 1, Total, SubTotal) + Dim ImporteReferencia As Decimal = If(DdlNCNivelImporte.SelectedValue.ToEntero() = 1, Total, SubTotal) Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100 Dim FiltroStr As String = "" Dim importePuTemp As Decimal = 0 @@ -22169,8 +22163,8 @@ Partial Class Ventas End If For Each Dr As DataRow In DtImpuestosLocal.Rows - FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA"), Dr("PorcentajeRetIVA"), Dr("PorcentajeRetISR"), Dr("PorcentajeIEPS"), Dr("CveSubProyecto")) - importePuTemp = (Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr))) + FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("CveSubProyecto")) + importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr).ToDecimal() - TmpDT.SUM("Descuento", FiltroStr).ToDecimal())) If Not AplicaImpuestosLocales Then importePuTemp = importePuTemp - TotalImpuestosLocales @@ -22180,7 +22174,7 @@ Partial Class Ventas Dr("ImporteIEPS") = (importePuTemp * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2) - Dr("ImporteIVA") = ((importePuTemp + Dr("ImporteIEPS").ToString.ToDecimal) * Dr("PorcentajeIVA").ToString.ToDecimal) + Dr("ImporteIVA") = ((importePuTemp + Dr("ImporteIEPS").ToString().ToDecimal) * Dr("PorcentajeIVA").ToString().ToDecimal) Dr("ImporteRetIVA") = (importePuTemp * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2) Dr("ImporteRetISR") = (importePuTemp * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2) @@ -22189,7 +22183,7 @@ Partial Class Ventas 'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2) 'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2) 'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2) - Dr("ImportePU") = importePuTemp.RoundSQL(6) 'Dr("ImporteTotal").ToString.ToDecimal.RoundSQL(2) '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal) + Dr("ImportePU") = importePuTemp.RoundSQL(6) 'Dr("ImporteTotal").ToString().ToDecimal.RoundSQL(2) '(Dr("ImporteTotal").ToString().ToDecimal - Dr("ImporteIVA").ToString().ToDecimal - Dr("ImporteRetIVA").ToString().ToDecimal - Dr("ImporteRetISR").ToString().ToDecimal - Dr("ImporteIEPS").ToString().ToDecimal) Next Dim importeNC = (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) @@ -22201,7 +22195,7 @@ Partial Class Ventas If Math.Abs(difTmp) > 0.00D Then 'asusto la diferencia en el último concepto - Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp + Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString().ToDecimal + difTmp DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = ImporteAjustado DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImportePU") = ImporteAjustado End If @@ -22348,7 +22342,7 @@ Partial Class Ventas DdlUsoCFDI.SelectedValueExist("2") DdlMetodoPago33.Enabled = True DdlMetodoPago33.SelectedValueExist("1") ' PUE - CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero) + CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) DdlFormaPago33.Enabled = True DdlFormaPago33.SelectedValueExist("11") ' condonación por default @@ -22394,9 +22388,9 @@ Partial Class Ventas End If If ObjVentasAplicar.GetVenta(pCveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentasAplicar.DtResultados.Rows.Count > 0 Then FolioFiscal = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("FolioFiscal").ToString() - TC = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("TipoCambio").ToString.ToDecimal() - TCCambioValuacion = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("TipoCambioValuacion").ToString.ToDecimal() - CveEstatusFacturaNC = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("CveEstatusFactura").ToString.ToEntero() + TC = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("TipoCambio").ToString().ToDecimal() + TCCambioValuacion = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("TipoCambioValuacion").ToString().ToDecimal() + CveEstatusFacturaNC = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("CveEstatusFactura").ToString().ToEntero() End If If ObjVentas Is Nothing Then @@ -22443,7 +22437,7 @@ Partial Class Ventas Dim SeEsconde As Boolean = False If DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0 Then - If Not DtDetalle.SUM("CantSur").ToString.ToDecimal > 0 Then SeEsconde = True + If Not DtDetalle.SUM("CantSur").ToString().ToDecimal > 0 Then SeEsconde = True 'NO MOSTRAR LOS PRODUCTOS CON LA CLASIFICACION DE USADOS GvAplicaDevolucion.DataSource = DtDetalle.FiltraParametros("CantRes > 0 AND CveClasificacion <> 20519") End If @@ -22500,25 +22494,25 @@ Partial Class Ventas For Each Gv As GridViewRow In GvAplicaDevolucion.Rows If Gv.FCCheckBox("Chk").Checked And Gv.FCTextBox("TxtCantidadAplicaDevolucion").Text.ToDecimal > 0 Then Dim Cantidad As Decimal = Gv.FCTextBox("TxtCantidadAplicaDevolucion").Text.ToDecimal - Dim Descuento As Decimal = Cantidad * Gv.DataKey("Descuento").ToString.ToDecimal / Gv.DataKey("Cantidad").ToString.ToDecimal + Dim Descuento As Decimal = Cantidad * Gv.DataKey("Descuento").ToString().ToDecimal / Gv.DataKey("Cantidad").ToString().ToDecimal Dim PU As Decimal = If(AplicaPUEditado, Gv.FCTextBox("TxtPrecioEditado").Text.ToDecimal, Gv.DataKey("PU").ToDecimal) Dim Total As Decimal = (Cantidad * PU) Dim TotalImpuestos As Decimal = (Cantidad * PU) - Descuento - Dim ImporteIVA As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeIVA").ToString.ToDecimal - Dim ImporteRetIVA As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeRetIVA").ToString.ToDecimal - Dim ImporteRetISR As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeRetISR").ToString.ToDecimal - Dim ImporteIEPS As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeIEPS").ToString.ToDecimal + Dim ImporteIVA As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeIVA").ToString().ToDecimal + Dim ImporteRetIVA As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeRetIVA").ToString().ToDecimal + Dim ImporteRetISR As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeRetISR").ToString().ToDecimal + Dim ImporteIEPS As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeIEPS").ToString().ToDecimal - AgregaTempDT(TmpDT, Gv.DataKey("CvePS").ToString.ToEntero, Gv.DataKey("PS").ToString, Gv.DataKey("Codigo").ToString, Gv.DataKey("CodigoPS").ToString, - Gv.DataKey("CveTipoPS").ToString.ToEntero, Gv.DataKey("CveTipoInvPS").ToString.ToEntero, - Gv.DataKey("CveUM").ToString.ToEntero, Gv.DataKey("UM").ToString, Gv.DataKey("CveClasificacion").ToString.ToEntero, - Gv.DataKey("Clasificacion").ToString, Gv.DataKey("CveProyecto").ToString.ToEntero, Gv.DataKey("Proyecto").ToString, - Gv.DataKey("CveSubProyecto").ToString.ToEntero, Gv.DataKey("SubProyecto").ToString, - Gv.DataKey("Obs").ToString, Cantidad, PU, Gv.DataKey("PorcentajeIVA").ToString.ToDecimal, ImporteIVA, - Gv.DataKey("PorcentajeRetIVA").ToString.ToDecimal, ImporteRetIVA, - Gv.DataKey("PorcentajeRetISR").ToString.ToDecimal, ImporteRetISR, Gv.DataKey("PorcentajeIEPS").ToString.ToDecimal, + AgregaTempDT(TmpDT, Gv.DataKey("CvePS").ToString().ToEntero(), Gv.DataKey("PS").ToString(), Gv.DataKey("Codigo").ToString(), Gv.DataKey("CodigoPS").ToString(), + Gv.DataKey("CveTipoPS").ToString().ToEntero(), Gv.DataKey("CveTipoInvPS").ToString().ToEntero(), + Gv.DataKey("CveUM").ToString().ToEntero(), Gv.DataKey("UM").ToString(), Gv.DataKey("CveClasificacion").ToString().ToEntero(), + Gv.DataKey("Clasificacion").ToString(), Gv.DataKey("CveProyecto").ToString().ToEntero(), Gv.DataKey("Proyecto").ToString(), + Gv.DataKey("CveSubProyecto").ToString().ToEntero(), Gv.DataKey("SubProyecto").ToString(), + Gv.DataKey("Obs").ToString(), Cantidad, PU, Gv.DataKey("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, + Gv.DataKey("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, + Gv.DataKey("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, Gv.DataKey("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, Descuento, Total, "", "", -1, -1, - Gv.DataKey("SATClaveProdServ").ToString, Gv.DataKey("SATClaveUM").ToString, -1, Gv.DataKey("CveVentaDetalle").ToString.ToEntero, -1, -1, -1, -1, Gv.DataKey("CveTamaño").ToEntero()) + Gv.DataKey("SATClaveProdServ").ToString(), Gv.DataKey("SATClaveUM").ToString(), -1, Gv.DataKey("CveVentaDetalle").ToString().ToEntero(), -1, -1, -1, -1, Gv.DataKey("CveTamaño").ToEntero()) End If Next @@ -22536,14 +22530,14 @@ Partial Class Ventas Dim DTAlmacen As DataTable ddlAlmacen.Items.Clear() - DTAlmacen = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero}") + DTAlmacen = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}") ddlAlmacen.DataSource = DTAlmacen If DTAlmacen Is Nothing Or DTAlmacen.Rows.Count = 0 Then ddlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) ddlAlmacen.SelectedValue = "-1" End If ddlAlmacen.DataBind() - If GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero}").Rows.Count > 0 Then + If GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()}").Rows.Count > 0 Then ddlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) End If GvInv.Columns(0).Visible = True @@ -22586,7 +22580,7 @@ Partial Class Ventas TxtFecha.Text = Now.ToShortDateString() TipoCambioFactura = TxtTipoCambio.Text.ToDecimal - If DdlMoneda.SelectedValue.ToEntero > 1 Then + If DdlMoneda.SelectedValue.ToEntero() > 1 Then Dim ObjIE As New ClsBancos If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then If ObjIE.DtResultados.Rows.Count > 0 Then @@ -22595,7 +22589,7 @@ Partial Class Ventas Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha > #" & Fecha & "#", "Fecha DESC") If drr IsNot Nothing Then - TipoCambioFactura = drr("TipoCambio").ToString.ToDecimal + TipoCambioFactura = drr("TipoCambio").ToString().ToDecimal End If End If @@ -22605,7 +22599,7 @@ Partial Class Ventas TipoCambioFactura = 1 End If - TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString + TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString() DivEstatusFac.Visible = False 'REINICIALIZA TABS @@ -22629,7 +22623,7 @@ Partial Class Ventas DdlUsoCFDI.SelectedValueExist("2") DdlMetodoPago33.Enabled = True DdlMetodoPago33.SelectedValueExist("1") - CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero) + CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) DdlFormaPago33.Enabled = True DdlFormaPago33.SelectedValueExist("11") @@ -22764,17 +22758,17 @@ Partial Class Ventas For Each Gvr As GridViewRow In GvComercioExterior.Rows - If Not Gvr.DataKey("Codigo").ToString <> "" Then + If Not Gvr.DataKey("Codigo").ToString() <> "" Then Alert("Todos los conceptos tienen que tener un codigo asignado", TipoMensaje.MsgAdvertencia) Return False End If - If Not Gvr.DataKey("ClaveSATFraccionArancelaria").ToEntero > 0 Then + If Not Gvr.DataKey("ClaveSATFraccionArancelaria").ToEntero() > 0 Then Alert("Todos los productos tienen que tener una fraccion arancelaria", TipoMensaje.MsgAdvertencia) Return False End If - If Not Gvr.DataKey("ClaveSATUnidadAduana").ToEntero > 0 Then + If Not Gvr.DataKey("ClaveSATUnidadAduana").ToEntero() > 0 Then Alert("Todos los productos tienen que tener una unidad aduana", TipoMensaje.MsgAdvertencia) Return False End If @@ -22822,8 +22816,8 @@ Partial Class Ventas Private Sub CargaEstado() DdlComExtEstado.Items.Clear() - If DdlComExtPais.SelectedValue.ToEntero > 0 Then - DdlComExtEstado.DataSource = GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlComExtPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString) + If DdlComExtPais.SelectedValue.ToEntero() > 0 Then + DdlComExtEstado.DataSource = GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlComExtPais.SelectedValue.ToEntero()}")(0)("ClaveSATPais").ToString()) End If DdlComExtEstado.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlComExtEstado.DataBind() @@ -22831,8 +22825,8 @@ Partial Class Ventas Private Sub CargaMunicipio() DdlComExtMunicipio.Items.Clear() - If DdlComExtEstado.SelectedValue.ToEntero > 0 Then - DdlComExtMunicipio.DataSource = GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlComExtPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlComExtEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString) + If DdlComExtEstado.SelectedValue.ToEntero() > 0 Then + DdlComExtMunicipio.DataSource = GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlComExtPais.SelectedValue.ToEntero()}")(0)("ClaveSATPais").ToString()).FiltraParametros($"CveEstado = {DdlComExtEstado.SelectedValue.ToEntero()}")(0)("ClaveSATEstado").ToString()) End If DdlComExtMunicipio.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlComExtMunicipio.DataBind() @@ -22841,8 +22835,8 @@ Partial Class Ventas Private Sub CargaColonia() DdlComExtColonia.Items.Clear() - If DdlComExtMunicipio.SelectedValue.ToEntero > 0 Then - DdlComExtColonia.DataSource = GlobalDTColonia(GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlComExtPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlComExtEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString).FiltraParametros($"CveMunicipio = {DdlComExtMunicipio.SelectedValue.ToEntero}")(0)("ClaveSATMunicipio").ToString) + If DdlComExtMunicipio.SelectedValue.ToEntero() > 0 Then + DdlComExtColonia.DataSource = GlobalDTColonia(GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlComExtPais.SelectedValue.ToEntero()}")(0)("ClaveSATPais").ToString()).FiltraParametros($"CveEstado = {DdlComExtEstado.SelectedValue.ToEntero()}")(0)("ClaveSATEstado").ToString()).FiltraParametros($"CveMunicipio = {DdlComExtMunicipio.SelectedValue.ToEntero()}")(0)("ClaveSATMunicipio").ToString()) End If DdlComExtColonia.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlComExtColonia.DataBind() @@ -22895,8 +22889,8 @@ Partial Class Ventas End Sub Private Sub BtnComExtConvertirUnidad_Click(sender As Object, e As EventArgs) Handles BtnComExtConvertirUnidad.Click For Each gvr As GridViewRow In GvComercioExterior.Rows - gvr.FCTextBox("TxtCantidad").Text = (gvr.FCTextBox("TxtCantidad").Text.ToDecimal * TxtComExtConvertir.Text.ToDecimal).ToString - gvr.FCTextBox("TxtValorUnitario").Text = (gvr.FCTextBox("TxtValorUnitario").Text.ToDecimal / TxtComExtConvertir.Text.ToDecimal).ToString + gvr.FCTextBox("TxtCantidad").Text = (gvr.FCTextBox("TxtCantidad").Text.ToDecimal * TxtComExtConvertir.Text.ToDecimal).ToString() + gvr.FCTextBox("TxtValorUnitario").Text = (gvr.FCTextBox("TxtValorUnitario").Text.ToDecimal / TxtComExtConvertir.Text.ToDecimal).ToString() Next End Sub #End Region @@ -22921,15 +22915,15 @@ Partial Class Ventas Dim Guia As String = "" If ObjInventario.GetPaqueteriaGuia(-1, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then If ObjInventario.DtResultados.Rows.Count > 0 Then - Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString + Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString() End If End If If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then If ObjVentas.DtResultados.Rows.Count > 0 Then - SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString - PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString - EnvioContacto = ObjVentas.DtResultados.Rows(0)("EnvioContacto").ToString - EnvioDireccion = $"{ObjVentas.DtResultados.Rows(0)("EnvioDireccion").ToString}, NO. EXT: {ObjVentas.DtResultados.Rows(0)("EnvioNoExt").ToString}, COLONIA: {ObjVentas.DtResultados.Rows(0)("EnvioColonia").ToString}, CP: {ObjVentas.DtResultados.Rows(0)("EnvioCP").ToString}" + SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString() + PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString() + EnvioContacto = ObjVentas.DtResultados.Rows(0)("EnvioContacto").ToString() + EnvioDireccion = $"{ObjVentas.DtResultados.Rows(0)("EnvioDireccion").ToString()}, NO. EXT: {ObjVentas.DtResultados.Rows(0)("EnvioNoExt").ToString()}, COLONIA: {ObjVentas.DtResultados.Rows(0)("EnvioColonia").ToString()}, CP: {ObjVentas.DtResultados.Rows(0)("EnvioCP").ToString()}" End If End If Dim Dt As DataTable = Nothing @@ -22972,56 +22966,56 @@ Partial Class Ventas Dim CP As String = "" If ObjInventario.GetPaqueteriaGuia(-1, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then If ObjInventario.DtResultados.Rows.Count > 0 Then - Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString + Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString() End If End If If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then If ObjVentas.DtResultados.Rows.Count > 0 Then - SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString - PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString + SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString() + PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString() - If ObjVentas.DtResultados.Rows(0)("CveDireccionEnvio").ToString.ToEntero > 0 Then - EnvioContacto = ObjVentas.DtResultados.Rows(0)("EnvioContacto").ToString - EnvioDireccion = $"{ObjVentas.DtResultados.Rows(0)("EnvioDireccion").ToString}, COLONIA: {ObjVentas.DtResultados.Rows(0)("EnvioColonia").ToString}, CP: {ObjVentas.DtResultados.Rows(0)("EnvioCP").ToString}" - EnviarOficina = ObjVentas.DtResultados.Rows(0)("EnvioDepartamento").ToString - EnviarCalle = ObjVentas.DtResultados.Rows(0)("EnvioDireccion").ToString - EnviarColonia = ObjVentas.DtResultados.Rows(0)("EnvioColonia").ToString - EnvioCiudad = ObjVentas.DtResultados.Rows(0)("EnvioCiudad").ToString - EnvioTel = ObjVentas.DtResultados.Rows(0)("EnvioTel").ToString - EnvioNoExt = ObjVentas.DtResultados.Rows(0)("EnvioNoExt").ToString - EnvioNoInt = ObjVentas.DtResultados.Rows(0)("EnvioNoInt").ToString - EnvioEstado = ObjVentas.DtResultados.Rows(0)("EnvioEstado").ToString - Pais = ObjVentas.DtResultados.Rows(0)("SucClientePais").ToString - CP = ObjVentas.DtResultados.Rows(0)("EnvioCP").ToString + If ObjVentas.DtResultados.Rows(0)("CveDireccionEnvio").ToString().ToEntero() > 0 Then + EnvioContacto = ObjVentas.DtResultados.Rows(0)("EnvioContacto").ToString() + EnvioDireccion = $"{ObjVentas.DtResultados.Rows(0)("EnvioDireccion").ToString()}, COLONIA: {ObjVentas.DtResultados.Rows(0)("EnvioColonia").ToString()}, CP: {ObjVentas.DtResultados.Rows(0)("EnvioCP").ToString()}" + EnviarOficina = ObjVentas.DtResultados.Rows(0)("EnvioDepartamento").ToString() + EnviarCalle = ObjVentas.DtResultados.Rows(0)("EnvioDireccion").ToString() + EnviarColonia = ObjVentas.DtResultados.Rows(0)("EnvioColonia").ToString() + EnvioCiudad = ObjVentas.DtResultados.Rows(0)("EnvioCiudad").ToString() + EnvioTel = ObjVentas.DtResultados.Rows(0)("EnvioTel").ToString() + EnvioNoExt = ObjVentas.DtResultados.Rows(0)("EnvioNoExt").ToString() + EnvioNoInt = ObjVentas.DtResultados.Rows(0)("EnvioNoInt").ToString() + EnvioEstado = ObjVentas.DtResultados.Rows(0)("EnvioEstado").ToString() + Pais = ObjVentas.DtResultados.Rows(0)("SucClientePais").ToString() + CP = ObjVentas.DtResultados.Rows(0)("EnvioCP").ToString() 'CP = "Envio" Else - If ObjVentas.DtResultados.Rows(0)("CveClienteSucursal").ToString.ToEntero > 0 Then - 'EnvioContacto = ObjVentas.DtResultados.Rows(0)("EnvioContacto").ToString - EnvioDireccion = $"{ObjVentas.DtResultados.Rows(0)("SucClienteDireccion").ToString}, COLONIA: {ObjVentas.DtResultados.Rows(0)("SucClienteColonia").ToString}, CP: {ObjVentas.DtResultados.Rows(0)("SucClienteCP").ToString}" - 'EnviarOficina = ObjVentas.DtResultados.Rows(0)("EnvioDepartamento").ToString - EnviarCalle = ObjVentas.DtResultados.Rows(0)("SucClienteDireccion").ToString - EnviarColonia = ObjVentas.DtResultados.Rows(0)("SucClienteColonia").ToString - EnvioCiudad = ObjVentas.DtResultados.Rows(0)("SucClienteCiudad").ToString - EnvioTel = ObjVentas.DtResultados.Rows(0)("EnvioTel").ToString - EnvioNoExt = ObjVentas.DtResultados.Rows(0)("SucClienteNoExt").ToString - EnvioNoInt = ObjVentas.DtResultados.Rows(0)("SucClienteNoInt").ToString - EnvioEstado = ObjVentas.DtResultados.Rows(0)("SucClienteEstado").ToString - Pais = ObjVentas.DtResultados.Rows(0)("SucClientePais").ToString - 'CP = ObjVentas.DtResultados.Rows(0)("SucClienteCP").ToString + If ObjVentas.DtResultados.Rows(0)("CveClienteSucursal").ToString().ToEntero() > 0 Then + 'EnvioContacto = ObjVentas.DtResultados.Rows(0)("EnvioContacto").ToString() + EnvioDireccion = $"{ObjVentas.DtResultados.Rows(0)("SucClienteDireccion").ToString()}, COLONIA: {ObjVentas.DtResultados.Rows(0)("SucClienteColonia").ToString()}, CP: {ObjVentas.DtResultados.Rows(0)("SucClienteCP").ToString()}" + 'EnviarOficina = ObjVentas.DtResultados.Rows(0)("EnvioDepartamento").ToString() + EnviarCalle = ObjVentas.DtResultados.Rows(0)("SucClienteDireccion").ToString() + EnviarColonia = ObjVentas.DtResultados.Rows(0)("SucClienteColonia").ToString() + EnvioCiudad = ObjVentas.DtResultados.Rows(0)("SucClienteCiudad").ToString() + EnvioTel = ObjVentas.DtResultados.Rows(0)("EnvioTel").ToString() + EnvioNoExt = ObjVentas.DtResultados.Rows(0)("SucClienteNoExt").ToString() + EnvioNoInt = ObjVentas.DtResultados.Rows(0)("SucClienteNoInt").ToString() + EnvioEstado = ObjVentas.DtResultados.Rows(0)("SucClienteEstado").ToString() + Pais = ObjVentas.DtResultados.Rows(0)("SucClientePais").ToString() + 'CP = ObjVentas.DtResultados.Rows(0)("SucClienteCP").ToString() CP = "Sucursal" Else - 'EnvioContacto = ObjVentas.DtResultados.Rows(0)("EnvioContacto").ToString - EnvioDireccion = $"{ObjVentas.DtResultados.Rows(0)("ClienteDireccion").ToString}, COLONIA: {ObjVentas.DtResultados.Rows(0)("ColoniaCliente").ToString}, CP: {ObjVentas.DtResultados.Rows(0)("CPCliente").ToString}" - 'EnviarOficina = ObjVentas.DtResultados.Rows(0)("EnvioDepartamento").ToString - EnviarCalle = ObjVentas.DtResultados.Rows(0)("ClienteDireccion").ToString - EnviarColonia = ObjVentas.DtResultados.Rows(0)("ColoniaCliente").ToString - EnvioCiudad = ObjVentas.DtResultados.Rows(0)("ClienteCiudad").ToString - EnvioTel = ObjVentas.DtResultados.Rows(0)("EnvioTel").ToString - EnvioNoExt = ObjVentas.DtResultados.Rows(0)("ClienteNoExt").ToString - EnvioNoInt = ObjVentas.DtResultados.Rows(0)("ClienteNoInt").ToString - EnvioEstado = ObjVentas.DtResultados.Rows(0)("ClienteEstado").ToString - Pais = ObjVentas.DtResultados.Rows(0)("ClientePais").ToString - 'CP = ObjVentas.DtResultados.Rows(0)("CPCliente").ToString + 'EnvioContacto = ObjVentas.DtResultados.Rows(0)("EnvioContacto").ToString() + EnvioDireccion = $"{ObjVentas.DtResultados.Rows(0)("ClienteDireccion").ToString()}, COLONIA: {ObjVentas.DtResultados.Rows(0)("ColoniaCliente").ToString()}, CP: {ObjVentas.DtResultados.Rows(0)("CPCliente").ToString()}" + 'EnviarOficina = ObjVentas.DtResultados.Rows(0)("EnvioDepartamento").ToString() + EnviarCalle = ObjVentas.DtResultados.Rows(0)("ClienteDireccion").ToString() + EnviarColonia = ObjVentas.DtResultados.Rows(0)("ColoniaCliente").ToString() + EnvioCiudad = ObjVentas.DtResultados.Rows(0)("ClienteCiudad").ToString() + EnvioTel = ObjVentas.DtResultados.Rows(0)("EnvioTel").ToString() + EnvioNoExt = ObjVentas.DtResultados.Rows(0)("ClienteNoExt").ToString() + EnvioNoInt = ObjVentas.DtResultados.Rows(0)("ClienteNoInt").ToString() + EnvioEstado = ObjVentas.DtResultados.Rows(0)("ClienteEstado").ToString() + Pais = ObjVentas.DtResultados.Rows(0)("ClientePais").ToString() + 'CP = ObjVentas.DtResultados.Rows(0)("CPCliente").ToString() CP = "Cliente" End If EnvioContacto = "" @@ -23088,7 +23082,7 @@ Partial Class Ventas End Sub Protected Sub BtnAddClasificacionDetalleModal_Click(sender As Object, e As EventArgs) Dim ObjVentas As New ClsVentas - If ObjVentas.AddClasificacionDetalle(TxtClasificacionDetalle.Text, DdlClasificacionModal.SelectedValue.ToEntero, + If ObjVentas.AddClasificacionDetalle(TxtClasificacionDetalle.Text, DdlClasificacionModal.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then CargaClasificacionesDetalles() DdlTipo.SelectedValueExist(ObjVentas.CveClasificacionDetalle) @@ -23126,7 +23120,7 @@ Partial Class Ventas CambiaMetodoPago33() End Sub Private Sub CambiaMetodoPago33() - CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero) + CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) End Sub @@ -23224,9 +23218,9 @@ Partial Class Ventas Exit Sub End If - Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero + Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero() Dim TipoCambio As Double = TxtTipoCambio.Text.Trim.ToDecimal - If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then + If DdlMoneda.SelectedValue.ToEntero() <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then TipoCambio = 1 Moneda = 1 End If @@ -23243,7 +23237,7 @@ Partial Class Ventas Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim, UsuarioActual.CveEmpresa, CveVenta, 0, 0, Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1), - PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero, CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, + PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(), CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(), CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, TipoDocto:=DdlTipoComprobante.SelectedValue, Kilometraje:=TxtKilometraje.Text.ToDouble) Then MensajeError = "Ocurrió un error al actualizar la información de la cotización" @@ -23258,10 +23252,10 @@ Partial Class Ventas 'RE-INSERTA DETALLES For Each Row As DataRow In TmpDT.Rows - If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero, - Row("PU").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString.ToDouble, Math.Round((Row("Total").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6), - Row("Obs").ToString, Row("Descuento").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero, - PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal, IEPS:=Row("ImporteIEPS").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString) Then + If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(), + Row("PU").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6), + Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), + PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, IEPS:=Row("ImporteIEPS").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString()) Then MensajeError = "Ocurrió un error al guardar las partidas de la cotización" OcurrioError = True Exit For @@ -23270,7 +23264,7 @@ Partial Class Ventas For Each gvr As GridViewRow In GvImpuestosLocales2.Rows If gvr.RowType = DataControlRowType.DataRow Then - If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString.ToEntero, gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble) Then + If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString().ToEntero(), gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble) Then MensajeError = "Ocurrió un error al actualizar los impuestos locales" OcurrioError = True End If @@ -23279,7 +23273,7 @@ Partial Class Ventas 'ORDEN PRODUCCION If UsuarioActual.CveEmpresa.Contiene(126) Then - If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero > 0 Then + If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then MensajeError = "Ocurrió un error al actualizar la orden de producción" OcurrioError = True @@ -23431,23 +23425,23 @@ Partial Class Ventas Dim MetodoPagoDif As Boolean = False If ChkCotProductos.Checked Then For Each row As DataRow In DTSeleccionadas.Rows - If CveMetodoPago <> -1 And row("CveMetodoPago33").ToString.ToEntero <> CveMetodoPago Then + If CveMetodoPago <> -1 And row("CveMetodoPago33").ToString().ToEntero() <> CveMetodoPago Then MetodoPagoDif = True End If - CveMetodoPago = row("CveMetodoPago33").ToString.ToEntero - Cves.Append($"{row("CveVentaDetalle").ToString},") + CveMetodoPago = row("CveMetodoPago33").ToString().ToEntero() + Cves.Append($"{row("CveVentaDetalle").ToString()},") Next For Each row As DataRow In DTSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows - CotizacionesLista.Add(row("CveVenta").ToString.ToEntero) + CotizacionesLista.Add(row("CveVenta").ToString().ToEntero()) Next Else For Each row As DataRow In DTSeleccionadas.Rows - If CveMetodoPago <> -1 And row("CveMetodoPago33").ToString.ToEntero <> CveMetodoPago Then + If CveMetodoPago <> -1 And row("CveMetodoPago33").ToString().ToEntero() <> CveMetodoPago Then MetodoPagoDif = True End If - Cves.Append($"{row("CveVenta").ToString},") - CotizacionesLista.Add(row("CveVenta").ToString.ToEntero) - CveMetodoPago = row("CveMetodoPago33").ToString.ToEntero + Cves.Append($"{row("CveVenta").ToString()},") + CotizacionesLista.Add(row("CveVenta").ToString().ToEntero()) + CveMetodoPago = row("CveMetodoPago33").ToString().ToEntero() Next End If @@ -23457,7 +23451,7 @@ Partial Class Ventas Cves.Remove(Cves.Length - 1, 1) Dim ObjClientes As New ClsClientes - If ObjClientes.GetVentasCotizacionesTotales(CveCliente, Cves.ToString, If(ChkCotProductos.Checked, 2, 1)) Then + If ObjClientes.GetVentasCotizacionesTotales(CveCliente, Cves.ToString(), If(ChkCotProductos.Checked, 2, 1)) Then DtCotizacionesPS = ObjClientes.DtResultados End If ObjClientes.Dispose() @@ -23491,7 +23485,7 @@ Partial Class Ventas For Each Gvr As GridViewRow In GvCotPS.Rows If Gvr.RowType = DataControlRowType.DataRow Then Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk") - Dim CveVentaDetalle As Integer = Gvr.DataKey("CveVentaDetalle").ToEntero + Dim CveVentaDetalle As Integer = Gvr.DataKey("CveVentaDetalle").ToEntero() Dim Drs As DataRow() = dt.Select($"CveVentaDetalle = {CveVentaDetalle}") If Drs.Count > 0 Then Drs(0)("Aplicado") = ChkAplicar.Checked @@ -23503,7 +23497,7 @@ Partial Class Ventas For Each Gvr As GridViewRow In GvCot.Rows If Gvr.RowType = DataControlRowType.DataRow Then Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk") - Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero + Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero() Dim Drs As DataRow() = dt.Select($"CveVenta = {CveVenta}") If Drs.Count > 0 Then Drs(0)("Aplicado") = ChkAplicar.Checked @@ -23525,11 +23519,11 @@ Partial Class Ventas If DtCotizacionesPS IsNot Nothing Then Dim tCantidad As Decimal = 0 For Each Dr As DataRow In DtCotizacionesPS.Select() - tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString)).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString.ToDecimal - AgregarProductoServicio(tCantidad, Dr("CveUM").ToString.ToEntero, Dr("UM").ToString, Dr("CveClasificacion").ToString.ToEntero, Dr("Clasificacion").ToString, - Dr("CvePS").ToString.ToEntero, Dr("PS").ToString, Dr("Obs").ToString, Dr("PU").ToString.ToDecimal, Dr("Descuento").ToString.ToDecimal, - Dr("CveProyecto").ToString.ToEntero, Dr("Proyecto").ToString, Dr("CveSubProyecto").ToString.ToEntero, Dr("SubProyecto").ToString, - CveContratoDetalle:=Dr("CveContratoDetalle").ToString.ToEntero, CveVentaDetalleCotizacion:=Dr("CveVentaDetalle").ToString.ToEntero, SeActualiza:=True) + tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal + AgregarProductoServicio(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(), + Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal, + Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(), + CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero(), CveVentaDetalleCotizacion:=Dr("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True) Next CalculaTotalesVenta() Return True @@ -23561,7 +23555,7 @@ Partial Class Ventas End If Dim ObjClientes As New ClsClientes - If ObjClientes.GetVentasCotizacionesTotales(CveCliente, CveVenta.ToString, 1) Then + If ObjClientes.GetVentasCotizacionesTotales(CveCliente, CveVenta.ToString(), 1) Then DtCotizacionesPS = ObjClientes.DtResultados End If ObjClientes.Dispose() @@ -23617,17 +23611,17 @@ Partial Class Ventas Updatetabs.Update() If ChkRemProductos.Checked Then - CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) Else - CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) End If RegistraScript("$('#DivRemisiones').modal('show');") End Sub Private Sub BtnConsultarRem_Click(sender As Object, e As EventArgs) Handles BtnConsultarRem.Click If ChkRemProductos.Checked Then - CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) Else - CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) End If End Sub Private Sub ChkRemProductos_CheckedChanged(sender As Object, e As EventArgs) Handles ChkRemProductos.CheckedChanged @@ -23638,7 +23632,7 @@ Partial Class Ventas DivFiltroRem.Visible = False GvRem.DataSource = Nothing GvRem.DataBind() - CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) Else GvRemPS.Visible = False GvRem.Visible = True @@ -23646,21 +23640,21 @@ Partial Class Ventas DivFiltroRem.Visible = True GvRemPS.DataSource = Nothing GvRemPS.DataBind() - CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) End If End Sub Private Sub DdlFiltroContrato_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFiltroContrato.SelectedIndexChanged If ChkRemProductos.Checked Then - CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) Else - CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) End If End Sub Private Sub DdlFiltroRemMoneda_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFiltroRemMoneda.SelectedIndexChanged If ChkRemProductos.Checked Then - CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisionesxProducto(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) Else - CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero, DdlFiltroRemMoneda.SelectedValue.ToEntero) + CargaRemisiones(DdlFiltroContrato.SelectedValue.ToEntero(), DdlFiltroRemMoneda.SelectedValue.ToEntero()) End If End Sub Private Sub CargaRemisiones(CveContrato As Integer, CveMoneda As Integer) @@ -23711,7 +23705,7 @@ Partial Class Ventas End If Dim dtSeleccionadas As DataTable = DTRemisiones.FiltraParametros("Aplicado = True") - Dim CveContrato = DTRemisiones.FiltroPrimeroValor("CveContrato", "Aplicado = True").ToEntero + Dim CveContrato = DTRemisiones.FiltroPrimeroValor("CveContrato", "Aplicado = True").ToEntero() If dtSeleccionadas.FiltraParametros("", "", {"Abreviatura"}).Rows.Count > 1 Then Alert("Solo debe seleccionar remisiones de la misma moneda. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -23742,10 +23736,10 @@ Partial Class Ventas CambiaMoneda() DdlUsoCFDI.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveUsoCFDI")) DdlMetodoPago33.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveMetodoPago")) - CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero) + CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) DdlFormaPago33.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveFormaPago")) - DiasCredito = dtSeleccionadas.FiltroPrimeroValor("DiasCredito").ToEntero + DiasCredito = dtSeleccionadas.FiltroPrimeroValor("DiasCredito").ToEntero() EsDiasCreditoFijo = CBool(dtSeleccionadas.FiltroPrimeroValor("EsDiasCreditoFijo")) @@ -23754,15 +23748,15 @@ Partial Class Ventas If DdlSubProyectoDatos.Enabled = True Then DdlSubProyectoDatos.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveSubProyecto")) End If - DdlSucursalCliente.SelectedValueExist(If(dtSeleccionadas.FiltroPrimeroValor("CveClienteSucursal").ToEntero > 0, dtSeleccionadas.FiltroPrimeroValor("CveClienteSucursal"), "-1")) + DdlSucursalCliente.SelectedValueExist(If(dtSeleccionadas.FiltroPrimeroValor("CveClienteSucursal").ToEntero() > 0, dtSeleccionadas.FiltroPrimeroValor("CveClienteSucursal"), "-1")) DdlVendedor.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveVendedor")) CambiaSucursalGeneral() - CargaClienteSucursal(DdlSucursalCliente.SelectedValue.ToEntero) + CargaClienteSucursal(DdlSucursalCliente.SelectedValue.ToEntero()) DdlUsoCFDI.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveUsoCFDI")) DdlMetodoPago33.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveMetodoPago")) - CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero) + CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) DdlFormaPago33.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveFormaPago")) If GvPS.Rows.Count > 0 Then @@ -23784,7 +23778,7 @@ Partial Class Ventas Case "1" 'T O T A L G E N E R A L For Each row As DataRow In dtSeleccionadas.Rows - RemisionesLista.Add(row("CveVenta").ToString.ToEntero) + RemisionesLista.Add(row("CveVenta").ToString().ToEntero()) Next IsTotalxConcepto = False @@ -23793,14 +23787,14 @@ Partial Class Ventas Dim IVA As Double = If(dtSeleccionadas.SUM("Iva") > 0, dtSeleccionadas.SUM("Iva") / dtSeleccionadas.SUM("SubTotal"), 0.16) Dim rowSP As DataRow = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)(0) - AgregarProductoServicio(1, PS("CveUM").ToString.ToEntero, PS("UnidadMedida").ToString, PS("CveClasificacion").ToString.ToEntero, - PS("Clasificacion").ToString, PS("CvePS").ToString.ToEntero, PS("PS").ToString, "", PU, 0, - rowSP("CveProyecto").ToString.ToEntero, rowSP("Proyecto").ToString, rowSP("CveSubProyecto").ToString.ToEntero, rowSP("SubProyecto").ToString, RegeneraIEPS:=True) + AgregarProductoServicio(1, PS("CveUM").ToString().ToEntero(), PS("UnidadMedida").ToString(), PS("CveClasificacion").ToString().ToEntero(), + PS("Clasificacion").ToString(), PS("CvePS").ToString().ToEntero(), PS("PS").ToString(), "", PU, 0, + rowSP("CveProyecto").ToString().ToEntero(), rowSP("Proyecto").ToString(), rowSP("CveSubProyecto").ToString().ToEntero(), rowSP("SubProyecto").ToString(), RegeneraIEPS:=True) Case "2" 'T O T A L X R E M I S I O N For Each row As DataRow In dtSeleccionadas.Rows - RemisionesLista.Add(row("CveVenta").ToString.ToEntero) + RemisionesLista.Add(row("CveVenta").ToString().ToEntero()) Next Dim PS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa)(0) @@ -23808,9 +23802,9 @@ Partial Class Ventas Dim IVA As Double = If(dtSeleccionadas.SUM("Iva") > 0, dtSeleccionadas.SUM("Iva") / dtSeleccionadas.SUM("SubTotal"), 0.16) For Each gvr As GridViewRow In GvRem.Rows If gvr.FCCheckBox("Chk").Checked Then - AgregarProductoServicio(1, PS("CveUM").ToString.ToEntero, PS("UnidadMedida").ToString, PS("CveClasificacion").ToString.ToEntero, - PS("Clasificacion").ToString, PS("CvePS").ToString.ToEntero, PS("PS").ToString, "", gvr.DataKey("SubTotal").ToString.ToDecimal, 0, - rowSP("CveProyecto").ToString.ToEntero, rowSP("Proyecto").ToString, rowSP("CveSubProyecto").ToString.ToEntero, rowSP("SubProyecto").ToString, RegeneraIEPS:=True) + AgregarProductoServicio(1, PS("CveUM").ToString().ToEntero(), PS("UnidadMedida").ToString(), PS("CveClasificacion").ToString().ToEntero(), + PS("Clasificacion").ToString(), PS("CvePS").ToString().ToEntero(), PS("PS").ToString(), "", gvr.DataKey("SubTotal").ToString().ToDecimal, 0, + rowSP("CveProyecto").ToString().ToEntero(), rowSP("Proyecto").ToString(), rowSP("CveSubProyecto").ToString().ToEntero(), rowSP("SubProyecto").ToString(), RegeneraIEPS:=True) End If Next @@ -23820,21 +23814,21 @@ Partial Class Ventas Dim sb As New StringBuilder If ChkRemProductos.Checked Then For Each row As DataRow In dtSeleccionadas.Rows - sb.Append($"{row("CveVentaDetalle").ToString},") + sb.Append($"{row("CveVentaDetalle").ToString()},") Next For Each row As DataRow In dtSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows - RemisionesLista.Add(row("CveVenta").ToString.ToEntero) + RemisionesLista.Add(row("CveVenta").ToString().ToEntero()) Next Else For Each row As DataRow In dtSeleccionadas.Rows - sb.Append($"{row("CveVenta").ToString},") - RemisionesLista.Add(row("CveVenta").ToString.ToEntero) + sb.Append($"{row("CveVenta").ToString()},") + RemisionesLista.Add(row("CveVenta").ToString().ToEntero()) Next End If sb.Remove(sb.Length - 1, 1) - CargaConceptosRemisionPorFacturar(sb.ToString, If(ChkRemProductos.Checked, 2, 1)) + CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1)) End Select Dim CveTipoDocto = DdlTipoComprobante.SelectedValue @@ -23856,20 +23850,20 @@ Partial Class Ventas Dim MetodoPagoDif As Boolean = False For Each Dr As DataRow In dtSeleccionadas.Rows - MensajeRemisiones.AppendFormat("{0} {1}, ", Dr("Folio"), If(Dr("ObsFact").ToString.Length > 0, $"({Dr("ObsFact")})", "")) + MensajeRemisiones.AppendFormat("{0} {1}, ", Dr("Folio"), If(Dr("ObsFact").ToString().Length > 0, $"({Dr("ObsFact")})", "")) ObsOC.AppendFormat("{0}, ", Dr("ObsOC")) ObsPedido.AppendFormat("{0}, ", Dr("ObsPedido")) ObsInv.AppendFormat("{0}, ", Dr("ObsInv")) - If CveMetodoPago <> -1 And Dr("CveMetodoPago33").ToString.ToEntero <> CveMetodoPago Then + If CveMetodoPago <> -1 And Dr("CveMetodoPago33").ToString().ToEntero() <> CveMetodoPago Then MetodoPagoDif = True End If - CveMetodoPago = Dr("CveMetodoPago33").ToString.ToEntero + CveMetodoPago = Dr("CveMetodoPago33").ToString().ToEntero() Next - TxtObsFact.Text = If(MensajeRemisiones.ToString.Length > 0, MensajeRemisiones.ToString.Substring(0, MensajeRemisiones.ToString.Length - 2), "") - TxtOrdenCompra.Text = If(ObsOC.ToString.Length > 0, ObsOC.ToString.Substring(0, ObsOC.ToString.Length - 2), "") - TxtPedidoContrato.Text = If(ObsPedido.ToString.Length > 0, ObsPedido.ToString.Substring(0, ObsPedido.ToString.Length - 2), "") - TxtObsAlmacen.Text = If(ObsInv.ToString.Length > 0, ObsInv.ToString.Substring(0, ObsInv.ToString.Length - 2), "") + TxtObsFact.Text = If(MensajeRemisiones.ToString().Length > 0, MensajeRemisiones.ToString().Substring(0, MensajeRemisiones.ToString().Length - 2), "") + TxtOrdenCompra.Text = If(ObsOC.ToString().Length > 0, ObsOC.ToString().Substring(0, ObsOC.ToString().Length - 2), "") + TxtPedidoContrato.Text = If(ObsPedido.ToString().Length > 0, ObsPedido.ToString().Substring(0, ObsPedido.ToString().Length - 2), "") + TxtObsAlmacen.Text = If(ObsInv.ToString().Length > 0, ObsInv.ToString().Substring(0, ObsInv.ToString().Length - 2), "") UPObservaciones.Update() If MetodoPagoDif Then @@ -23911,7 +23905,7 @@ Partial Class Ventas For Each Gvr As GridViewRow In GvRemPS.Rows If Gvr.RowType = DataControlRowType.DataRow Then Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk") - Dim CveVentaDetalle As Integer = Gvr.DataKey("CveVentaDetalle").ToEntero + Dim CveVentaDetalle As Integer = Gvr.DataKey("CveVentaDetalle").ToEntero() Dim Drs As DataRow() = dt.Select($"CveVentaDetalle = {CveVentaDetalle}") If Drs.Count > 0 Then Drs(0)("Aplicado") = ChkAplicar.Checked @@ -23925,7 +23919,7 @@ Partial Class Ventas For Each Gvr As GridViewRow In GvRem.Rows If Gvr.RowType = DataControlRowType.DataRow Then Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk") - Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero + Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero() Dim Drs As DataRow() = dt.Select($"CveVenta = {CveVenta}") If Drs.Count > 0 Then Drs(0)("Aplicado") = ChkAplicar.Checked @@ -23947,16 +23941,16 @@ Partial Class Ventas If DtRemisionesPS IsNot Nothing Then Dim tCantidad As Decimal = 0 For Each Dr As DataRow In DtRemisionesPS.Select() - tCantidad = If(ChkRemProductos.Checked, GvRemPS.Rows(IndiceGVDataKey(GvRemPS, "CveVentaDetalle", $"{Dr("CveVentaDetalle")}")).FCTextBox("TxtCantidadRem").Text, Dr("Cantidad")).ToString.ToDecimal - AgregarProductoServicio(tCantidad, Dr("CveUM").ToString.ToEntero, Dr("UM").ToString, Dr("CveClasificacion").ToString.ToEntero, Dr("Clasificacion").ToString, - Dr("CvePS").ToString.ToEntero, Dr("PS").ToString, Dr("Obs").ToString, Dr("PU").ToString.ToDecimal, Dr("Descuento").ToString.ToDecimal, - Dr("CveProyecto").ToString.ToEntero, Dr("Proyecto").ToString, Dr("CveSubProyecto").ToString.ToEntero, Dr("SubProyecto").ToString, - CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveContratoDetalle:=Dr("CveContratoDetalle").ToString.ToEntero, - CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString.ToEntero, RegeneraIEPS:=True) + tCantidad = If(ChkRemProductos.Checked, GvRemPS.Rows(IndiceGVDataKey(GvRemPS, "CveVentaDetalle", $"{Dr("CveVentaDetalle")}")).FCTextBox("TxtCantidadRem").Text, Dr("Cantidad")).ToString().ToDecimal + AgregarProductoServicio(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(), + Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal, + Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(), + CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero(), + CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero(), RegeneraIEPS:=True) Next - If DdlFiltroContrato.SelectedValue.ToEntero > 0 Then - CveContrato = DdlFiltroContrato.SelectedValue.ToEntero + If DdlFiltroContrato.SelectedValue.ToEntero() > 0 Then + CveContrato = DdlFiltroContrato.SelectedValue.ToEntero() End If End If @@ -23981,13 +23975,13 @@ Partial Class Ventas 'End If Dim ObjClientes As New ClsClientes - If ObjClientes.GetVentasRemisionesTotales(CveCliente, CveVenta.ToString, 1) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then + If ObjClientes.GetVentasRemisionesTotales(CveCliente, CveVenta.ToString(), 1) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then LnkFacturarRemision.Visible = True If ThCantidadFacturadaRem.Visible Then LnkFacturarRemision.ToolTip = "¿Seguro que desea facturar lo pendiente por facturar de la remisión?" End If - If DdlMoneda.SelectedValue.ToEntero = 1 Then + If DdlMoneda.SelectedValue.ToEntero() = 1 Then TrConversionDolares.Visible = True ChkConvertirDolares.Enabled = True TxtTipoCambioDlls.Enabled = True @@ -24016,14 +24010,14 @@ Partial Class Ventas HdnIVAOriginal.Value = TxtIVA.Text CreaDTVentas() - CargaRemisiones(If(DdlContrato.SelectedValue.ToEntero > 0, DdlContrato.SelectedValue.ToEntero, -1), DdlMoneda.SelectedValue.ToEntero) + CargaRemisiones(If(DdlContrato.SelectedValue.ToEntero() > 0, DdlContrato.SelectedValue.ToEntero(), -1), DdlMoneda.SelectedValue.ToEntero()) Dim DrRemision As DataRow() = DTRemisiones.Select($"CveVenta = {CveVenta}") If DrRemision.Count > 0 Then DrRemision(0)("Aplicado") = "True" End If DTRemisiones.AcceptChanges() RemisionesLista.Add(CveVenta) - CargaConceptosRemisionPorFacturar(CveVenta.ToString, 1) + CargaConceptosRemisionPorFacturar(CveVenta.ToString(), 1) BtnEmitirImprimir.Text = "Facturar" DdlTipoComprobante.SelectedValue = "Ing" @@ -24053,14 +24047,14 @@ Partial Class Ventas HdnIVAOriginal.Value = TxtIVA.Text CreaDTVentas() - CargaRemisiones(If(DdlContrato.SelectedValue.ToEntero > 0, DdlContrato.SelectedValue.ToEntero, -1), DdlMoneda.SelectedValue.ToEntero) + CargaRemisiones(If(DdlContrato.SelectedValue.ToEntero() > 0, DdlContrato.SelectedValue.ToEntero(), -1), DdlMoneda.SelectedValue.ToEntero()) Dim DrRemision As DataRow() = DTRemisiones.Select($"CveVenta = {CveVenta}") If DrRemision.Count > 0 Then DrRemision(0)("Aplicado") = "True" End If DTRemisiones.AcceptChanges() RemisionesLista.Add(CveVenta) - CargaConceptosRemisionPorFacturar(CveVenta.ToString, 1) + CargaConceptosRemisionPorFacturar(CveVenta.ToString(), 1) If TmpDT.Rows.Count = 0 Then Alert("No hay conceptos por facturar de esta remisión. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -24084,16 +24078,16 @@ Partial Class Ventas TabGenerales.Enabled = True Updatetabs.Update() - CargaPedidos2(DdlMonedaModalPedido2.SelectedValue.ToEntero, If(ChkMostrarProductosPedido2.Checked, 0, 1)) + CargaPedidos2(DdlMonedaModalPedido2.SelectedValue.ToEntero(), If(ChkMostrarProductosPedido2.Checked, 0, 1)) RegistraScript("$('#DivPedidos2').modal('show');") End Sub Private Sub BtnConsultaPedido_Click(sender As Object, e As EventArgs) Handles BtnConsultaPedido.Click - CargaPedidos2(DdlMonedaModalPedido2.SelectedValue.ToEntero, If(ChkMostrarProductosPedido2.Checked, 0, 1)) + CargaPedidos2(DdlMonedaModalPedido2.SelectedValue.ToEntero(), If(ChkMostrarProductosPedido2.Checked, 0, 1)) End Sub Protected Sub ChkMostrarProductosPedido2_CheckedChanged(sender As Object, e As EventArgs) MostrarProductoPedido2() - CargaPedidos2(DdlMonedaModalPedido2.SelectedValue.ToEntero, If(ChkMostrarProductosPedido2.Checked, 0, 1)) + CargaPedidos2(DdlMonedaModalPedido2.SelectedValue.ToEntero(), If(ChkMostrarProductosPedido2.Checked, 0, 1)) End Sub Private Sub MostrarProductoPedido2() If ChkMostrarProductosPedido2.Checked Then @@ -24179,29 +24173,29 @@ Partial Class Ventas If DdlSubProyectoDatos.Enabled Then 'validación, cuando los pedido2 sean de una sucursal y el usuario solo tenga acceso a otra, deberá tener priodidad la sucursal de la que solo se factura DdlSubProyectoDatos.SelectedValueExist(DTSeleccionadas.FiltroPrimeroValor("CveSubProyecto")) End If - DdlSucursalCliente.SelectedValueExist(If(DTSeleccionadas.FiltroPrimeroValor("CveClienteSucursal").ToEntero > 0, DTSeleccionadas.FiltroPrimeroValor("CveClienteSucursal"), "-1")) + DdlSucursalCliente.SelectedValueExist(If(DTSeleccionadas.FiltroPrimeroValor("CveClienteSucursal").ToEntero() > 0, DTSeleccionadas.FiltroPrimeroValor("CveClienteSucursal"), "-1")) DdlVendedor.SelectedValueExist(DTSeleccionadas.FiltroPrimeroValor("CveVendedor")) CambiaSucursalGeneral() - CargaClienteSucursal(DdlSucursalCliente.SelectedValue.ToEntero) + CargaClienteSucursal(DdlSucursalCliente.SelectedValue.ToEntero()) Dim Cves As New StringBuilder If ChkMostrarProductosPedido2.Checked Then For Each row As DataRow In DTSeleccionadas.Rows - Cves.Append($"{row("CveVentaDetalle").ToString},") + Cves.Append($"{row("CveVentaDetalle").ToString()},") Next For Each row As DataRow In DTSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows - Pedidos2Lista.Add(row("CveVenta").ToString.ToEntero) + Pedidos2Lista.Add(row("CveVenta").ToString().ToEntero()) Next Else For Each row As DataRow In DTSeleccionadas.Rows - Cves.Append($"{row("CveVenta").ToString},") - Pedidos2Lista.Add(row("CveVenta").ToString.ToEntero) + Cves.Append($"{row("CveVenta").ToString()},") + Pedidos2Lista.Add(row("CveVenta").ToString().ToEntero()) Next End If Cves.Remove(Cves.Length - 1, 1) Dim ObjVentas As New ClsVentas - If ObjVentas.GetVentasPedidos2Totales(CveCliente, Cves.ToString, If(ChkMostrarProductosPedido2.Checked, 2, 1)) Then + If ObjVentas.GetVentasPedidos2Totales(CveCliente, Cves.ToString(), If(ChkMostrarProductosPedido2.Checked, 2, 1)) Then DtPedidos2PS = ObjVentas.DtResultados End If ObjVentas.Dispose() @@ -24227,15 +24221,15 @@ Partial Class Ventas Dim ObsInv As New StringBuilder MensajePedidos2.Append("Pedidos: ") For Each Dr As DataRow In DTSeleccionadas.Rows - MensajePedidos2.AppendFormat("{0} {1}, ", Dr("Folio"), If(Dr("ObsFact").ToString.Length > 0, $"({Dr("ObsFact")})", "")) + MensajePedidos2.AppendFormat("{0} {1}, ", Dr("Folio"), If(Dr("ObsFact").ToString().Length > 0, $"({Dr("ObsFact")})", "")) ObsOC.AppendFormat("{0}, ", Dr("ObsOC")) ObsPedido.AppendFormat("{0}, ", Dr("ObsPedido")) ObsInv.AppendFormat("{0}, ", Dr("ObsInv")) Next - TxtObsFact.Text = If(MensajePedidos2.ToString.Length > 0, MensajePedidos2.ToString.Substring(0, MensajePedidos2.ToString.Length - 2), "") - TxtOrdenCompra.Text = If(ObsOC.ToString.Length > 0, ObsOC.ToString.Substring(0, ObsOC.ToString.Length - 2), "") - TxtPedidoContrato.Text = If(ObsPedido.ToString.Length > 0, ObsPedido.ToString.Substring(0, ObsPedido.ToString.Length - 2), "") - TxtObsAlmacen.Text = If(ObsInv.ToString.Length > 0, ObsInv.ToString.Substring(0, ObsInv.ToString.Length - 2), "") + TxtObsFact.Text = If(MensajePedidos2.ToString().Length > 0, MensajePedidos2.ToString().Substring(0, MensajePedidos2.ToString().Length - 2), "") + TxtOrdenCompra.Text = If(ObsOC.ToString().Length > 0, ObsOC.ToString().Substring(0, ObsOC.ToString().Length - 2), "") + TxtPedidoContrato.Text = If(ObsPedido.ToString().Length > 0, ObsPedido.ToString().Substring(0, ObsPedido.ToString().Length - 2), "") + TxtObsAlmacen.Text = If(ObsInv.ToString().Length > 0, ObsInv.ToString().Substring(0, ObsInv.ToString().Length - 2), "") UpModalPedidos2.Update() @@ -24252,7 +24246,7 @@ Partial Class Ventas For Each Gvr As GridViewRow In GvPedidos2SinFacturarPS.Rows If Gvr.RowType = DataControlRowType.DataRow Then Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk") - Dim CveVentaDetalle As Integer = Gvr.DataKey("CveVentaDetalle").ToEntero + Dim CveVentaDetalle As Integer = Gvr.DataKey("CveVentaDetalle").ToEntero() Dim Drs As DataRow() = dt.Select($"CveVentaDetalle = {CveVentaDetalle}") If Drs.Count > 0 Then Drs(0)("Aplicado") = ChkAplicar.Checked @@ -24264,7 +24258,7 @@ Partial Class Ventas For Each Gvr As GridViewRow In GvPedidos2SinFacturar.Rows If Gvr.RowType = DataControlRowType.DataRow Then Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk") - Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero + Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero() Dim Drs As DataRow() = dt.Select($"CveVenta = {CveVenta}") If Drs.Count > 0 Then Drs(0)("Aplicado") = ChkAplicar.Checked @@ -24278,12 +24272,12 @@ Partial Class Ventas If DtPedidos2PS IsNot Nothing Then Dim tCantidad As Decimal = 0 For Each Dr As DataRow In DtPedidos2PS.Select() - tCantidad = If(ChkMostrarProductosPedido2.Checked, GvPedidos2SinFacturarPS.Rows(IndiceGVDataKey(GvPedidos2SinFacturarPS, "CveVentaDetalle", $"{Dr("CveVentaDetalle")}")).FCTextBox("TxtCantidadPedido2").Text, Dr("Cantidad")).ToString.ToDecimal - AgregarProductoServicio(tCantidad, Dr("CveUM").ToString.ToEntero, Dr("UM").ToString, Dr("CveClasificacion").ToString.ToEntero, Dr("Clasificacion").ToString, - Dr("CvePS").ToString.ToEntero, Dr("PS").ToString, Dr("Obs").ToString, Dr("PU").ToString.ToDecimal, Dr("Descuento").ToString.ToDecimal, - Dr("CveProyecto").ToString.ToEntero, Dr("Proyecto").ToString, Dr("CveSubProyecto").ToString.ToEntero, Dr("SubProyecto").ToString, - CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, - CveVentaDetallePedido2:=Dr("CveVentaDetalle").ToString.ToEntero, RegeneraIEPS:=True) + tCantidad = If(ChkMostrarProductosPedido2.Checked, GvPedidos2SinFacturarPS.Rows(IndiceGVDataKey(GvPedidos2SinFacturarPS, "CveVentaDetalle", $"{Dr("CveVentaDetalle")}")).FCTextBox("TxtCantidadPedido2").Text, Dr("Cantidad")).ToString().ToDecimal + AgregarProductoServicio(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(), + Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal, + Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(), + CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), + CveVentaDetallePedido2:=Dr("CveVentaDetalle").ToString().ToEntero(), RegeneraIEPS:=True) Next CalculaTotalesVenta() Return True @@ -24309,7 +24303,7 @@ Partial Class Ventas CreaDTVentas() Dim ObjVentas As New ClsVentas - If ObjVentas.GetVentasPedidos2Totales(CveCliente, CveVenta.ToString, 1) Then + If ObjVentas.GetVentasPedidos2Totales(CveCliente, CveVenta.ToString(), 1) Then DtPedidos2PS = ObjVentas.DtResultados End If ObjVentas.Dispose() @@ -24347,16 +24341,16 @@ Partial Class Ventas ' 'Actualizo los parametros de la venta ' If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.Replace(",", "").ToDouble, LblDescuentos.Text.ToDouble, TxtIVA.Text.ToDouble, TxtIEPS.Text.ToDouble, TxtTotal.Text.ToDouble, - ' DdlMoneda.SelectedValue.ToEntero, TxtTipoCambio.Text.Trim.ToDouble, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim, UsuarioActual.CveEmpresa, CveVenta, DdlMetodoPago.SelectedValue.ToEntero, - ' DdlFormaPago.SelectedValue.ToEntero, TxtNumCtaPago.Text.Trim, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero, CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero) Then + ' DdlMoneda.SelectedValue.ToEntero(), TxtTipoCambio.Text.Trim.ToDouble, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim, UsuarioActual.CveEmpresa, CveVenta, DdlMetodoPago.SelectedValue.ToEntero(), + ' DdlFormaPago.SelectedValue.ToEntero(), TxtNumCtaPago.Text.Trim, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(), CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero()) Then ' OcurrioError = True ' End If ' 'Cargo de nueva cuenta el detalle de Ventas (Conceptos) ' For Each Row As DataRow In TmpDT.Rows - ' If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero, - ' Row("PU").ToString.ToDouble, Row("IVA").ToString.ToDouble, Math.Round((Row("Total").ToString.ToDouble * (1 + Row("IVA").ToString.ToDouble)), 6), - ' Row("Obs").ToString, Row("Descuento").ToString.ToDouble, Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero, IEPS:=Row("IEPS").ToString.ToDouble) Then + ' If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(), + ' Row("PU").ToString().ToDouble, Row("IVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble * (1 + Row("IVA").ToString().ToDouble)), 6), + ' Row("Obs").ToString(), Row("Descuento").ToString().ToDouble, Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), IEPS:=Row("IEPS").ToString().ToDouble) Then ' OcurrioError = True ' Exit For ' End If @@ -24532,7 +24526,7 @@ Partial Class Ventas PlazoCobranzaRemision = ObjCliente.PlazoCobranzaRemision 'TxtNumCtaPago.Text = ObjCliente.NumCtaPago TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString - DdlTipoRetencion.SelectedValueExist(ObjCliente.DtResultados(0)("CveTipoRetencion").ToString) + DdlTipoRetencion.SelectedValueExist(ObjCliente.DtResultados(0)("CveTipoRetencion").ToString()) End If End If ObjCliente.Dispose() @@ -24630,7 +24624,7 @@ Partial Class Ventas Return Retorno End Function Private Sub EmitirDocumentoNuevo(TipoDoctoNuevo As String) - If GvPagos.Rows.Count = 0 And UsuarioActual.Empresa.Funcionalidad(558).ToEntero = 1 And RBLPago.SelectedValue.ToEntero = 2 Then + If GvPagos.Rows.Count = 0 And UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And RBLPago.SelectedValue.ToEntero() = 2 Then Alert("No se puede facturar hasta que se haya especificado detalladamente la forma de pago", TipoMensaje.MsgAdvertencia) Else Dim FolioFijo As Integer = 0 @@ -24668,17 +24662,17 @@ Partial Class Ventas 'CARGA LO PENDIENTE POR FACTURAR DE PEDIDO AUTORIZACION If DdlTipoComprobante.SelectedValue = "PA" Then ' que tome el folio fijo de la autorización - FolioFijo = TxtFolio.Text.ToEntero + FolioFijo = TxtFolio.Text.ToEntero() ViewState("FolioActual") = FolioFijo ViewState("EstablecioFolio") = True - TxtFolio.Text = FolioFijo.ToString + TxtFolio.Text = FolioFijo.ToString() End If Dim TipoDoctoViejo As String = DdlTipoComprobante.SelectedValue DdlTipoComprobante.SelectedValue = TipoDoctoNuevo - TxtFecha.Text = Now.ToString + TxtFecha.Text = Now.ToString() TxtFechaPago.Text = If(TipoDoctoViejo = "Rem" AndAlso EsDiasCreditoFijo, Now.AddDays(DiasCredito), If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza))).ToShortDateString - TxtFechaEjecucion.Text = Now.ToString + TxtFechaEjecucion.Text = Now.ToString() 'VALIDAR QUE NO SE HAYA REMISIONADO If TipoDoctoViejo = "PA" Then @@ -24721,7 +24715,7 @@ Partial Class Ventas If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then If ObjVentas.DtResultados.Rows.Count > 0 Then - FechaVencimientoAnterior = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString.ToDate.ToShortDateString + FechaVencimientoAnterior = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDate.ToShortDateString Else ErrorTrans = True End If @@ -24764,7 +24758,7 @@ Partial Class Ventas Private Sub CalculaUsados(Optional DtUsadosDevolucion As DataTable = Nothing) If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then - If ViewState("CargoUsado").ToString = "False" Then + If ViewState("CargoUsado").ToString() = "False" Then Exit Sub End If @@ -24790,7 +24784,7 @@ Partial Class Ventas For Each drow As DataRow In TmpDTCalculo If DTCvePSCostos IsNot Nothing Then For Each drow2 As DataRow In DTCvePSCostos.Rows - If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then + If drow("CvePS").ToString().ToEntero() = drow2("CvePSCargo").ToString().ToEntero() Then drow("Eliminar") = 1 Exit For End If @@ -24843,16 +24837,16 @@ Partial Class Ventas DTPSTemp.Columns.Add("SubProyecto", GetType(String)) For Each DrowPartidas As DataRow In TmpDTCalculo - Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero + Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero() If CveTamanioTemp > 0 Then Dim DTTamanioTemp As New DataTable - Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString.ToEntero + Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString().ToEntero() - CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString.ToEntero - SubProyectoPSA = DrowPartidas("SubProyecto").ToString + CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString().ToEntero() + SubProyectoPSA = DrowPartidas("SubProyecto").ToString() Dim ObjProductosServicios As New ClsProductosServicios() @@ -24872,9 +24866,9 @@ Partial Class Ventas For Each dRowUpdate As DataRow In DTPSTemp.Rows - If (dRowUpdate("CvePS").ToString.ToEntero = CvePsTemp) Then - dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString.ToDecimal + DrowPartidas("Cantidad").ToString.ToDecimal - dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString.ToDecimal + ImporteCargo + If (dRowUpdate("CvePS").ToString().ToEntero() = CvePsTemp) Then + dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString().ToDecimal + DrowPartidas("Cantidad").ToString().ToDecimal + dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString().ToDecimal + ImporteCargo End If Next @@ -24883,7 +24877,7 @@ Partial Class Ventas Else Dim dRowNuevo As DataRow = DTPSTemp.NewRow - dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString.ToDecimal + dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal dRowNuevo("PU") = Cargo dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA dRowNuevo("UnidadMedida") = UnidadMedidaPSA @@ -24892,8 +24886,8 @@ Partial Class Ventas dRowNuevo("CvePS") = CvePsTemp dRowNuevo("PS") = PSPSA - dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString.ToEntero - dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString + dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString().ToEntero() + dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString() DTPSTemp.Rows.Add(dRowNuevo) DTPSTemp.AcceptChanges() @@ -24904,18 +24898,18 @@ Partial Class Ventas For Each drowPsTamaños As DataRow In DTPSTemp.Rows Modalidad = "A" - If drowPsTamaños("PU").ToString.ToDecimal > 0 Then + If drowPsTamaños("PU").ToString().ToDecimal > 0 Then Dim CveVentaDetalleDevolucion As Integer = -1 If DtUsadosDevolucion IsNot Nothing AndAlso DtUsadosDevolucion.Rows.Count > 0 Then - CveVentaDetalleDevolucion = DtUsadosDevolucion.FiltroPrimeroValor("CveVentaDetalle", $"CvePS = {drowPsTamaños("CvePS").ToString.ToEntero}").ToEntero() + CveVentaDetalleDevolucion = DtUsadosDevolucion.FiltroPrimeroValor("CveVentaDetalle", $"CvePS = {drowPsTamaños("CvePS").ToString().ToEntero()}").ToEntero() End If - AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString, - drowPsTamaños("CveClasificacion").ToString.ToEntero, drowPsTamaños("Clasificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero, - drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero, - drowPsTamaños("SubProyecto").ToString, CveVentaDetalle:=CveVentaDetalleDevolucion) + AgregarProductoServicio(drowPsTamaños("Cantidad").ToString().ToEntero(), drowPsTamaños("CveUnidadMedida").ToString().ToEntero(), drowPsTamaños("UnidadMedida").ToString(), + drowPsTamaños("CveClasificacion").ToString().ToEntero(), drowPsTamaños("Clasificacion").ToString(), drowPsTamaños("CvePS").ToString().ToEntero(), + drowPsTamaños("PS").ToString(), "", drowPsTamaños("PU").ToString().ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString().ToEntero(), + drowPsTamaños("SubProyecto").ToString(), CveVentaDetalle:=CveVentaDetalleDevolucion) End If Next @@ -24926,17 +24920,17 @@ Partial Class Ventas Dim Resultado As Boolean = True If ClienteEsDistribuidor Then - 'If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 Then - ' Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero + 'If UsuarioActual.Empresa.Funcionalidad(533).ToEntero() > 0 Then + ' Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero() Dim ObjAcum As New ClsAcumuladores(SqlTransaccion) For Each drow As DataRow In TmpDT.Rows - If drow("CveTamaño").ToString.ToEntero > 0 Then - Dim TempDTAcums = GlobalDTAcumTamaños.FiltraParametros("CvePSCargo = " & drow("CvePS").ToString) + If drow("CveTamaño").ToString().ToEntero() > 0 Then + Dim TempDTAcums = GlobalDTAcumTamaños.FiltraParametros("CvePSCargo = " & drow("CvePS").ToString()) If TempDTAcums IsNot Nothing AndAlso TempDTAcums.Rows.Count > 0 Then - If Not ObjAcum.DistribuidorMovtosAdd(CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, CveVenta, UsuarioActual.CveUsuario, + If Not ObjAcum.DistribuidorMovtosAdd(CveCliente, drow("Cantidad").ToString().ToEntero(), drow("CveTamaño").ToString().ToEntero(), 2, CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then Resultado = False Exit For @@ -24967,18 +24961,18 @@ 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 = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=Row("CvePS").ToString().ToEntero()).FiltroPrimero("") If DrPS IsNot Nothing Then - If DrPS("IVA").ToString.Contiene("-1", "") Then + If DrPS("IVA").ToString().Contiene("-1", "") Then Row("PorcentajeIVA") = PorcentajeIVA Else Row("PorcentajeIVA") = DrPS("IVA") End If - Dim TotalCalculableImpuestos As Decimal = (Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal) - Row("Descuento").ToString.ToDecimal - Dim TotalCalculableImpuestosIVA As Decimal = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString.ToDecimal) + Dim TotalCalculableImpuestos As Decimal = (Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal) - Row("Descuento").ToString().ToDecimal + Dim TotalCalculableImpuestosIVA As Decimal = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString().ToDecimal) - Row("IVA") = Row("PorcentajeIVA").ToString.ToDouble - Row("ImporteIVA") = (Row("PorcentajeIVA").ToString.ToDouble * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) + Row("IVA") = Row("PorcentajeIVA").ToString().ToDouble + Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDouble * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) End If Else Row("IVA") = 0 @@ -25161,7 +25155,7 @@ Partial Class Ventas obj.sale_type_service = "0" & Row.DataKey("TipoServicio").ToString().Trim() obj.sale_total = Row.DataKey("Total").ToString().ToDecimal() obj.sale_discount = Row.DataKey("Descuento").ToString().ToDecimal() - obj.sale_id = ObjFactura.CveVenta.ToString + obj.sale_id = ObjFactura.CveVenta.ToString() 'DATOS DEL PRODUCTO obj.product_code = Row.DataKey("IdProductoPolizaVirtual").ToString().Trim() @@ -25447,4 +25441,7 @@ Partial Class Ventas Public EsPUModificado As Boolean = False End Class + Protected Sub btnupEventoBitacora_Click(sender As Object, e As EventArgs) + CargaEventoBitacora() + End Sub End Class \ No newline at end of file diff --git a/Ventas/eFacturas.aspx.vb b/Ventas/eFacturas.aspx.vb index 93eaabdda..2fe02e10e 100644 --- a/Ventas/eFacturas.aspx.vb +++ b/Ventas/eFacturas.aspx.vb @@ -48,7 +48,7 @@ Partial Class Ventas_eFacturas txtFechaF.Text = Now.ToShortDateString 'txtFechaI.Text.ToDate.AddMonths(1).AddDays(-1).ToShortDateString - Destino = String.Format("{0}Ventas\", UsuarioActual.Empresa.Ruta) 'string.format("{0}Empresas\{1}\Compras\", AppDomain.CurrentDomain.BaseDirectory ,UsuarioActual.CveEmpresa & "\Compras\" + Destino = String.Format("{0}Ventas\", UsuarioActual.Empresa.Ruta) 'string.format("{0}Empresas\{1}\Compras\", ModExtensiones.DirectorioBaseEmpresas ,UsuarioActual.CveEmpresa & "\Compras\" Ejecutable = String.Format("{0}\Utilerias\eeeFacturas.exe", AppDomain.CurrentDomain.BaseDirectory) Form.DefaultButton = BtnConsultar.UniqueID @@ -354,7 +354,7 @@ Partial Class Ventas_eFacturas Protected Sub LnkNoRecibidas_Click(sender As Object, e As EventArgs) Handles LnkNoRecibias.Click Dim dt As New DataTable - Dim Ruta As String = String.Format("{0}\Empresas\{1}\Compras\NoRecibidas-{1}.xml", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa) + Dim Ruta As String = String.Format("{0}\Empresas\{1}\Compras\NoRecibidas-{1}.xml", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) Dim Str As New StringBuilder If IO.File.Exists(Ruta) Then dt.ReadXml(Ruta) @@ -440,8 +440,8 @@ Partial Class Ventas_eFacturas 'Dim ObjProcess As Process = Nothing 'Dim Mensajes As String = "" - 'Dim EjecutableUtilerias = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Utilerias\UtileriasAD.exe") - 'Dim Folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Empresas\") + 'Dim EjecutableUtilerias = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Utilerias\UtileriasAD.exe") + 'Dim Folder = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas\") 'Dim error1 As Boolean = False 'Dim en As New CultureInfo("en-US") 'Dim fechai = txtFechaI.Text.Trim.ToDate.ToString("d", en) @@ -464,7 +464,7 @@ Partial Class Ventas_eFacturas Dim ObjProcess As Process = Nothing Dim Mensajes As String = "" Dim EjecutableUtilerias = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Utilerias\ADSUtilerias.exe") - Dim Folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Empresas\") + Dim Folder = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas\") Dim error1 As Boolean = False Dim en As New CultureInfo("en-US") Dim fechai = txtFechaI.Text.Trim.ToDate.ToString("d", en) diff --git a/WEB.rar b/WEB.rar new file mode 100644 index 000000000..f1421731b Binary files /dev/null and b/WEB.rar differ diff --git a/asmx/WSApp.asmx b/asmx/WSApp.asmx index 92d0c128c..461d63f35 100644 --- a/asmx/WSApp.asmx +++ b/asmx/WSApp.asmx @@ -1,5 +1,5 @@ -<%@ WebService Language="VB" Class="WSApp" %> - +<%@ WebService Language="VB" Class="WSApp" %> + Option Explicit On Imports System.Data @@ -22,9 +22,9 @@ Imports Newtonsoft.Json.Linq Public Class WSApp - Inherits System.Web.Services.WebService + Inherits System.Web.Services.WebService #Region "G L O B A L - D T" - + Public ReadOnly Property UrlSitio As String Get Return ConfigurationManager.AppSettings("UrlSitio").ToString @@ -73,10 +73,10 @@ Public Class WSApp 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then Dim P As New ClsSubProyectos - If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = P.DtResultados + If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = P.DtResultados P.Dispose() - Dim msg As String = "aqui no se carga subproyectos" + Dim msg As String = "aqui no se carga subproyectos" msg.GuardaLog() End If @@ -97,8 +97,8 @@ Public Class WSApp End If End Get - Set(ByVal value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTSubProyectos{0}", CveEmpresa) + Set(ByVal value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTSubProyectos{0}", CveEmpresa) Application(AppNombre) = value End Set End Property @@ -425,9 +425,9 @@ Public Class WSApp Set(value As DataTable) Application("GlobalDTMotivosHorasExtras") = value End Set - End Property + End Property #End Region - + Public Property CveEmpresa As Integer = 143 Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario) @@ -448,7 +448,7 @@ Public Class WSApp Else End If ObjEmpresa.Dispose() - End Sub + End Sub #Region "M E T O D O S - S E R V I C I O" Public Function ValidaUsuario(CveUsuario As Integer) As Usuario Dim UsuarioActual As Usuario = Nothing @@ -728,12 +728,12 @@ Public Class WSApp If UsuarioActual IsNot Nothing Then 'If UsuarioActual.TienePermisoProceso(159) Then - ' Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, CveEmpresa, Server.MapPath("/")) + ' Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, CveEmpresa, ModExtensiones.DirectorioBaseEmpresas) ' Retorno = Factura.CancelarDocumento() 'Else ' Retorno.Mensajes.Add("Este usuario no tiene permiso para cancelar documento") 'End If - Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, CveEmpresa, Server.MapPath("/")) + Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, CveEmpresa, ModExtensiones.DirectorioBaseEmpresas) If String.IsNullOrEmpty(Factura.FolioFiscal) Then Factura.FolioFiscal = "" End If @@ -783,9 +783,9 @@ Public Class WSApp Retorno.Mensajes.Add("Ocurrió un error al eliminar el movimiento. Por favor vuelva a intetar.") End If ObjInv.Dispose() - End Sub + End Sub #End Region - + #Region "P E D I D O S" Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre Dim Timbre As New CFDITimbre @@ -899,9 +899,9 @@ Public Class WSApp i += 1 Next Return Timbre - End Function + End Function #End Region - + #Region "R E M I S I O N E S" Private Function CreaFactura(ByRef Retorno As Modelos.Factura.MMensajeFactura, CveCliente As Integer, CveAlmacen As Integer, CveSubProyecto As Integer, CveMoneda As Integer, UsuarioActual As Usuario, Observaciones As String, ListaPS As List(Of MVentaProductos)) As Modelos.Factura If CveSubProyecto <= 0 Then @@ -923,7 +923,7 @@ Public Class WSApp End If End If Dim ObjFactura = New Modelos.Factura(UsuarioActual) - ObjFactura.DirectorioServidor = Server.MapPath("/") + ObjFactura.DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas Dim ObjFolios As New ClsGralFolios() If ObjFolios.GetFolios("Rem", UsuarioActual.CveEmpresa) Then @@ -1062,12 +1062,12 @@ Public Class WSApp ObjFactura.Total = Total ObjFactura.Timbre = PreParaTimbre(ObjFactura) - ObjFactura.CveContratoSecciones = "" - - 'BORRAR - ObjFactura.DtRecepcionUsados = New DataTable - ObjFactura.DtRecepcionUsados.Columns.Add("CvePS", GetType(Integer)) - + ObjFactura.CveContratoSecciones = "" + + 'BORRAR + ObjFactura.DtRecepcionUsados = New DataTable + ObjFactura.DtRecepcionUsados.Columns.Add("CvePS", GetType(Integer)) + Catch ex As Exception Retorno.Mensajes.Add(ex.ToString()) Return Nothing @@ -1159,8 +1159,8 @@ Public Class WSApp TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String)) TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String)) TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String)) - TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) - + TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) + TmpDT.Columns.Add("CveTamaño", GetType(Double)) Try @@ -1430,9 +1430,9 @@ Public Class WSApp End Try ObjVentas.Dispose() Return strBody.ToString - End Function + End Function #End Region - + End Class Namespace WebServiceAppModels2 diff --git a/asmx/WSGPSApp.asmx b/asmx/WSGPSApp.asmx index c834e2cd5..fe22ec1bd 100644 --- a/asmx/WSGPSApp.asmx +++ b/asmx/WSGPSApp.asmx @@ -1,4 +1,4 @@ -<%@ WebService Language="VB" Class="WSGPSApp" %> +<%@ WebService Language="VB" Class="WSGPSApp" %> Option Strict On Imports System.Web @@ -31,8 +31,8 @@ Public Class WSGPSApp Inherits System.Web.Services.WebService Private Const LongValue As Long = &H100000000 - Public Property Credentials As AuthHeader - + Public Property Credentials As AuthHeader + #Region "G L O B A L S" Property GlobalDTDispositivos(CveCliente As Integer) As DataTable Get @@ -90,7 +90,7 @@ Public Class WSGPSApp Set(value As DataTable) Application("GlobalDTDispositivosUsuarios") = value End Set - End Property + End Property #End Region @@ -528,7 +528,7 @@ Public Class WSGPSApp End If If CveEmpresa > 0 Then Dim Archivo As String = String.Format("{0}{1}", CveImagenDispositivo, FileExtension) - Dim Directorio As String = String.Format("{0}\Empresas\{1}\Dispositivos\{2}\Imagenes\", AppDomain.CurrentDomain.BaseDirectory, CveEmpresa, item.CveDispositivo) + Dim Directorio As String = String.Format("{0}\Empresas\{1}\Dispositivos\{2}\Imagenes\", ModExtensiones.DirectorioBaseEmpresas, CveEmpresa, item.CveDispositivo) If Not Directory.Exists(Directorio) Then Directory.CreateDirectory(Directorio) End If @@ -936,28 +936,28 @@ Public Class WSGPSApp Return Retorno - End Function - + End Function + Public Function GetArrastre(CveDispositivo As Integer) As String - Dim Retorno As String = "[]" - Using ObjGPS As New ClsGPS - If ObjGPS.GPS_ArrastreGET(CveDispositivo) Then - Retorno = ObjGPS.DtResultados.DataTableToJSONIPP() - End If + Dim Retorno As String = "[]" + Using ObjGPS As New ClsGPS + If ObjGPS.GPS_ArrastreGET(CveDispositivo) Then + Retorno = ObjGPS.DtResultados.DataTableToJSONIPP() + End If End Using Return Retorno - End Function + End Function Public Function ActivarDesactivarArrastre(CveDispositivo As Integer, Activo As Boolean) As Boolean - Dim Retorno As Boolean = False - Using ObjGPS As New ClsGPS - Retorno = ObjGPS.GPS_ArrastreActivarDesactivar(CveDispositivo, Activo) + Dim Retorno As Boolean = False + Using ObjGPS As New ClsGPS + Retorno = ObjGPS.GPS_ArrastreActivarDesactivar(CveDispositivo, Activo) End Using Return Retorno - End Function - + End Function + Public Function GetTrayectos(CveCliente As Integer) As String Dim Retorno As String = "[]" @@ -965,8 +965,8 @@ Public Class WSGPSApp Return Retorno - End Function - + End Function + Public Function GetEstatusTrayectos(CveCliente As Integer) As String Dim Retorno As String = "[]" @@ -974,7 +974,7 @@ Public Class WSGPSApp Return Retorno - End Function + End Function Public Function GetEstatusTrayectosHistorial(CveCliente As Integer) As String Dim Retorno As String = "[]" @@ -982,7 +982,7 @@ Public Class WSGPSApp Return Retorno - End Function + End Function Public Function GetTrayectosEstatusHistorial(CveTrayecto As Integer) As String Dim Retorno As String = "[]" @@ -990,8 +990,8 @@ Public Class WSGPSApp Return Retorno - End Function - + End Function + #Region "F U N C I O N E S" Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario) Dim ObjEmpresa As New ClsSisEmpresas() @@ -1107,7 +1107,7 @@ Public Class WSGPSApp OnError("Acceso no autorizado", New SoapException("Unauthorized", SoapException.ClientFaultCode)) Return False End If - End Function + End Function #End Region End Class Namespace ADGPSModels diff --git a/asmx/WSSIGApp.asmx b/asmx/WSSIGApp.asmx index b675f7c84..71c1f2945 100644 --- a/asmx/WSSIGApp.asmx +++ b/asmx/WSSIGApp.asmx @@ -1366,7 +1366,7 @@ Public Class WSSIGApp If ObjEventoBitacora.AddEventoBitacora(Ent.Descripcion, FileExtension, Ent.CveUsuario, Ent.CveEmpresa, CveOC:=Ent.CveOC, Prioridad:=Ent.Prioridad.ToEntero()) Then If Ent.Imagen1 <> "" Then Try - Dim FileURL As String = String.Format("{0}Empresas\{1}\OI\", AppDomain.CurrentDomain.BaseDirectory, Ent.CveEmpresa) + Dim FileURL As String = String.Format("{0}Empresas\{1}\OI\", ModExtensiones.DirectorioBaseEmpresas, Ent.CveEmpresa) If Not IO.Directory.Exists(FileURL) Then IO.Directory.CreateDirectory(FileURL) End If @@ -1824,7 +1824,7 @@ Public Class WSSIGApp End If End If Dim ObjFactura = New Modelos.Factura(UsuarioActual) - ObjFactura.DirectorioServidor = Server.MapPath("/") + ObjFactura.DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas Dim ObjFolios As New ClsGralFolios() If ObjFolios.GetFolios(TipoDocto, UsuarioActual.CveEmpresa) Then @@ -2600,7 +2600,7 @@ Public Class WSSIGApp If ObjOI.AddEventoBitacora(Bit.Descripcion, FileExtension, Ent.CveUsuario, Ent.CveEmpresa, CveOC:=ObjOC.CveOrdenCompra, Prioridad:=Bit.CvePrioridad) Then If Bit.Imagen1 <> "" Then Try - Dim FileURL As String = String.Format("{0}Empresas\{1}\OI\", AppDomain.CurrentDomain.BaseDirectory, Ent.CveEmpresa) + Dim FileURL As String = String.Format("{0}Empresas\{1}\OI\", ModExtensiones.DirectorioBaseEmpresas, Ent.CveEmpresa) If Not IO.Directory.Exists(FileURL) Then IO.Directory.CreateDirectory(FileURL) End If @@ -3707,7 +3707,7 @@ Public Class WSSIGApp Exit For Else If Not String.IsNullOrEmpty(FileExtension) Then - Dim Directorio As String = String.Format("{0}\Empresas\{1}\OI\OI{2}{3}", AppDomain.CurrentDomain.BaseDirectory, item.CveEmpresa, ObjBitacora.CveEvento.ToString(), FileExtension) + Dim Directorio As String = String.Format("{0}\Empresas\{1}\OI\OI{2}{3}", ModExtensiones.DirectorioBaseEmpresas, item.CveEmpresa, ObjBitacora.CveEvento.ToString(), FileExtension) File.WriteAllBytes(Directorio, Convert.FromBase64String(item.Base64Archivo)) End If End If @@ -3738,7 +3738,7 @@ Public Class WSSIGApp If Not TieneError Then If Not String.IsNullOrEmpty(FileExtension) Then - Dim Directorio As String = String.Format("{0}\Empresas\{1}\OI\OI{2}{3}", AppDomain.CurrentDomain.BaseDirectory, item.CveEmpresa, ObjBitacora.CveEvento.ToString(), FileExtension) + Dim Directorio As String = String.Format("{0}\Empresas\{1}\OI\OI{2}{3}", ModExtensiones.DirectorioBaseEmpresas, item.CveEmpresa, ObjBitacora.CveEvento.ToString(), FileExtension) File.WriteAllBytes(Directorio, Convert.FromBase64String(item.Base64Archivo)) End If End If @@ -3768,7 +3768,7 @@ Public Class WSSIGApp If CveArchivo > 0 Then If Not String.IsNullOrEmpty(FileExtension) Then Dim Archivo As String = String.Format("{0}{1}", CveArchivo, FileExtension) - Dim Directorio As String = String.Format("{0}\Empresas\{1}\Acercamientos\{2}\Imagenes\", AppDomain.CurrentDomain.BaseDirectory, item.CveEmpresa, item.CveAcercamiento) + Dim Directorio As String = String.Format("{0}\Empresas\{1}\Acercamientos\{2}\Imagenes\", ModExtensiones.DirectorioBaseEmpresas, item.CveEmpresa, item.CveAcercamiento) If Not Directory.Exists(Directorio) Then Directory.CreateDirectory(Directorio) End If @@ -4177,8 +4177,8 @@ Public Class WSSIGApp ' ' ' - Dim idgrupo2 = -1 - Dim FechaI = FechaInicio.ToString("yyyy/MM/dd") + Dim idgrupo2 = -1 + Dim FechaI = FechaInicio.ToString("yyyy/MM/dd") Dim FechaF = FechaFin.ToString("yyyy/MM/dd") Select Case AgrupadoPor @@ -4224,12 +4224,12 @@ Public Class WSSIGApp Public Function GetRepAcercamientosRechazos(CveEmpresa As Integer, CveVendedor As Integer, FechaInicio As DateTime, FechaFin As DateTime) As String Dim Retorno = "[]" - Dim cveTipoProceso = -1 - Dim idgrupo1 = 1 - Dim idgrupo2 = -1 - Dim FechaI = FechaInicio.ToString("yyyy/MM/dd") - Dim FechaF = FechaFin.ToString("yyyy/MM/dd") - Dim cveMedioCaptacion = -1 + Dim cveTipoProceso = -1 + Dim idgrupo1 = 1 + Dim idgrupo2 = -1 + Dim FechaI = FechaInicio.ToString("yyyy/MM/dd") + Dim FechaF = FechaFin.ToString("yyyy/MM/dd") + Dim cveMedioCaptacion = -1 Dim cveProbabilidadAcercamiento = -1 Using ObjCRM As New ClsCRM If ObjCRM.RepAcercamientosEtapas(CveEmpresa, cveTipoProceso, idgrupo1, idgrupo2, FechaI, FechaF, CveVendedor, cveMedioCaptacion, cveProbabilidadAcercamiento) Then diff --git a/asmx/WsTSoft.asmx b/asmx/WsTSoft.asmx index 626fdbb83..5c10a6d20 100644 --- a/asmx/WsTSoft.asmx +++ b/asmx/WsTSoft.asmx @@ -71,10 +71,12 @@ Public Class WsTSoft ObjGPS.DtResultados.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() Next End If + If ObjGPS.DtResultados IsNot Nothing AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then + ObjPos.Lat = ObjGPS.DtResultados.Rows("0")("Lat").ToString + ObjPos.Lng = ObjGPS.DtResultados.Rows("0")("Lng").ToString + ObjPos.Direccion = ObjGPS.DtResultados.Rows("0")("Direccion").ToString + End If - ObjPos.Lat = ObjGPS.DtResultados.Rows("0")("Lat").ToString - ObjPos.Lng = ObjGPS.DtResultados.Rows("0")("Lng").ToString - ObjPos.Direccion = ObjGPS.DtResultados.Rows("0")("Direccion").ToString Catch ex As Exception ObjPos.CurrentError = "No se pudo obtener la posición." OnError("Ocurrió un error al asignar las direcciones", ex) diff --git a/vwd.webinfo b/vwd.webinfo index 6b76e11e1..71c73829a 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -48,6 +48,12 @@ + + + + + +