diff --git a/.gitignore b/.gitignore
index a7b361013..9b5134ac3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,7 +14,7 @@ LogTimbrado.txt
*.user
*.userosscache
*.sln.docstates
-
+vwd.webinfo
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb
index d125b8e70..b94097442 100644
--- a/App_Code/ClsBancos.vb
+++ b/App_Code/ClsBancos.vb
@@ -2839,11 +2839,11 @@ Public Class ClsBancos
End Try
Return Retorno
- End Function
+ End Function
#End Region
-
+
#Region "B A N C O S - P A G O - E L E C T R O N I C O"
- Public Function GetLayoutPagos(CveCuenta As Integer, CveBLE As Integer, Tipo As String) As Boolean
+ Public Function GetLayoutPagos(CveCuenta As Integer, CveBLE As Integer, Tipo As String, Optional PorGrupos As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Banc_LayoutPagos")
@@ -2852,6 +2852,7 @@ Public Class ClsBancos
.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta
.Add("@CveBLE", SqlDbType.Int).Value = CveBLE
.Add("@Tipo", SqlDbType.VarChar).Value = Tipo
+ .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos
End With
Try
diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb
index ff6b8012f..f5e63f696 100644
--- a/App_Code/ClsContabilidad.vb
+++ b/App_Code/ClsContabilidad.vb
@@ -1962,9 +1962,28 @@ Public Class ClsContabilidad
#End Region
#Region " C O N T A B I L I D A D - C O N C E P T O S - C O N T A B L E S "
- Public Function GetConta_ConceptosContables() As Boolean
+ Public Function GetConta_CuentasDataContabilidad(CveCuenta As Integer, CveEmpresa As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Conta_CuentasDataContabilidadGet")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener lod datos de Concepto Contables.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+ End Function
+ Public Function GetConta_ConceptosContables(Optional Estado As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Conta_ConceptosContablesGet")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Estado", SqlDbType.Int).Value = Estado
+ End With
Try
SqlAdapter.Fill(Data)
Retorno = True
@@ -4605,7 +4624,7 @@ Public Class ClsContabilidad
Public Function UpdateCuenta(CveCuenta As Integer, Nombre As String, Tipo As String, CtaMayor As Integer, CveMoneda As Integer, Optional DigAgrupador As Integer = -1,
Optional CveAgrupadorSAT As Integer = -1, Optional NomIdioma As String = "", Optional CveConceptoAdmin As Integer = -1, Optional CveProveedor As Integer = -1,
Optional CveCliente As Integer = -1, Optional CveClasificacion As Integer = -1, Optional PorcentajeImpuesto As Decimal = -1,
- Optional CveBancoCuenta As Integer = -1) As Boolean
+ Optional CveBancoCuenta As Integer = -1, Optional CveAlmacen As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Conta_UpdateCuentas")
@@ -4625,6 +4644,7 @@ Public Class ClsContabilidad
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
.Add("@PorcentajeImpuesto", SqlDbType.Money).Value = PorcentajeImpuesto
.Add("@CveBancoCuenta", SqlDbType.Int).Value = CveBancoCuenta
+ .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
End With
Try
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 47d1faa3d..7aa34bbe4 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -3495,7 +3495,9 @@ Public Class ClsPaginas
End If
If UsuarioActual.CveEmpresa = 42 Then
Me.MasterPageFile = "~/Masters/Site42.master"
- End If
+ End If
+
+ ADSSession.ADSSessionConfig.SessionManager(ADSSession.OpcionSession.CambiarModulo, Nothing, -1, "", Request.Url.ToString())
'If Me.Request.ServerVariables("http_user_agent").ToLower.Contains("safari") AndAlso Page.ClientTarget <> "uplevel" Then Page.ClientTarget = "uplevel" 'Código agregado para que muestre bién el menu, en chrome
End If
End Sub
@@ -4687,6 +4689,7 @@ Public Class ClsPaginas
PaginaDict.Add("/PV/PVRepCompras.aspx".ToUpper(), 272)
PaginaDict.Add("/PV/PVRepVentasCompras.aspx".ToUpper(), 273)
+ PaginaDict.Add("/Bancos/PagoElectronicoGrupos.aspx".ToUpper(), -1)
diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb
index 6a418e56b..9c6ca77d2 100644
--- a/App_Code/ClsProductosServicios.vb
+++ b/App_Code/ClsProductosServicios.vb
@@ -1639,7 +1639,8 @@ Public Class ClsProductosServicios
#Region "Precios Lista"
- Public Function GetPSPreciosLista(CveEmpresa As Integer, CvePrecioLista As Integer, Optional CveClasificacion As Integer = -1, Optional CvePS As Integer = -1, Optional CveProveedor As Integer = -1, Optional Estado As Integer = -1, Optional CveMarca As Integer = -1) As Boolean
+ Public Function GetPSPreciosLista(CveEmpresa As Integer, CvePrecioLista As Integer, Optional CveClasificacion As Integer = -1, Optional CvePS As Integer = -1,
+ Optional CveProveedor As Integer = -1, Optional Estado As Integer = -1, Optional Marcas As String = "-1") As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PSPrecioListaGet")
With SqlAdapter.SelectCommand.Parameters
@@ -1649,7 +1650,7 @@ Public Class ClsProductosServicios
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
.Add("@Estado", SqlDbType.Int).Value = Estado
- .Add("@CveMarca", SqlDbType.Int).Value = CveMarca
+ .Add("@Marcas", SqlDbType.VarChar).Value = Marcas
End With
Try
SqlAdapter.Fill(Data)
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index 3a91601be..5c98d9754 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -4359,7 +4359,8 @@ Public Class ClsVentas
Return retorno
End Function
Public Function GetRepMetasVendedores(FechaMesActual As String, CveEmpresa As Integer, CveVendedor As Integer, CveCategoria As Integer, CveClasificacion As Integer,
- CveClasificacion2 As Integer, CveMarca As Integer, CveSubProyecto As Integer, CveCliente As Integer) As Boolean
+ CveClasificacion2 As Integer, CveMarca As Integer, CveSubProyecto As Integer, CveCliente As Integer,
+ Optional GrupoSuperior As Integer = 0) As Boolean
Dim retorno As Boolean = False
DataAdapter("PA_Vta_MetasVendedores", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
@@ -4372,6 +4373,7 @@ Public Class ClsVentas
.Add("@CveMarca", SqlDbType.Int).Value = CveMarca
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
+ .Add("@GrupoSuperior", SqlDbType.Int).Value = GrupoSuperior
End With
Try
SqlAdapter.Fill(Data)
diff --git a/App_Code/Usuario.vb b/App_Code/Usuario.vb
index 39b921fe9..11d6e8718 100644
--- a/App_Code/Usuario.vb
+++ b/App_Code/Usuario.vb
@@ -115,6 +115,7 @@ Namespace ADSSession
getListasession = 3 'solo lectura
CambiarEmpresa = 4
getSession = 5
+ CambiarModulo = 6
End Enum
Public Enum OpcionHub As Integer
agregar = 1
@@ -158,7 +159,7 @@ Namespace ADSSession
HttpContext.Current.Session(strsessionDpage) = value
End Set
End Property
- Public Shared Function SessionManager(opcion As OpcionSession, Optional obj As ADSSessionObj = Nothing, Optional CveEmpresa As Integer = -1, Optional SessionID As String = Nothing) As Object
+ Public Shared Function SessionManager(opcion As OpcionSession, Optional obj As ADSSessionObj = Nothing, Optional CveEmpresa As Integer = -1, Optional SessionID As String = Nothing, Optional modulo As String = "") As Object
SyncLock strsessionid 'todo el codigo que este dentro de este corchete no se ejecutara mas de una vez al mismo tiempo en el servidor
If _dicSessionobj Is Nothing Then
_dicSessionobj = New ConcurrentDictionary(Of String, ADSSessionObj)
@@ -194,6 +195,18 @@ Namespace ADSSession
obj.CveEmpresa = CveEmpresa
End If
retorno = obj
+
+ Case OpcionSession.CambiarModulo
+ If Not IsNothing(HttpContext.Current) AndAlso Not IsNothing(HttpContext.Current.Session) AndAlso Not IsNothing(HttpContext.Current.Session(strsessionid)) Then
+ obj = DirectCast(HttpContext.Current.Session(strsessionid), ADSSessionObj)
+ obj.Modulo = modulo
+ obj.LastPostback = DateTime.Now
+ If _dicSessionobj.TryGetValue(obj.SessionID, obj) Then
+ obj.Modulo = modulo
+ obj.LastPostback = DateTime.Now
+ End If
+ retorno = obj
+ End If
End Select
Catch ex As Exception
retorno = Nothing
@@ -227,6 +240,8 @@ Namespace ADSSession
End Sub
Public Property CveUsuario As Integer
Public Property CveEmpresa As Integer
+ Public Property Modulo As String
+ Public Property LastPostback As DateTime
Protected Property _SessionID As String
Private Property _ipAdrres As String
Public ReadOnly Property IpAddres As String
diff --git a/Bancos/PagoElectronicoGrupos.aspx b/Bancos/PagoElectronicoGrupos.aspx
new file mode 100644
index 000000000..f1752353f
--- /dev/null
+++ b/Bancos/PagoElectronicoGrupos.aspx
@@ -0,0 +1,640 @@
+<%@ Page Title="Bancos - Pago Electrónico" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PagoElectronicoGrupos.aspx.vb" Inherits="Bancos_PagoElectronicoGrupos" %>
+
+<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
+
+
+
+
+
+
+
+ Pago Electrónico
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bancos/PagoElectronicoGrupos.aspx.vb b/Bancos/PagoElectronicoGrupos.aspx.vb
new file mode 100644
index 000000000..1bbca81d9
--- /dev/null
+++ b/Bancos/PagoElectronicoGrupos.aspx.vb
@@ -0,0 +1,2777 @@
+Option Explicit On
+Option Strict On
+
+Imports System.Data
+Imports Extensiones
+Imports System.IO
+Imports Ionic.Zip
+Imports Microsoft.Reporting.WebForms
+
+Partial Class Bancos_PagoElectronicoGrupos
+ Inherits ClsPaginas
+ Private Shared missing As Object = System.Reflection.Missing.Value
+
+#Region "PROPIEDADES"
+ Private Property HeaderTexto As String
+ Get
+ Return ViewState("HeaderTexto").ToString
+ End Get
+ Set(value As String)
+ ViewState("HeaderTexto") = value
+ End Set
+ End Property
+ Private Property DetalleTexto As String
+ Get
+ Return ViewState("DetalleTexto").ToString
+ End Get
+ Set(value As String)
+ ViewState("DetalleTexto") = value
+ End Set
+ End Property
+ Private Property TrailerTexto As String
+ Get
+ Return ViewState("TrailerTexto").ToString
+ End Get
+ Set(value As String)
+ ViewState("TrailerTexto") = value
+ End Set
+ End Property
+ Private Property TextoCompleto As String
+ Get
+ Return ViewState("TextoCompleto").ToString
+ End Get
+ Set(value As String)
+ ViewState("TextoCompleto") = value
+ End Set
+ End Property
+ Private Property Vacio As String
+ Get
+ Return ViewState("Vacio").ToString
+ End Get
+ Set(value As String)
+ ViewState("Vacio") = value
+ End Set
+ End Property
+ Private Property NombreArchivo As String
+ Get
+ Return ViewState("NombreArchivo").ToString
+ End Get
+ Set(value As String)
+ ViewState("NombreArchivo") = value
+ End Set
+ End Property
+ Private Property DTPendientes As DataTable
+ Get
+ Return CType(ViewState("DTPendientes"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DTPendientes") = value
+ End Set
+ End Property
+ Private Property DTProveedores As DataTable
+ Get
+ Return CType(ViewState("DTProveedores"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DTProveedores") = value
+ End Set
+ End Property
+ Private Property DTFyE As DataTable
+ Get
+ Return CType(ViewState("DTFyE"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DTFyE") = value
+ End Set
+ End Property
+ Private Property DTReportes As DataTable
+ Get
+ Return CType(ViewState("DTReportes"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DTReportes") = value
+ End Set
+ End Property
+ Private Property DTPendienteActual As DataTable
+ Get
+ Return CType(ViewState("DTPendienteActual"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DTPendienteActual") = value
+ End Set
+ End Property
+ Private Property DTEnviadas As DataTable
+ Get
+ Return CType(ViewState("DTEnviadas"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DTEnviadas") = value
+ End Set
+ End Property
+ Private ReadOnly Property PadCeros As Char
+ Get
+ Return "0"c
+ End Get
+ End Property
+ Private Property TotalAcumulado As Double
+ Get
+ Return ViewState("TotalAcumulado").ToString.ToDouble
+ End Get
+ Set(value As Double)
+ ViewState("TotalAcumulado") = value
+ End Set
+ End Property
+ Private Property CveCuenta As Integer
+ Get
+ Return ViewState("CveCuenta").ToString.ToEntero
+ End Get
+ Set(value As Integer)
+ ViewState("CveCuenta") = value
+ End Set
+ End Property
+ Private Property DtPago As DataTable
+ Get
+ Return CType(ViewState("DtPago"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DtPago") = value
+ End Set
+ End Property
+ Private Property DtAlta As DataTable
+ Get
+ Return CType(ViewState("DtAlta"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DtAlta") = value
+ End Set
+ End Property
+ Private Property CorreoNotificacionesEmpresa As String
+ Get
+ Return ViewState("CorreoNotificacionesEmpresa").ToString
+ End Get
+ Set(value As String)
+ ViewState("CorreoNotificacionesEmpresa") = value
+ End Set
+ End Property
+ Private Property TipoMasiva As Integer
+ Get
+ Return ViewState("TipoMasiva").ToString.ToEntero
+ End Get
+ Set(value As Integer)
+ ViewState("TipoMasiva") = value
+ End Set
+ End Property
+#End Region
+
+ Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
+
+ If Not IsPostBack Then
+
+ ViewState("NombreArchivo") = ""
+ ViewState("HeaderTexto") = ""
+ ViewState("DetalleTexto") = ""
+ ViewState("TrailerTexto") = ""
+ ViewState("Vacio") = ""
+ ViewState("TotalAcumulado") = 0
+ CveCuenta = -1
+ TipoMasiva = 1
+
+ txtFechaI.Text = Date.Now.ToShortDateString
+ txtFechaF.Text = Date.Now.ToShortDateString
+
+ CargaCuentas()
+ CargaProveedores()
+ InicializaDatosGenerales()
+
+
+ End If
+
+
+ End Sub
+
+
+#Region " C A R G A - D A T O S "
+ Private Sub CargaCuentas()
+ DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("UsaLayoutGrupos = 1")
+ DdlCuenta.DataBind()
+ UpFiltros.Update()
+
+ DdlCuentaReportes.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("UsaLayoutGrupos = 1")
+ DdlCuentaReportes.DataBind()
+ UpFiltrosReporte.Update()
+ End Sub
+ Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
+ CveCuenta = DdlCuenta.SelectedValue.ToEntero
+ CargaDatos()
+ End Sub
+ Private Sub CargaDatos()
+
+ 'Carga datos en DT´s
+ Dim ObjBancos As New ClsBancos
+ If ObjBancos.GetLayoutPagos(CveCuenta, -1, DdlTipoGeneracion.SelectedValue, PorGrupos:=True) Then
+ DTPendientes = ObjBancos.DtResultados
+ Else
+ DTPendientes = Nothing
+ End If
+
+ If ObjBancos.GetLayoutPagosEnviados(CveCuenta, 1, DdlTipoGeneracion.SelectedValue, "-1", "-1") Then
+ DTEnviadas = ObjBancos.DtResultados
+ Else
+ DTEnviadas = Nothing
+ End If
+ ObjBancos.Dispose()
+
+
+ 'Carga GvPendientes
+ If DTPendientes IsNot Nothing AndAlso DTPendientes.Rows.Count > 0 Then
+ GvPendientes.DataSource = DTPendientes
+ End If
+ GvPendientes.DataBind()
+
+ 'Carga GvEnviadas
+ If DTEnviadas IsNot Nothing AndAlso DTEnviadas.Rows.Count > 0 Then
+ GvEnviadas.DataSource = DTEnviadas
+ End If
+ GvEnviadas.DataBind()
+
+ UpGVDatos.Update()
+
+ If DTPendientes IsNot Nothing AndAlso DTPendientes.Rows.Count > 0 Then
+ CargaDatosInformativos()
+ End If
+
+ End Sub
+ Private Sub CargaDatosInformativos()
+ Dim Altas = 0
+ Dim Interbancarias = 0
+ Dim Bancomer = 0
+
+ Dim Movimientos = 0
+ Dim Importe = 0.0
+
+ For Each dr As DataRow In DTPendientes.Rows
+
+ If dr("EstatusCtaDeposito").ToString <> "True" Then
+ Continue For
+ End If
+
+ If dr("CveCuentaDeposito").ToString <> "" And dr("EstatusPagoElectronicoGrupos").ToString <> "True" And dr("AltaCuenta").ToString = "1" Then
+ Altas += 1
+ If dr("BancoNombre").ToString.ToUpper.Contains("BANCOMER") OrElse dr("BancoNombre").ToString.ToUpper.Contains("BBVA") Then
+ Bancomer += 1
+ Else
+ Interbancarias += 1
+ End If
+
+ ElseIf dr("CveCuentaDeposito").ToString.ToEntero > 0 Then
+ Movimientos += 1
+ Importe += dr("Abonado").ToString.ToDouble
+ End If
+ Next
+
+ LbNumeroAltas.Text = Altas.ToString
+ LbNumeroInterbancarias.Text = Interbancarias.ToString
+ LbNumeroBancomer.Text = Bancomer.ToString
+
+ LbNumeroMovimientos.Text = Movimientos.ToString
+ LbImporteMovimientos.Text = Importe.ToString.FormatoNumero
+
+ UpComandosGeneracion.Update()
+ End Sub
+#End Region
+
+#Region " DATOS GENERALES LAYOUT "
+ Private Sub InicializaDatosGenerales()
+
+ If UsuarioActual.CveEmpresa = 66 Then
+ CorreoNotificacionesEmpresa = "pagos@gluyasconstrucciones.com"
+ ElseIf UsuarioActual.CveEmpresa = 13 Then
+ CorreoNotificacionesEmpresa = "signotificaciones@adssistemas.mx"
+ Else
+ CorreoNotificacionesEmpresa = "signotificaciones@adssistemas.mx"
+ End If
+
+ End Sub
+#End Region
+
+
+#Region " GENERA Y DESCARGA ARCHIVO (TXT) "
+ Protected Sub CrearTXT()
+ Dim path As String = Server.MapPath(String.Format("~/Empresas/{0}/Layout/{1}.txt", UsuarioActual.CveEmpresa, NombreArchivo))
+ ' Create or overwrite the file.
+ Dim fs As FileStream = File.Create(path)
+
+ ' Add text to the file.
+ Dim info As Byte() = New UTF8Encoding(True).GetBytes(TextoCompleto)
+ fs.Write(info, 0, info.Length)
+ fs.Close()
+ End Sub
+ Private Sub DescargarArchivo()
+ With HttpContext.Current.Response
+ .Clear()
+ .Buffer = True
+ .ContentType = "textplain"
+ .AddHeader("Content-Disposition", String.Format("attachment;filename={0}{1}.txt", NombreArchivo, Date.Now.ToString("ddMMyyyy")))
+ .Charset = "UTF-8"
+ .ContentEncoding = Encoding.Default
+ .Write(TextoCompleto)
+ .Flush()
+ .End()
+ End With
+ End Sub
+ Private Sub DescargaZip()
+ Dim path As String = Server.MapPath(String.Format("~/Empresas/{0}/Layout/", UsuarioActual.CveEmpresa))
+ Response.Clear()
+ Dim ElZip As ZipFile = New ZipFile()
+ Using ElZip
+ ElZip.AddDirectory(path)
+ ElZip.Save(Response.OutputStream)
+ End Using
+ Response.AddHeader("Content-Disposition", "attachment; filename=LayoutPagos.zip")
+ Response.ContentType = "application/zip"
+ Response.End()
+ End Sub
+ Private Function CreaArchivo(Tipo As Integer) As Boolean
+
+
+ DirectoryExistsCreate(String.Format("{0}Layout", UsuarioActual.Empresa.Ruta))
+
+ NombreArchivo = String.Format("{2}{1}{0}.txt", UsuarioActual.CveUsuario, Date.Now.ToString("yyyyMMdd-HH-mm"), If(Tipo = 1, "LAYOUTPAGO", "LAYOUTALTA"))
+
+ Dim path As String = String.Format("{0}Layout\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo)
+ Dim fs As FileStream = File.Create(path)
+
+ ' Add text to the file.
+ Dim info As Byte() = New UTF8Encoding(True).GetBytes(TextoCompleto)
+ fs.Write(info, 0, info.Length)
+ fs.Close()
+
+ Return True
+ End Function
+ Private Function GuardaTXT() As Boolean
+ Dim Retorno = True
+ Try
+ Dim Ruta = ""
+ Dim FileName As String = Path.GetFileName(FUTxt.PostedFile.FileName)
+ NombreArchivo = FileName
+ Dim Extension As String = Path.GetExtension(FUTxt.PostedFile.FileName)
+ Dim FolderPath As String = String.Format("{0}Empresas\", Request.ApplicationPath)
+ Dim FilePath As String = Server.MapPath(FolderPath + FileName)
+ FUTxt.SaveAs(FilePath)
+ NombreArchivo = FilePath
+ Catch ex As Exception
+ Retorno = False
+ End Try
+
+ Return Retorno
+ End Function
+#End Region
+
+#Region " TAB PRINCIPAL "
+
+ Protected Sub GvPendientes_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.DataRow Then
+
+ 'Colorea GV
+ If e.Row.DBCampo("RazonSocial").ToString = "" Then
+ e.Row.BackColor = Drawing.Color.WhiteSmoke
+ Else
+ If e.Row.DBCampo("EstatusPagoElectronicoGrupos").ToString <> "True" Then
+ e.Row.BackColor = Drawing.Color.LightSalmon
+ e.Row.ToolTip = "Cuenta Deposito aun sin dar de Alta."
+ End If
+
+ If e.Row.DBCampo("CveProveedor").ToString.ToEntero > 0 Then
+ e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
+ Else
+ e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal"))
+ End If
+
+ End If
+
+ If Not e.Row.DBCampo("CveCuentaDeposito").ToString.ToEntero > 0 Then
+ e.Row.Cells(0).BackColor = Drawing.Color.Red
+ e.Row.ToolTip = "Sin Cuenta Deposito asignada"
+ End If
+
+ If e.Row.DBCampo("EstatusCtaDeposito").ToString = "False" Then
+ e.Row.Cells(0).BackColor = Drawing.Color.Red
+ e.Row.ToolTip = "Cuenta Deposito INACTIVA"
+ End If
+
+ e.Row.FCHyperLink("HLImporte").NavigateUrl = String.Format("IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
+
+ End If
+ End Sub
+ Protected Sub GvEnviadas_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ 'Colorea GV
+ If e.Row.DBCampo("CveIE").ToString = "" Then
+ e.Row.BackColor = Drawing.Color.LightGray
+
+
+ 'Si la fecha de generacion del archivo es diferente de hoy activamos el boton REGENERAR
+ 'If e.Row.DBCampo("Fecha").ToDate.ToShortDateString <> Date.Now.ToShortDateString Then
+ ' e.Row.FCLinkButton("LBRegenerar").Visible = True
+ 'End If
+ If DTEnviadas.MAX("FueConciliado", String.Format("CveLayoutEnvio = {0}", e.Row.DBCampo("CveLayoutEnvio"))).ToEntero > 0 Then
+ e.Row.ToolTip = "El movimiento no se puede regenerar ya que alguno de sus movimientos ya fue conciliado"
+ Else
+ e.Row.FCLinkButton("LBRegenerar").Visible = True
+ End If
+
+ Else
+
+ If e.Row.DBCampo("FueConciliado") = "1" Then
+ e.Row.ForeColor = Drawing.Color.Red
+ e.Row.ToolTip = "Este movimiento ya fue conciliado."
+ End If
+
+ If e.Row.DBCampo("CveProveedor").ToString.ToEntero > 0 Then
+ e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
+ Else
+ e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal"))
+ End If
+ e.Row.FCHyperLink("HLDetalle").NavigateUrl = String.Format("IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
+ End If
+ End If
+ End Sub
+ Protected Sub LBRegenerar_Click(sender As Object, e As EventArgs)
+
+ Dim CveBLE = CType(sender, LinkButton).CommandArgument.ToEntero
+ Dim DtRegenerar As New DataTable
+
+ Dim ObjBancos As New ClsBancos
+ If ObjBancos.GetLayoutPagos(CveCuenta, CveBLE, "-1") Then
+ DtRegenerar = ObjBancos.DtResultados
+ Else
+ DtRegenerar = Nothing
+ End If
+ ObjBancos.Dispose()
+
+ If DtRegenerar IsNot Nothing Then
+ GeneraPago(DtRegenerar)
+ Else
+ Alert("Ocurrió un error al obtener los datos para generar el archivo. Por favor vuelva a intentar.", TipoMensaje.MsgError)
+ End If
+
+
+ End Sub
+
+#End Region
+
+
+
+ 'RECARGA DATOS
+#Region " RECARGA DATOS "
+
+ Private Sub RecargaDatos()
+ CargaDatos()
+ TipoMasiva = 1
+ DdlTipoCargaMasiva.SelectedValueExist("1")
+ CargaProveedores()
+ End Sub
+
+#End Region
+
+
+
+ 'ARMA Y GENERA TXT'S
+
+
+#Region "ALTA PROVEEDORES"
+
+
+ Protected Sub BtnAltas_Click(sender As Object, e As EventArgs)
+
+ If Not DdlCuenta.SelectedValue.ToEntero > 0 Then
+ Alert("Primero debe seleccionar una Cuenta", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ AltaProveedores(1)
+ End Sub
+
+ Private Sub AltaProveedores(TipoAlta As Integer)
+
+
+ NombreArchivo = ""
+
+ Dim RegistrosAltaBancomer As New StringBuilder
+ Dim RegistrosAltaInterbancario As New StringBuilder
+
+ Dim NombreArchivoBancomer As String = ""
+ Dim NombreArchivoInterbancario As String = ""
+
+ Dim CeroRelleno As Char = "0"c
+ Dim EspacioRelleno As Char = Chr(32)
+ Dim ErrorLayout = False
+
+
+ Dim DtCuentasPendientesTemp As DataTable = DTPendientes.Copy
+ DtCuentasPendientesTemp.CaseSensitive = False
+
+ Dim DtCuentasPendientesBancomer As DataTable = DtCuentasPendientesTemp.FiltraParametros($" (EstatusPagoElectronicoGrupos IS NULL OR EstatusPagoElectronicoGrupos = False) AND (CuentaPago like '%BBVA%' OR CuentaPago like '%BANCOMER%' ) ", "", {"CuentaPago", "NumCuenta", "AbreviaturaMon", "RazonSocial", "CveProveedor", "CveBanco"})
+ Dim DtCuentasPendientesInterbancarias As DataTable = DtCuentasPendientesTemp.FiltraParametros($" (EstatusPagoElectronicoGrupos IS NULL OR EstatusPagoElectronicoGrupos = False) AND NOT (CuentaPago like '%BBVA%' OR CuentaPago like '%BANCOMER%' ) ", "", {"CuentaPago", "NumCuenta", "AbreviaturaMon", "RazonSocial", "CveProveedor", "CveBanco"})
+
+
+ If DtCuentasPendientesBancomer.Rows.Count > 0 Then
+ For Each dRow As DataRow In DtCuentasPendientesBancomer.Rows
+
+
+ If dRow("NumCuenta").ToString.Length < 19 Then 'Tamaño maximo 18
+ RegistrosAltaBancomer.Append(dRow("NumCuenta").ToString.PadLeft(18, CeroRelleno))
+
+ End If
+
+ If dRow("AbreviaturaMon").ToString.Length = 3 AndAlso dRow("AbreviaturaMon").ToString.Contiene("MXN", "USD", "EUR") Then
+ RegistrosAltaBancomer.Append(dRow("AbreviaturaMon"))
+ End If
+
+ RegistrosAltaBancomer.Append("0999999999999.99")
+
+ If dRow("RazonSocial").ToString.Trim.Length < 31 Then 'Tamaño maximo 30
+ RegistrosAltaBancomer.Append(dRow("RazonSocial").ToString.PadLeft(30, EspacioRelleno))
+ Else
+ RegistrosAltaBancomer.Append(dRow("RazonSocial").ToString.Trim.Substring(0, 30))
+ End If
+
+ 'ALIAS DE LA CUENTA PENDIENTE TAMAÑO MAXIMO 30
+ RegistrosAltaBancomer.Append(dRow("CveProveedor").ToString.PadLeft(30, EspacioRelleno))
+
+ 'CORREO OPCIONAL TAMAÑO MAXIMO 80
+ 'RegistrosAlta.Append("".ToString.PadLeft(80, EspacioRelleno))
+
+ RegistrosAltaBancomer.Append(vbCrLf)
+ Next
+
+ TextoCompleto = RegistrosAltaBancomer.ToString
+
+ If CreaArchivo(2) Then
+ NombreArchivoBancomer = NombreArchivo
+ End If
+
+
+ End If
+
+
+
+
+ If DtCuentasPendientesInterbancarias.Rows.Count > 0 Then
+
+ For Each dRow As DataRow In DtCuentasPendientesInterbancarias.Rows
+
+ If Not (dRow("CuentaPago").ToString.ToUpper.Contains("BBVA") Or dRow("CuentaPago").ToString.ToUpper.Contains("BANCOMER")) Then
+
+ If dRow("CveBanco").ToString = "" Then
+ RegistrosAltaInterbancario.Append(dRow("CveBanco").ToString)
+ Else
+ Alert("La cuenta deposito no tiene clave ABM(Clave SAT) asignada", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ End If
+
+
+
+ If dRow("NumCuenta").ToString.Length < 19 Then 'Tamaño maximo 18
+ RegistrosAltaInterbancario.Append(dRow("NumCuenta").ToString.PadLeft(18, CeroRelleno))
+ End If
+
+ If dRow("AbreviaturaMon").ToString.Length = 3 AndAlso dRow("AbreviaturaMon").ToString.Contiene("MXN", "USD", "EUR") Then
+ RegistrosAltaInterbancario.Append(dRow("AbreviaturaMon"))
+ End If
+
+ RegistrosAltaInterbancario.Append("0999999999999.99")
+
+ If dRow("RazonSocial").ToString.Trim.Length < 31 Then 'Tamaño maximo 30
+ RegistrosAltaInterbancario.Append(dRow("RazonSocial").ToString.PadLeft(30, EspacioRelleno))
+ Else
+ RegistrosAltaInterbancario.Append(dRow("RazonSocial").ToString.Trim.Substring(0, 30))
+ End If
+
+ 'ALIAS DE LA CUENTA PENDIENTE TAMAÑO MAXIMO 30
+ RegistrosAltaInterbancario.Append(dRow("CveProveedor").ToString.PadLeft(30, EspacioRelleno))
+
+ 'CORREO OPCIONAL TAMAÑO MAXIMO 80
+ 'RegistrosAlta.Append("".ToString.PadLeft(80, EspacioRelleno))
+
+ If Not (dRow("CuentaPago").ToString.ToUpper.Contains("BBVA") Or dRow("CuentaPago").ToString.ToUpper.Contains("BANCOMER")) Then
+ RegistrosAltaInterbancario.Append("40")
+ End If
+
+ RegistrosAltaInterbancario.Append(vbCrLf)
+
+ Next
+
+
+ TextoCompleto = RegistrosAltaInterbancario.ToString
+ If CreaArchivo(2) Then
+ NombreArchivoInterbancario = NombreArchivo
+ End If
+
+ End If
+
+
+ Dim Mensaje As New StringBuilder
+
+
+ Mensaje.Append("Descarga Layouts ")
+
+ If NombreArchivoBancomer.Trim.Length > 0 Then
+ Mensaje.Append($"Cuentas Bancomer Descarga Archivo cuentas Bancomer
")
+ Dim TotalDetalles As Integer = 0
+ Dim EsBancomer = False
+ For Each gvr As DataRow In DtTemp.Rows
+ If gvr("CveCuentaDeposito").ToString <> "" AndAlso gvr("EstatusPagoElectronico").ToString <> "True" AndAlso gvr("AltaCuenta").ToString = "1" Then
+ DTPendienteActual = DtTemp.FiltraParametros(String.Format("CveCuentaDeposito = {0}", gvr("CveCuentaDeposito").ToString))
+ ErrorCuenta = False
+ EsBancomer = False
+
+ If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then
+ EsBancomer = True
+ End If
+
+ ''COMENTADO PARA PERMITIR ENTRADA DE UNA CUENTA A PROVEEDOR, 22 DE SEPTIEMBRE, ISRAEL PIÑA
+ 'If Not ErrorCuenta Then
+ ' If EsBancomer AndAlso (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso Not DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then
+ ' ProveedoresError.AppendFormat("
{0}
{1}
CLABE NO PERTENECE A BANCOMER
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ' ErrorCuenta = True
+ ' End If
+ 'End If
+
+ ''CLABE SIEMPRE OBLIGATORIA CUANDO NO ES BANCOMER CON CIE
+ 'If (DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And Not EsBancomer) Or (EsBancomer And TxtConvenioCIE.Text.Trim.Length <> 6 And DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18) 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
+
+ 'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER
+ If Not ErrorCuenta Then
+ If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And DTPendienteActual(0)("CLABE").ToString.Trim.Length = 0 And Not EsBancomer Then
+ ProveedoresError.AppendFormat("
{0}
{1}
CLABE ES OBLIGATORIA
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+ 'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10
+ If Not ErrorCuenta Then
+ If DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 10 AndAlso EsBancomer Then
+ ProveedoresError.AppendFormat("
{0}
{1}
NUMERO DE CUENTA CON FORMATO INCORRECTO
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+ 'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18
+ If Not ErrorCuenta Then
+ If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 Then
+ ProveedoresError.AppendFormat("
{0}
{1}
CLABE CON FORMATO INCORRECTO
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+ 'SI CIE TIENE ALGO DEBE TENER REFERENCIA OBLIGATORIA
+ If Not ErrorCuenta Then
+ If DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0 And DTPendienteActual(0)("Referencia").ToString.Trim.Length < 3 Then
+ ProveedoresError.AppendFormat("
{0}
{1}
CIE CON FORMATO INCORRECTO
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+ 'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA"
+ If Not ErrorCuenta Then
+ If EsBancomer AndAlso Not (DTPendienteActual(0)("Cuenta").ToString.Trim.Length = 10 Or DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0) Then
+ ProveedoresError.AppendFormat("
{0}
{1}
CUENTA BANCOMER SIN CUENTA O CIE
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+
+ 'DTPendienteActual(0)("").ToString
+
+ 'VALDIACION ANTIGUA
+ 'If Not (DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER")) Then
+ ' If Not DTPendienteActual(0)("CLABE").ToString.Length = 18 Then
+ ' ProveedoresError.AppendFormat("Proveedor: {0}", DTPendienteActual(0)("RazonSocial").ToString)
+ ' ErrorCuenta = True
+ ' End If
+ 'End If
+
+ If Not ErrorCuenta Then
+ If TotalDetalles > 0 Then
+ DetalleTexto &= vbCrLf
+ End If
+ CrearDetalle()
+ TotalDetalles += 1
+ End If
+
+ End If
+ Next
+ ProveedoresError.AppendFormat("
")
+
+
+ If TotalDetalles > 0 Then
+ FormarTexto(TotalDetalles)
+ CreaArchivo(2)
+
+ Dim Descargas As New StringBuilder()
+ Descargas.AppendFormat("
", ProveedoresError.ToString)
+
+ Alert(String.Format(" El Layout fue creado satisfactoriamente.{1} Descargas:
{0}
", Descargas, TextoErrorProveedores), TipoMensaje.MsgInformacion)
+
+ 'NombreArchivo = "LayoutAltaProveedores"
+ 'DescargarArchivo()
+ Else
+ Alert("No hay proveedores que dar de alta", TipoMensaje.MsgInformacion)
+ End If
+
+ End Sub
+
+ Protected Sub CrearDetalle()
+ Dim Resultado = True
+ Dim CuentaDeposito As String = ""
+ Dim TipoCuentaDeposito As String = ""
+ Dim TipoCuenta As String = ""
+
+ ''''' LLENADO DE DETALLE
+ 'Campos #1-4 del Detalle
+ DetalleTexto &= String.Format("DA{0}N ", DTPendienteActual(0)("CveCuentaDeposito").ToString.ToUpper.PadLeft(30, PadCeros))
+
+ 'Banco BBVA
+ If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Then
+ 'Llenamos datos de BBVA
+ 'Campo #5-7 del detalle
+
+ 'Busca que cuenta sera la asignada para el proveedor
+ If DTPendienteActual(0)("CIE").ToString <> "" Then
+ CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros))
+ TipoCuenta = "50"
+ TipoCuentaDeposito = "CIE"
+ ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then
+ CuentaDeposito = DTPendienteActual(0)("Cuenta").ToString
+ TipoCuenta = "99"
+ TipoCuentaDeposito = "Cuenta"
+ ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then
+ CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
+ TipoCuenta = "40"
+ TipoCuentaDeposito = "CLABE"
+ End If
+
+
+ DetalleTexto &= String.Format("{0}{1}{2}", DTPendienteActual(0)("Abreviatura").ToString, TipoCuenta, CuentaDeposito.PadLeft(35, PadCeros))
+
+ 'Llenamos en blanco datos de otros bancos
+ 'Campos 8-17 del detalle --- 64 de otros bancos y 45 para FILLER --- Fecha de Alta
+ DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(109), DateTime.Now().ToString("yyyy-MM-dd"))
+
+
+ 'Otros Bancos NACIONAL!!
+ Else
+
+ CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
+ TipoCuentaDeposito = "CLABE"
+
+ 'Llenamos en blanco datos de BBVA
+ DetalleTexto &= Vacio.PadRight(40)
+
+ 'Llenamos datos de otros bancos
+ 'Campos 8- 17 del detalle --- 44 de otros bancos --- 20 de internacional --- 45 Filler -- Fecha de Alta
+ DetalleTexto &= String.Format("{0}40{1}{2}{3}{4}{5}", DTPendienteActual(0)("Abreviatura").ToString, DTPendienteActual(0)("CLABE").ToString.PadLeft(35, PadCeros), DTPendienteActual(0)("CLABE").ToString.Substring(0, 3).PadLeft(4, PadCeros), Vacio.PadRight(20), Vacio.PadRight(45), DateTime.Now().ToString("yyyy-MM-dd"))
+ End If
+
+ 'Llenamos datos de Tipo de Persona - Fisica o Moral
+ TipoPersona()
+
+ 'Campos 27-32 --- Fillers --- datos de otros bancos (internacional)
+ DetalleTexto &= Vacio.PadLeft(153)
+
+ 'Campos 33-36 --- Datos de confirmacion
+ DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), CorreoNotificacionesEmpresa.ToUpper.PadRight(50))
+
+ 'If DTPendienteActual(0)("ContactoMail").ToString.Length > 0 Then
+ ' 'DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), DTPendienteActual(0)("ContactoMail").ToString.ToUpper.PadRight(50))
+ 'ElseIf DTPendienteActual(0)("ContactoMail").ToString.Length <= 0 Then
+ ' DetalleTexto &= String.Format("{0}00{1}", Vacio.PadRight(40), Vacio.PadRight(50))
+ 'End If
+
+ 'Campos 37-39 -- FILLER
+ DetalleTexto &= String.Format("00{0}", Vacio.PadRight(38))
+
+
+ ''LLENA DT PARA REPORTE
+ Dim Row = DtAlta.NewRow()
+ Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString
+ Row("Banco") = DTPendienteActual(0)("BancoNombre").ToString
+ Row("TipoCuenta") = TipoCuentaDeposito
+ Row("Cuenta") = String.Format("{0}", CuentaDeposito)
+ DtAlta.Rows.Add(Row)
+ End Sub
+
+ Protected Sub TipoPersona()
+ 'Persona Moral
+ If DTPendienteActual(0)("RFC").ToString.Length = 12 Then
+ Dim fecha As String = DTPendienteActual(0)("FechaIng").ToString
+ Dim NombreProveedor = DTPendienteActual(0)("RazonSocial").ToString.Replace("‚"c, Vacio).Replace("‚"c, Vacio).ToUpper.PadRight(50)
+ NombreProveedor = If(NombreProveedor.Length > 50, NombreProveedor.Substring(0, 50), NombreProveedor)
+
+ 'Campo 18-20 del detalle
+ DetalleTexto &= String.Format("M{0}{1}-{2}-{3}", NombreProveedor, fecha.Substring(6, 4), fecha.Substring(3, 2), fecha.Substring(0, 2))
+ 'Campo 21-26 del detalle --- 10 FILLER - 70 de TipoPersona FISICA - 14 de RFC
+ DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(80), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14))
+
+ 'Persona Fisica
+ ElseIf DTPendienteActual(0)("RFC").ToString.Length = 13 Then
+
+
+ If DTPendienteActual(0)("Tipo").ToString = "FyE" Then
+
+ 'Llenamos datos de Tipo de Persona - Fisica nombres Primer apellido Segundo apellido
+ DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), DTPendienteActual(0)("Nombres").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("APaterno").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("AMaterno").ToString.PadRight(20).Substring(0, 20))
+
+ 'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC
+ DetalleTexto &= String.Format("{0}{1}", DTPendienteActual(0)("FechaNacimiento").ToString.ToDate.ToString("yyyy-MM-dd"), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14))
+
+ Else
+
+ 'Obtener nombre
+ Dim Nombre() As String = Split(DTPendienteActual(0)("RazonSocial").ToString.Replace(",", ""))
+
+ 'Campo 18-24 del detalle --- 60 Tipo Persona Moral --- 10 Filler -- Datos Persona Fisica
+ If Nombre.Length = 2 Then
+ DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), Nombre(0).PadRight(20).Substring(0, 20), Nombre(1).PadRight(20).Substring(0, 20), Vacio.PadRight(20).Substring(0, 20))
+ ElseIf Nombre.Length = 3 Then
+ DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), Nombre(0).PadRight(20), Nombre(1).PadRight(20).Substring(0, 20), Nombre(2).PadRight(20).Substring(0, 20))
+ ElseIf Nombre.Length = 4 Then
+ DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), (Nombre(0) & " " & Nombre(1)).PadRight(20).Substring(0, 20), Nombre(2).PadRight(20).Substring(0, 20), Nombre(3).PadRight(20).Substring(0, 20))
+ ElseIf Nombre.Length > 4 Then
+
+ Dim NombreComplejo As New List(Of String)
+
+ 'ignoramos cualquier palabra del nombre que tenga un length igual o menor a 2
+ For index = 0 To Nombre.Length - 1
+ If Nombre(index).Length > 2 Then
+ NombreComplejo.Add(Nombre(index))
+ End If
+ Next
+
+ If NombreComplejo.Count = 2 Then
+ DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), NombreComplejo.Item(0).PadRight(20).Substring(0, 20), NombreComplejo.Item(1).PadRight(20).Substring(0, 20), Vacio.PadRight(20).Substring(0, 20))
+ ElseIf NombreComplejo.Count = 3 Then
+ DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), NombreComplejo.Item(0).PadRight(20), NombreComplejo.Item(1).PadRight(20).Substring(0, 20), NombreComplejo.Item(2).PadRight(20).Substring(0, 20))
+ ElseIf NombreComplejo.Count = 4 Then
+ DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), (NombreComplejo.Item(0) & " " & NombreComplejo.Item(1)).PadRight(20).Substring(0, 20), NombreComplejo.Item(2).PadRight(20).Substring(0, 20), NombreComplejo.Item(3).PadRight(20).Substring(0, 20))
+ ElseIf NombreComplejo.Count > 4 Then
+ Dim Nombres = ""
+
+ 'todas las palabras menos las 2 ultimas forman parte del nombre
+ For index = 0 To NombreComplejo.Count - 3
+ If Nombres <> "" Then Nombres += " "
+ Nombres += NombreComplejo.Item(index)
+ Next
+ DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), Nombres.PadRight(20).Substring(0, 20), NombreComplejo.Item(NombreComplejo.Count - 2).PadRight(20).Substring(0, 20), NombreComplejo.Item(NombreComplejo.Count - 1).PadRight(20).Substring(0, 20))
+
+ End If
+
+ End If
+
+ 'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC
+ Dim fecha As String = DTPendienteActual(0)("RFC").ToString.Substring(4, 6)
+ DetalleTexto &= String.Format("19{0}-{1}-{2}{3}", fecha.Substring(0, 2), fecha.Substring(2, 2), fecha.Substring(4, 2), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14))
+
+ End If
+
+
+ Else
+ 'Alert("Hola")
+ End If
+ End Sub
+ Protected Sub FormarTexto(Registros As Integer)
+ '''''' LLENADO HEADER
+ Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString
+ 'Campos #1-4 del Header
+ HeaderTexto = String.Format("H{0}{1}GRUPO01 ", convenio.PadLeft(9, PadCeros), DateTime.Now().ToString("yyyy-MM-dd"))
+ 'Campo #5 del Header
+
+ Dim IdentificadoUsuario As String = UsuarioActual.Usuario.Replace(" ", "").Replace(".", "").Replace("@", "").Replace("/", "").ToUpper.Trim
+ IdentificadoUsuario = If(IdentificadoUsuario.Length > 12, IdentificadoUsuario.Substring(0, 12), IdentificadoUsuario)
+ ' Dim Identificado As String = String.Format("{0}{1}", UsuarioActual.Usuario, DateTime.Now().ToString("yyyyMMdd")))
+
+ HeaderTexto &= String.Format("{0}{1}", IdentificadoUsuario, DateTime.Now().ToString("yyyyMMdd")).PadRight(20)
+ 'Campos #6-8 del Header
+ HeaderTexto &= String.Format("00").PadRight(586)
+ Dim HeaderLength = HeaderTexto.Length
+
+ ''''' LLENADO DE TRAILER
+ TrailerTexto = String.Format("T{0}{1}{2}", Registros.ToString.PadLeft(10, PadCeros), Vacio.PadRight(50, PadCeros), Vacio.PadRight(575))
+
+ ''''' ARMADO DEL TEXTO COMPLETO
+ TextoCompleto = String.Format("{1}{0}{2}{0}{3}{0}", vbCrLf, HeaderTexto, DetalleTexto, TrailerTexto)
+ 'TxtAltas.Text = TextoCompleto
+ End Sub
+
+#End Region
+
+#Region "PAGO PROVEEDORES"
+ Protected Sub BtnPagos_Click(sender As Object, e As EventArgs)
+
+ If Not DdlCuenta.SelectedValue.ToEntero > 0 Then
+ Alert("Primero debe seleccionar una Cuenta", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If DTPendientes.FiltraParametros("EstatusPagoElectronicoGrupos = 'True' AND EstatusCtaDeposito = 'True'") IsNot Nothing Then
+
+ GeneraPago(DTPendientes.FiltraParametros("EstatusPagoElectronico > 0 AND EstatusCtaDeposito > 0"))
+
+ Else
+
+ Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia)
+
+ End If
+ End Sub
+
+ Private Sub GeneraPago(DTPendientesTemp As DataTable)
+
+ Dim RegistrosPago As New StringBuilder
+ Dim MENSAJE As New StringBuilder
+
+
+ Dim CeroRelleno As Char = "0"c
+ Dim EspacioRelleno As Char = Chr(32)
+ Dim ErrorLayout = False
+
+
+ For Each drow As DataRow In DTPendientesTemp.Rows
+
+
+ If drow("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or drow("BancoNombre").ToString.ToUpper.Contains("BBVA") Then
+ RegistrosPago.Append("PTC")
+ Else
+ RegistrosPago.Append("PSC")
+ End If
+
+ If drow("CLABEOrigen").ToString.Trim.Length = 18 Then
+ RegistrosPago.Append(drow("CLABEOrigen").ToString)
+ Else
+ ErrorLayout = True
+ MENSAJE.AppendLine("ERROR EN CLABE")
+ Exit For
+ End If
+
+ If drow("CLABEDestino").ToString.Trim.Length <> 18 Then
+ RegistrosPago.Append(drow("CLABEDestino").ToString)
+ Else
+ ErrorLayout = True
+ MENSAJE.AppendLine("ERROR EN CLABE")
+ Exit For
+ End If
+
+ RegistrosPago.Append("Abreviatura")
+
+ RegistrosPago.Append(drow("Abonado").ToString.ToDecimal.ToString("0000000000000.00"))
+
+ RegistrosPago.Append(drow("CveIE").ToString.PadRight(30, EspacioRelleno))
+
+ RegistrosPago.Append(vbCrLf)
+
+ 'CveIE
+
+ Next
+
+
+
+ End Sub
+
+ Private Sub GeneraPagoViejo(DTTemp As DataTable, CveBLE As Integer)
+ If DTTemp.Rows.Count <= 0 Then
+ Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ 'For Each gvr As DataRow In DTTemp.Rows
+ ' If gvr("EstatusPagoElectronico").ToString.ToEntero <= 0 Then
+ ' Alert("Los proveedores tienen que estar dados de alta. Primero de alta a los proveedores")
+ ' Exit Sub
+ ' End If
+ 'Next
+
+ 'Comprobamos la cuenta deposito y moneda de las cuentas deposito
+ For Each dr As DataRow In DTTemp.Rows
+ If dr("BancoNombre").ToString = "" Then
+ Alert(String.Format("El Pago '{0}' no tiene Cuenta Deposito Asociada.", dr("Observaciones")), TipoMensaje.MsgError)
+ Exit Sub
+ End If
+
+ If dr("MonedaCtaDeposito").ToString = "" Or dr("MonedaCtaDeposito").ToString.ToEntero <= 0 Then
+ Alert(String.Format("La cuenta deposito '{0}' del proveedor '{1}' no tiene Moneda especificada.", dr("CuentaDeposito"), dr("RazonSocial")), TipoMensaje.MsgError)
+ Exit Sub
+ End If
+ Next
+
+ 'Excluimos los registros que no tengan cuenta deposito dada de alta
+ 'DTTemp = DTTemp.FiltraParametros("EstatusPagoElectronico = 0")
+
+ HeaderTexto = ""
+ DetalleTexto = ""
+ TrailerTexto = ""
+ TotalAcumulado = 0
+
+ 'Insertar en LayoutEnvios
+ Dim ObjBancos As New ClsBancos
+ ObjBancos.IniciaTransacSQL()
+ Dim ErrorLayout = False
+
+ Dim TotalDetalles As Integer = 0
+
+ 'CREA CARPETA SI NO EXISTE
+ Dim path As String = Server.MapPath(String.Format("~/Empresas/{0}/Layout/", UsuarioActual.CveEmpresa))
+ Dim exists = System.IO.Directory.Exists(path)
+ If Not exists Then
+ System.IO.Directory.CreateDirectory(path)
+ End If
+
+ Dim CveIEs = ""
+ CreaDtPago()
+
+ For Each gvr As DataRow In DTTemp.Rows
+ If gvr("CveCuentaDeposito").ToString <> "" Then
+ DTPendienteActual = DTTemp.FiltraParametros(String.Format("CveIE = {0}", gvr("CveIE").ToString))
+
+ 'ACTUALIZA FECHADOCUMENTO DEL IE
+ 'If CveBLE > 0 Then
+ ' ObjBancos.UpdateBancos_IE(Date.Now, Date.Now, DTPendienteActual(0)("CveIE").ToString.ToEntero)
+ 'End If
+
+ If TotalDetalles > 0 Then
+ DetalleTexto &= vbCrLf
+ End If
+ CrearDetallePagos()
+ TotalDetalles += 1
+ End If
+ Next
+
+ FormarTextoPagos(TotalDetalles, TotalAcumulado.ToString.FormatoNumero.Replace(",", "").Replace(".", ""))
+ CreaArchivo(1)
+
+ If CveBLE > 0 Then
+ 'ACTUALIZAMOS EL ENVIO SI ES REGENERACION
+ If Not ObjBancos.UpdateLayoutEnvios(CveBLE, Date.Now) Then
+ ErrorLayout = True
+ End If
+
+ 'GUARDAMOS EL ENVIO SI NO ES REGENERACION
+ Else
+
+ Dim CveLayoutEnvio = ObjBancos.AddLayoutEnvios(NombreArchivo, Date.Now, CveCuenta)
+
+ If CveLayoutEnvio > 0 Then
+ For Each dr As DataRow In DTTemp.Rows
+ If dr("CveProveedor").ToString <> "" Or dr("CvePersonal").ToString <> "" Then
+ If Not ObjBancos.AddLayoutEnviosDetalle(CveLayoutEnvio, dr("CveIE").ToString.ToEntero, dr("CveProveedor").ToString.ToEntero, dr("CvePersonal").ToString.ToEntero, 1, "Observaciones") Then
+ ErrorLayout = True
+ End If
+ End If
+ Next
+ Else
+ ErrorLayout = True
+ End If
+
+ End If
+
+
+
+ If Not ErrorLayout Then
+ ObjBancos.Commit()
+ ObjBancos.Dispose()
+
+
+ Dim Des = String.Format("{0}Layout\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo)
+ Dim Descargas As New StringBuilder()
+ Descargas.AppendFormat("
", NombreArchivo)
+
+ Alert(String.Format(" El Layout fue creado satisfactoriamente.
Descargas:
{0}
", Descargas), TipoMensaje.MsgInformacion)
+ 'Alert("El Layout fue creado satisfactoriamente")
+ Else
+ ObjBancos.RollBack()
+ ObjBancos.Dispose()
+ Alert("Ocurrio un problema al registrar la creacion del Layout. Por favor vuelva a intentar.", TipoMensaje.MsgError)
+ End If
+
+ End Sub
+
+ Protected Sub CrearDetallePagos()
+ 'Dim Resultado = True
+ Dim Importe As String = DTPendienteActual(0)("Abonado").ToString ' importe
+ Dim Divisa As String = DTPendienteActual(0)("Abreviatura").ToString.ToUpper
+ 'Dim Factura As String = "FAC-123456".Replace("-", " ")
+ Dim Referencia As String = ""
+
+ Dim Observaciones As String = DTPendienteActual(0)("Observaciones").ToString.Replace(":", "").Replace("-", " ").Replace(",", "").Replace(vbCrLf, " ").ToUpper
+
+ ''PARA DETECTAR SI ES CIE
+ Dim CuentaDeposito As String
+ Dim CodigoOperacion As String = "2"
+
+ 'Busca que cuenta sera la asignada para el proveedor
+ If DTPendienteActual(0)("CIE").ToString.Length >= 4 Then
+ CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros))
+ CodigoOperacion = "3"
+ Referencia = If(DTPendienteActual(0)("Referencia").ToString = "", "0", DTPendienteActual(0)("Referencia").ToString) 'String.Format("CVEIE{0}", DTPendienteActual(0)("CveIE").ToString).ToUpper 'cveIE
+ Else
+ Referencia = Observaciones.Replace(" ", "")
+ Referencia = If(Referencia.Length > 20, Referencia.Substring(0, 20), Referencia)
+ Referencia = If(Referencia.Length = 0, "PAGO", Referencia)
+ End If
+
+
+ ''CLAVE DE REGISTRO PARA CONTROL PROPIO ADSISTEMAS -- orita se esta guardando en el campo #9
+ Dim Cve = String.Format("CVEIE{0}", DTPendienteActual(0)("CveIE").ToString).ToUpper 'cveIE
+
+
+ ''''' LLENADO DE DETALLE
+ 'Campos #1-6 del Detalle
+ DetalleTexto &= String.Format("DAP{0}{1}PDA", Referencia.PadRight(20), DTPendienteActual(0)("CveCuentaDeposito").ToString.PadLeft(30, PadCeros))
+
+ 'Pago a cuenta BBVA
+ If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Then
+ 'Campos 7-24 del Detalle
+ 'CVE IE EN CAMPO 9 - VIEJO
+ 'DetalleTexto &= String.Format("{0}{1}{2}{3}N{4}", CodigoOperacion, Vacio.PadLeft(20, PadCeros), Cve.PadRight(15), Vacio.PadRight(139), Vacio.PadRight(187))
+ DetalleTexto &= String.Format("{0}{1}{2}{3}{4}N{5}", CodigoOperacion, Vacio.PadLeft(20, PadCeros), Vacio.PadRight(40), Cve.PadRight(37), Vacio.PadRight(77), Vacio.PadRight(187))
+ Else
+ Dim ReferenciaNumerica As String = "0" 'DTPendienteActual(0)("Referencia").ToString
+ Dim Motivo As String = "Pago de facturas"
+
+ 'Campos 7-24 del Detalle
+ 'CVE IE EN CAMPO 9 - VIELO
+ 'DetalleTexto &= String.Format("6{0}{1}{2}{3}{4}N{5}", Vacio.PadRight(20, PadCeros), Cve.PadRight(15), ReferenciaNumerica.PadRight(25), Motivo.ToUpper.PadRight(37), Vacio.PadRight(77), Vacio.PadRight(187))
+ DetalleTexto &= String.Format("6{0}{1}{2}{3}{4}N{5}", Vacio.PadRight(20, PadCeros), Vacio.PadRight(15), ReferenciaNumerica.PadRight(25), Cve.PadRight(37), Vacio.PadRight(77), Vacio.PadRight(187))
+ End If
+
+ 'OBTENEMOS EL CORREO DEL PROVEEDOR
+ Dim Correo = CorreoNotificacionesEmpresa.ToUpper.PadRight(50)
+ 'Correo = If(Correo.Length > 0, Correo.ToUpper.PadRight(50), Vacio.PadRight(50))
+
+ 'Campos 24-50 del Detalle 0 1 2 3 4 5 6 7 8 9
+ DetalleTexto &= String.Format("{0}{1}FA{2}{3}01{4}N{5}{6}{7}{7}{7}{6}N {7}700{8}{9}{7}", Divisa, Vacio.PadLeft(20), Importe.FormatoNumero.Replace(",", "").Replace(".", "").PadLeft(15, PadCeros), Vacio.PadRight(15, PadCeros), Correo, Vacio.PadRight(12, PadCeros), DateTime.Now.ToString("yyyy-MM-dd"), "0001-01-01", Observaciones.PadRight(700), Vacio.PadRight(52))
+ TotalAcumulado += Importe.ToDouble
+
+
+
+ ''LLENA DTPAGOS PARA REPORTE
+ Dim Row = DtPago.NewRow()
+ Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString
+
+ If DTPendienteActual(0)("CIE").ToString <> "" Then
+ Row("Cuenta") = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros))
+ ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then
+ Row("Cuenta") = DTPendienteActual(0)("Cuenta").ToString
+ ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then
+ Row("Cuenta") = DTPendienteActual(0)("CLABE").ToString
+ End If
+
+ Row("Importe") = Importe
+ Row("Moneda") = DTPendienteActual(0)("Abreviatura").ToString.ToUpper
+ Row("Observaciones") = DTPendienteActual(0)("Observaciones").ToString
+ DtPago.Rows.Add(Row)
+
+ End Sub
+
+ Protected Sub FormarTextoPagos(Registros As Integer, Total As String)
+ Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString
+
+ '''''' LLENADO HEADER
+ 'Campos #1-4 del Header
+ HeaderTexto = String.Format("H{0}{1}01", convenio.PadLeft(9, PadCeros), DateTime.Now().ToString("yyyy-MM-dd"))
+ 'Campo #5 del Header
+ HeaderTexto &= String.Format("P{0}{1}", DateTime.Now().ToString("s").Replace("-", "").Replace(":", ""), Vacio.PadRight(14))
+ 'Campos #6-11 del Header
+ HeaderTexto &= String.Format("00").PadRight(1314)
+
+
+ ''''' LLENADO DE TRAILER
+ TrailerTexto = String.Format("T{0}{1}{2}{3}", Registros.ToString.PadLeft(10, PadCeros), Total.PadLeft(15, PadCeros), Vacio.PadRight(225, PadCeros), Vacio.PadRight(1115))
+
+
+ ''''' ARMADO DEL TEXTO COMPLETO
+ TextoCompleto = String.Format("{1}{0}{2}{0}{3}{0}", vbCrLf, HeaderTexto, DetalleTexto, TrailerTexto)
+
+ End Sub
+#End Region
+
+#Region "CARGA ALTA PROVEEDORES"
+
+ Private Sub CreaDtAlta()
+
+ DtAlta = New DataTable
+ DtAlta.Columns.Add("CveProveedor", GetType(String))
+
+ DtAlta.Columns.Add("Proveedor", GetType(String))
+ DtAlta.Columns.Add("Banco", GetType(String))
+ DtAlta.Columns.Add("TipoCuenta", GetType(String))
+ DtAlta.Columns.Add("Cuenta", GetType(String))
+ DtAlta.Columns.Add("Estatus", GetType(String))
+
+ DtAlta.Columns.Add("MensajeAdicional", GetType(String))
+ DtAlta.Columns.Add("Moneda", GetType(String))
+
+ End Sub
+
+
+ Protected Sub BtnCargarAlta_Click(sender As Object, e As EventArgs)
+ Dim ErrorArchivo = False
+
+ If FUTxt.HasFile Then
+ If Not GuardaTXT() Then
+ Alert("Ocurrio un error al cargar el archivo", TipoMensaje.MsgError)
+ Exit Sub
+ End If
+ Else
+ Alert("No tiene ningun archivo", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+
+ 'LEE TXT
+ Dim Texto As String
+
+ Dim sr As New System.IO.StreamReader(NombreArchivo)
+ Texto = sr.ReadToEnd()
+ sr.Close()
+
+ Dim TextoArreglo() = Texto.Split(CChar(vbCrLf))
+
+ 'Alert(TextoArreglo.Length.ToString)
+
+ 'LEE LINEA POR LINEA
+ Dim RespuestaHeader = "", RespuestaDetalle = "", RespuestaTrailer = "", CveCuentasDeposito = ""
+ CreaDtAlta()
+ Dim ObjGrales As New ClsGenerales
+ Dim Row As DataRow = Nothing
+ Dim TipoCuentaDeposito = ""
+
+ For i = 0 To TextoArreglo.Length - 1 Step 1
+ 'Valida que el primer renglon sea el HEADER
+ If i = 0 Then
+ If TextoArreglo(i).Substring(0, 1) <> "H" Then
+ ErrorArchivo = True
+ Exit For
+ Else
+ RespuestaHeader = TextoArreglo(i).Substring(50, 2)
+ End If
+ Else
+ 'LEE DETALLE
+ If TextoArreglo(i).Length > 1 Then
+ If TextoArreglo(i).Substring(1, 1) = "D" Then
+
+ 'If i > 1 Then
+ ' RespuestaDetalle += vbCrLf
+ 'End If
+
+ 'RespuestaDetalle += String.Format("
{0}
{1}
", If(TextoArreglo(i).Substring(197, 1) = "M", TextoArreglo(i).Substring(198, 50).Trim, TextoArreglo(i).Substring(268, 60).Trim), (TextoArreglo(i).Substring(599, 30)))
+
+ ''Guardo CveCuentaDeposito cuando la operacion salio exitosa para actualizar en la DB
+ If TextoArreglo(i).Substring(597, 2) = "00" Or TextoArreglo(i).Substring(597, 2) = "34" Then
+ CveCuentasDeposito += If(CveCuentasDeposito <> "", ",", "")
+ CveCuentasDeposito += TextoArreglo(i).Substring(3, 30).ToEntero.ToString
+ End If
+
+
+ ''LLENA DT PARA REPORTE
+ Row = DtAlta.NewRow()
+
+ Row("Proveedor") = If(TextoArreglo(i).Substring(197, 1) = "M", TextoArreglo(i).Substring(198, 50).Trim, TextoArreglo(i).Substring(268, 60).Trim)
+
+ 'BANCO
+ If ObjGrales.GetCuentasDepositos(CveCuentaDeposito:=TextoArreglo(i).Substring(3, 30).ToEntero) Then
+ If ObjGrales.DtResultados.Rows.Count = 1 Then
+ Row("Banco") = ObjGrales.DtResultados.Rows(0)("BancoNombre").ToString
+ Else
+ ErrorArchivo = True
+ Exit For
+ End If
+ Else
+ ErrorArchivo = True
+ Exit For
+ End If
+
+ 'CUENTA
+ If TextoArreglo(i).Substring(41, 2).Trim <> "" Then
+ Row("Cuenta") = String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c))
+ ElseIf TextoArreglo(i).Substring(81, 2).Trim <> "" Then
+ Row("Cuenta") = String.Format("{0}", TextoArreglo(i).Substring(83, 35).TrimStart("0"c))
+ Row("TipoCuenta") = "CLABE"
+ Else
+ ErrorArchivo = True
+ Exit For
+ End If
+
+ 'TIPO CUENTA
+ If Row("TipoCuenta").ToString = "" Then
+ If String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 8 Then
+ Row("TipoCuenta") = "CIE"
+ ElseIf String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 10 Or String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 9 Then
+ Row("TipoCuenta") = "Cuenta"
+ ElseIf String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 18 Then
+ Row("TipoCuenta") = "CLABE"
+ End If
+ End If
+
+ Row("Estatus") = TextoArreglo(i).Substring(599, 30)
+
+ DtAlta.Rows.Add(Row)
+
+ ''LLENA PARA ALERT
+ 'If i > 1 Then
+ ' RespuestaDetalle += vbCrLf
+ 'End If
+
+ 'RespuestaDetalle += String.Format("
{0}
{1}
", If(TextoArreglo(i).Substring(197, 1) = "M", TextoArreglo(i).Substring(198, 50).Trim, TextoArreglo(i).Substring(268, 60).Trim), (TextoArreglo(i).Substring(599, 30)))
+
+
+ 'LEE TRAILER
+ ElseIf TextoArreglo(i).Substring(1, 1) = "T" Then
+ RespuestaTrailer = TextoArreglo(i).Substring(32, 10)
+ RespuestaTrailer += vbCrLf
+ RespuestaTrailer += TextoArreglo(i).Substring(42, 10)
+ RespuestaTrailer += vbCrLf
+ RespuestaTrailer += TextoArreglo(i).Substring(52, 10)
+ Exit For
+ Else
+ ErrorArchivo = True
+ Exit For
+ End If
+ End If
+ End If
+ Next
+ ObjGrales.Dispose()
+
+
+ Dim Respuesta As New StringBuilder
+ 'LEE ARCHIVO
+ If Not ErrorArchivo Then
+ 'TRADUCE CODIGO RESPUESTA HEADER
+ If RespuestaHeader = "01" Then
+ RespuestaHeader = "ACEPTADO TOTAL"
+ ElseIf RespuestaHeader = "02" Then
+ RespuestaHeader = "ACEPTADO PARCIAL"
+ ElseIf RespuestaHeader = "03" Then
+ RespuestaHeader = "RECHAZADO"
+ End If
+
+ 'DIVIDE DETALLE
+ Dim Detalle() = RespuestaDetalle.Split(CChar(vbCrLf))
+
+ 'DIVIDE TRAILER
+ Dim Trailer() = RespuestaTrailer.Split(CChar(vbCrLf))
+
+ 'ARMADO DE RESPUESTA
+ Respuesta.AppendFormat(" Resumen de respuesta: {0} ", RespuestaHeader)
+ Respuesta.AppendFormat("Numero de movimientos: {0}
", DtAlta.Rows.Count)
+ Respuesta.Append("------------------------------ Detalle de los movimientos ------------------------------ ")
+
+ Respuesta.Append("
#
Proveedor
Banco
Tipo Cuenta
Cuenta
Estatus
")
+ 'For i = 0 To Detalle.Length - 1
+ ' Respuesta.AppendFormat("
{0}
{1}
", i + 1, Detalle(i).Trim)
+ 'Next
+ Dim i = 1
+ Dim Style = ""
+ Dim TotalExitos = 0, TotalFracasos = 0
+ For Each dr As DataRow In DtAlta.Rows
+
+ If dr("estatus").ToString.Trim.Contiene("OPERACION EXITOSA", "ALTA TERCERO EXITOSO") Then
+ Style = ""
+ TotalExitos += 1
+ Else
+ Style = "style=""background-color:#FF5F5F;"" "
+ TotalFracasos += 1
+ End If
+
+ Respuesta.AppendFormat("
{0}
{1}
{2}
{3}
{4}
{5}
", i, dr("Proveedor"), dr("Banco"), dr("TipoCuenta"), dr("Cuenta"), dr("estatus"), Style)
+ i += 1
+ Next
+
+ Respuesta.Append("
------------------------------------------------------------------------------------- ")
+
+ Respuesta.AppendFormat("Total de movimientos exitosos: {0} ", TotalExitos)
+ Respuesta.AppendFormat("Total de movimientos NO exitosos: {0} ", TotalFracasos)
+
+ 'LEE DESDE EL LAYOUT
+ 'Respuesta.AppendFormat("Total de altas rechazadas: {0} ", Trailer(0).ToString.ToEntero)
+ 'Respuesta.AppendFormat("Total de bajas rechazadas: {0} ", Trailer(1).ToString.ToEntero)
+ 'Respuesta.AppendFormat("Total de cambios rechazados: {0} ", Trailer(2).ToString.ToEntero)
+
+ End If
+
+ If Not ErrorArchivo Then
+
+ If CveCuentasDeposito <> "" Then
+ Dim ObjIE As New ClsBancos
+ Dim ErrorDB = False
+ ObjIE.IniciaTransacSQL()
+ Dim ArrayCuentasDeposito() = CveCuentasDeposito.Split(","c)
+
+ For index = 0 To ArrayCuentasDeposito.Length - 1
+ If Not ObjIE.UpdateCuentaDepositoPagoElectronico(ArrayCuentasDeposito(index).ToEntero) Then
+ ErrorDB = True
+ End If
+ Next
+
+ If Not ErrorDB Then
+ ObjIE.Commit()
+ Respuesta.Append("
NOTA: El archivo se analizo correctamente y se efectuaron todos los cambios en el sistema.")
+ 'Respuesta.AppendFormat(" Descargar reporte", NombreArchivo)
+ Respuesta.AppendFormat("
NOTA: El archivo se analizo correctamente pero ocurrio un problema al efectuar los cambios en el sistema. Por favor vuelta a intentar.")
+ Alert(Respuesta.ToString, TipoMensaje.MsgError)
+ End If
+
+ ObjIE.Dispose()
+ Else
+ Respuesta.AppendFormat("
NOTA: El archivo se analizo correctamente pero ningun movimiento fue exitoso.")
+ 'Respuesta.AppendFormat(" Descargar reporte", NombreArchivo)
+ Respuesta.AppendFormat("
", NombreArchivo)
+
+ Alert(Respuesta.ToString, TipoMensaje.MsgAdvertencia)
+ End If
+
+ Else
+ Alert("Ocurrio un problema al leer el archivo. Por favor revise que el archivo sea el correcto e intente de nuevo.", TipoMensaje.MsgError)
+ End If
+
+ 'ELIMINA TXT
+ My.Computer.FileSystem.DeleteFile(NombreArchivo)
+
+ RecargaDatos()
+
+ End Sub
+#End Region
+
+#Region "CARGA PAGO PROVEEDORES"
+ Private Sub CreaDtPago()
+
+ DtPago = New DataTable
+ DtPago.Columns.Add("NumeroConvenio", GetType(String))
+ DtPago.Columns.Add("ClaveProveedor", GetType(String))
+ DtPago.Columns.Add("ReferenciaPago", GetType(String))
+ DtPago.Columns.Add("TipoPago", GetType(String))
+
+ DtPago.Columns.Add("Proveedor", GetType(String))
+ DtPago.Columns.Add("Cuenta", GetType(String))
+ DtPago.Columns.Add("Importe", GetType(Decimal))
+ DtPago.Columns.Add("Moneda", GetType(String))
+ DtPago.Columns.Add("Observaciones", GetType(String))
+
+ DtPago.Columns.Add("FechaOperacion", GetType(String))
+
+ End Sub
+
+
+ Protected Sub BtnCargarPago_Click(sender As Object, e As System.EventArgs)
+ Dim ErrorArchivo = False
+ Dim TextoErrorArchivo = "Ocurrió un problema al leer el archivo, por favor revise que el archivo sea el correcto e intente de nuevo."
+
+ If FUTxt.HasFile Then
+ If Not GuardaTXT() Then
+ Alert("Ocurrio un error al cargar el archivo", TipoMensaje.MsgError)
+ Exit Sub
+ End If
+ Else
+ Alert("No tiene ningun archivo", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+
+ 'LEE TXT
+ Dim Texto As String
+ Dim sr As New System.IO.StreamReader(NombreArchivo)
+ Texto = sr.ReadToEnd()
+ sr.Close()
+ Dim TextoArreglo() = Texto.Split(CChar(vbCrLf))
+
+ 'INICIALIZA VARIABLES
+ Dim ObjBancos As New ClsBancos
+ Dim RespuestaHeader = "", RespuestaDetalle = "", RespuestaTrailer = "", Proveedor = "", CuentaAbono = "", Estatus = "", CveIEs = "", EstatusIEs = "", FechaMovto = "", Correos = ""
+ Dim Row As DataRow = Nothing
+ Dim Convenio = ""
+ CreaDtPago()
+
+ 'LEE LINEA POR LINEA
+ For i = 0 To TextoArreglo.Length - 1
+ 'Valida que el primer renglon sea el HEADER
+ If i = 0 Then
+ If TextoArreglo(i).Substring(0, 1) <> "H" Then
+ ErrorArchivo = True
+ Exit For
+ Else
+ ' Codigo de respuesta | Cuenta cargo
+ RespuestaHeader = String.Format("{0}|{1}", TextoArreglo(i).Substring(52, 2), TextoArreglo(i).Substring(77, 35))
+ Convenio = TextoArreglo(i).Substring(2, 9)
+ End If
+ Else
+ If TextoArreglo(i).Length > 1 Then
+
+ 'LEE DETALLE
+ If TextoArreglo(i).Substring(1, 1) = "D" Then
+ If i > 1 Then
+ RespuestaDetalle += vbCrLf
+ End If
+
+ 'TRUENA PORQUE AHORA ES LA CVECUENTADEPOSITO
+ 'Proveedor = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveProveedor = {0}", TextoArreglo(i).Substring(24, 30).ToEntero)).Rows(0)("RazonSocial").ToString
+
+ Correos += If(Correos <> "", "|", "")
+
+ If ObjBancos.GetProveedorCuentaDeposito(TextoArreglo(i).Substring(24, 30).ToDouble.ToEntero) Then
+ If ObjBancos.DtResultados.Rows.Count > 0 Then
+
+ Proveedor = ObjBancos.DtResultados.Rows(0)("RazonSocial").ToString
+
+ 'Correos += If(TextoArreglo(i).Substring(477, 50).Trim = "", "-1", TextoArreglo(i).Substring(477, 50).Trim)
+ Correos += String.Format("{0};{1}", ObjBancos.DtResultados.Rows(0)("NotificarA").ToString, ObjBancos.DtResultados.Rows(0)("ContactoMailCobranza").ToString)
+
+
+ ''SELECCIONA CUENTA ABONO PARA CORREO
+ Select Case TextoArreglo(i).Substring(57, 1).ToEntero
+ Case 1
+ CuentaAbono = "NO APLICA"
+ Case 2
+ CuentaAbono = If(ObjBancos.DtResultados.Rows(0)("Cuenta").ToString <> "", ObjBancos.DtResultados.Rows(0)("Cuenta").ToString, ObjBancos.DtResultados.Rows(0)("CLABE").ToString)
+ Case 3
+ CuentaAbono = ObjBancos.DtResultados.Rows(0)("CIE").ToString
+ Case 4
+ CuentaAbono = ObjBancos.DtResultados.Rows(0)("SWIFT").ToString
+ Case 5, 6, 7
+ CuentaAbono = ObjBancos.DtResultados.Rows(0)("CLABE").ToString
+ End Select
+
+ Else
+ Proveedor = "PROVEEDOR NO ENCONTRADO"
+ End If
+ Else
+ Proveedor = "PROVEEDOR NO ENCONTRADO"
+ End If
+
+ Estatus = If(TextoArreglo(i).Substring(1325, 2) = "00", "OPERACION EXITOSA: ", "OPERACION FALLIDA: ")
+ ' Proveedor | Importe | Descripcion estatus
+ RespuestaDetalle += String.Format("
{0}
{1}.{2}
{5}
{3}{4}
", Proveedor, TextoArreglo(i).Substring(445, 13).ToDouble.ToEntero, TextoArreglo(i).Substring(458, 2).ToEntero, Estatus, TextoArreglo(i).Substring(1327, 30), TextoArreglo(i).Substring(420, 3))
+
+ ''Guardo CveIE cuando la operacion salio exitosa para actualizar en la DB el IE
+ 'If TextoArreglo(i).Substring(1325, 2) = "00" Then
+ CveIEs += If(CveIEs <> "", ",", "")
+ 'VIEJO IE EN CAMPO 9
+ 'CveIEs += TextoArreglo(i).Substring(83, 10).Trim
+ CveIEs += TextoArreglo(i).Substring(123, 32).Trim
+
+ 'SI VIENE SIN RESPUESTA ES ERROR DE ARCHIVO
+ If TextoArreglo(i).Substring(1325, 2).Trim = "" Then
+ ErrorArchivo = True
+ TextoErrorArchivo = "El archivo que se intento procesar no es de respuesta. Por favor verifique cargar el archivo correcto."
+ Exit For
+ End If
+
+ EstatusIEs += If(EstatusIEs <> "", ",", "")
+ EstatusIEs += If(TextoArreglo(i).Substring(1325, 2) = "00", "2", "3")
+
+ FechaMovto += If(FechaMovto <> "", ",", "")
+ FechaMovto += TextoArreglo(i).Substring(540, 10)
+
+ 'If Proveedor = "PROVEEDOR NO ENCONTRADO" Or CuentaAbono = "" Then
+ ' Continue For
+ 'End If
+
+
+ ''LLENA DTPAGOS PARA CORREO
+ Row = DtPago.NewRow()
+ Row("NumeroConvenio") = Convenio
+ Row("ClaveProveedor") = TextoArreglo(i).Substring(24, 30)
+ Row("Proveedor") = Proveedor
+ Row("ReferenciaPago") = TextoArreglo(i).Substring(4, 20)
+ Row("Cuenta") = CuentaAbono
+
+ Select Case TextoArreglo(i).Substring(57, 1).ToEntero
+ Case 1
+ Row("TipoPago") = "1 .- ABONO EN VENTANILLA"
+ Case 2
+ Row("TipoPago") = "2 .- ABONO A CUENTAS BANCOMER"
+ Case 3
+ Row("TipoPago") = "3 .- ABONO A CONVENIO CIE"
+ Case 4
+ Row("TipoPago") = "4 .- ABONO A CUENTA INTERNACIONAL VIA SWIFT"
+ Case 5
+ Row("TipoPago") = "5 .- ABONO A CUENTA INTERBANCARIA DIA SIGUIENTE"
+ Case 6
+ Row("TipoPago") = "6 .- ABONO A CUENTA INTERBANCARIA MISMO DIA"
+ Case 7
+ Row("TipoPago") = "7 .- ABONO A CUENTA INTERNACIONAL VIA ACH"
+ End Select
+
+ Try
+ Row("Cuenta") = If(Row("Cuenta").ToString = "", String.Format("******{0}", CuentaAbono.Substring(CuentaAbono.Length - 4, 4)), Row("Cuenta").ToString)
+ Catch ex As Exception
+ Row("Cuenta") = "******"
+ End Try
+
+ Row("Importe") = String.Format("{0}.{1}", TextoArreglo(i).Substring(445, 13), TextoArreglo(i).Substring(458, 2)).ToDecimal.ToString
+ Row("FechaOperacion") = TextoArreglo(i).Substring(540, 10)
+ Row("Observaciones") = TextoArreglo(i).Substring(605, 700).Trim
+ DtPago.Rows.Add(Row)
+
+ 'End If
+
+ 'LEE TRAILER
+ ElseIf TextoArreglo(i).Substring(1, 1) = "T" Then
+
+ 'PARA BCOM, YA QUE TRUNCA EL STRING CUANDO SOLO ES MXP
+ If TextoArreglo(i).Length < 1367 Then
+ TextoArreglo(i) = TextoArreglo(i).PadRight(1367)
+ End If
+
+ RespuestaTrailer += "------------------------------------------------------------ RESUMEN ------------------------------------------------------------"
+ RespuestaTrailer += String.Format("
", TextoArreglo(i).Substring(187, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(200, 2).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(312, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(325, 2).ToDouble.ToEntero.ToString)
+
+ 'RespuestaTrailer += String.Format("Total registros rechazados: {1}{0} Total Importe rechazado: $ {2}.{3}{0} Total registros aceptados: {4}{0} Total Importe aceptado: $ {5}.{6}{0}", " ", TextoArreglo(i).Substring(77, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(87, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(100, 2).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(177, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(187, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(200, 2).ToEntero.ToString)
+ Else
+ ErrorArchivo = True
+ Exit For
+ End If
+ End If
+ End If
+ Next
+
+ ObjBancos.Dispose()
+
+ Dim Respuesta As New StringBuilder
+ If Not ErrorArchivo Then
+
+ 'DIVIDE HEADER
+ Dim Header() = RespuestaHeader.Split(CChar("|"))
+ 'TRADUCE CODIGO RESPUESTA HEADER
+ If Header(0) = "01" Then
+ RespuestaHeader = "ACEPTADO TOTAL"
+ ElseIf Header(0) = "02" Then
+ RespuestaHeader = "ACEPTADO PARCIAL"
+ ElseIf Header(0) = "03" Then
+ RespuestaHeader = "RECHAZADO"
+ End If
+ RespuestaHeader += String.Format(" Cuenta Cargo: {0}", Header(1))
+
+ 'DIVIDE DETALLE
+ Dim Detalle() = RespuestaDetalle.Split(CChar(vbCrLf))
+
+ 'ARMADO DE RESPUESTA
+ Respuesta.AppendFormat(" Resumen de respuesta: {0} ", RespuestaHeader)
+ Respuesta.AppendFormat("Numero de movimientos: {0}
", Detalle.Length.ToString)
+ Respuesta.Append("----------------------------------------------------- Detalle de los movimientos -------------------------------------------------- ")
+ Respuesta.Append("
#
Proveedor
Importe($)
Moneda
Estatus
")
+ For i = 0 To Detalle.Length - 1
+ Respuesta.AppendFormat("
{0}
{1}
", i + 1, Detalle(i).Trim)
+ Next
+ Respuesta.Append("
---------------------------------------------------------------------------------------------------------------------- ")
+ Respuesta.AppendFormat(RespuestaTrailer)
+
+
+ End If
+
+ If Not ErrorArchivo Then
+ If CveIEs <> "" Then
+ Dim ObjIE As New ClsBancos
+ Dim ErrorDB = False
+ ObjIE.IniciaTransacSQL()
+ Dim ArrayCveIEs() = CveIEs.Split(","c)
+ Dim ArrayEstatusIEs() = EstatusIEs.Split(","c)
+ Dim ArrayFechasMovto() = FechaMovto.Split(","c)
+ Dim ArrayCorreos() = Correos.Split("|"c)
+
+ Dim ArregloHilos As New Generic.List(Of System.Threading.Thread)
+ Dim ArregloParametros As New Generic.List(Of List(Of String))
+
+ For index = 0 To ArrayCveIEs.Length - 1
+ If ObjIE.UpdatePagoElectronicoCarga(ArrayCveIEs(index).ToEntero, ArrayEstatusIEs(index).ToEntero) Then
+
+ 'Cuando salio exitoso actualizamos el IE
+ If ArrayEstatusIEs(index).ToEntero = 2 Then
+ If ObjIE.UpdateIEPagoElectronico(ArrayCveIEs(index).ToEntero, ArrayFechasMovto(index).ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then 'DESPROGRAMA LAS COMPRAS RELACIONADAS EN ESTE PA
+
+ 'Cambiamos estatus notificación
+ If ObjIE.UpdateBancos_IENotificaciones(2, "-1", "-1", ArrayCveIEs(index).ToEntero) Then
+
+ 'Obtenemos los correos del movimiento
+ If ArrayCorreos(index) <> "-1" Or ArrayCorreos(index) <> "" Then
+
+ 'Dim CorreosMovto() = ArrayCorreos(index).Split(";"c)
+ 'For index2 = 0 To CorreosMovto.Length - 1
+ ' If CorreosMovto(index2).Length > 5 Then
+ ' End If
+ 'Next
+
+ Dim Param As New List(Of String)
+
+ Param.Add(ArrayCorreos(index)) 'Para
+ Param.Add("Notificación de Pago") 'Asunto
+ Param.Add(GeneraCorreo2(DtPago.Rows(index), ObjIE, ArrayCveIEs(index).ToEntero)) 'Body
+
+ Dim Hilo As New Threading.Thread(AddressOf MandaCorreo)
+ ArregloHilos.Add(Hilo)
+ ArregloParametros.Add(Param)
+ End If
+ Else
+ ErrorDB = True
+ End If
+
+ Else
+ ErrorDB = True
+ End If
+ Else
+
+ 'Cuando salio NO exitoso cancelamos el IE
+ If Not ObjIE.CancelarBancos_IE(UsuarioActual.CveUsuario, ArrayCveIEs(index).ToEntero, False, -1, -1) Then
+ ErrorDB = True
+ End If
+ End If
+
+ Else
+ ErrorDB = True
+ End If
+ Next
+
+ If Not ErrorDB Then
+ ObjIE.Commit()
+ 'ObjIE.RollBack()
+
+ 'EMPIEZA A ENVIAR CORREO POR HILOS
+ For index = 0 To ArregloHilos.Count - 1
+ ArregloHilos(index).Start(ArregloParametros(index))
+ Next
+
+ Respuesta.Append("
NOTA: El archivo se analizo correctamente y se efectuaron todos los cambios en el sistema.")
+ Alert(Respuesta.ToString, TipoMensaje.MsgInformacion)
+
+ CargaDatos()
+ Else
+ ObjIE.RollBack()
+ Respuesta.Append("
NOTA: El archivo se analizo correctamente pero ocurrió un problema al efectuar los cambios en el sistema. Por favor vuelva a intentar.")
+ Alert(Respuesta.ToString, TipoMensaje.MsgError)
+ End If
+
+ ObjIE.Dispose()
+ Else
+ Respuesta.AppendFormat("
NOTA: El archivo se analizo correctamente pero ningun movimiento fue exitoso.")
+ Alert(Respuesta.ToString, TipoMensaje.MsgAdvertencia)
+ End If
+ Else
+ Alert(TextoErrorArchivo, TipoMensaje.MsgError)
+ End If
+
+ 'ELIMINA TXT
+ My.Computer.FileSystem.DeleteFile(NombreArchivo)
+
+ RecargaDatos()
+
+ End Sub
+#End Region
+
+
+
+ 'FUNCIONARIO O EMPLEADO
+#Region " ALTA FUNCIONARIO "
+ Private Sub CargaFyE()
+ Dim ObjBancos As New ClsBancos
+
+ If ObjBancos.GetLayoutFyE(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
+ DTFyE = ObjBancos.DtResultados.FiltraParametros("LEN(RFC) IN (13)")
+ Else
+ DTFyE = Nothing
+ End If
+ ObjBancos.Dispose()
+
+ If DTFyE.Rows.Count > 0 Then
+ GvProveedores.DataSource = DTFyE
+ End If
+ GvProveedores.DataBind()
+
+ UpProveedores.Update()
+ End Sub
+ Private Sub GeneraAltaFyE()
+ Dim DtTemp As DataTable = Nothing
+
+ 'REINICIA PROPIEDAS
+ HeaderTexto = ""
+ DetalleTexto = ""
+ TrailerTexto = ""
+ TotalAcumulado = 0
+ CreaDtAlta()
+
+ DtTemp = DTFyE
+
+ ''VALIDA CUENTAS DEPOSITOS
+ Dim ErrorCuenta = False
+ Dim FyEError As StringBuilder = New StringBuilder
+ FyEError.AppendFormat("
Personal
Cuenta
Error
")
+
+ Dim TotalDetalles As Integer = 0
+ Dim EsBancomer = False
+ For Each gvr As DataRow In DtTemp.Rows
+ If gvr("CvePersonal").ToString <> "" AndAlso gvr("EstatusPagoElectronico").ToString <> "True" AndAlso gvr("AltaCuenta").ToString = "1" Then
+ DTPendienteActual = DtTemp.FiltraParametros(String.Format("CveCuentaDeposito = {0}", gvr("CveCuentaDeposito").ToString))
+ ErrorCuenta = False
+ EsBancomer = False
+
+ If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then
+ EsBancomer = True
+ End If
+
+ 'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER
+ If Not ErrorCuenta Then
+ If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And DTPendienteActual(0)("CLABE").ToString.Trim.Length = 0 And Not EsBancomer Then
+ FyEError.AppendFormat("
{0}
{1}
CLABE ES OBLIGATORIA
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+ 'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10
+ If Not ErrorCuenta Then
+ If DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 10 AndAlso EsBancomer Then
+ FyEError.AppendFormat("
{0}
{1}
NUMERO DE CUENTA CON FORMATO INCORRECTO
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+ 'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18
+ If Not ErrorCuenta Then
+ If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 Then
+ FyEError.AppendFormat("
{0}
{1}
CLABE CON FORMATO INCORRECTO
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+ 'SI CIE TIENE ALGO DEBE TENER REFERENCIA OBLIGATORIA
+ If Not ErrorCuenta Then
+ If DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0 And DTPendienteActual(0)("Referencia").ToString.Trim.Length < 3 Then
+ FyEError.AppendFormat("
{0}
{1}
CIE CON FORMATO INCORRECTO
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+ 'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA"
+ If Not ErrorCuenta Then
+ If EsBancomer AndAlso Not (DTPendienteActual(0)("Cuenta").ToString.Trim.Length = 10 Or DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0) Then
+ FyEError.AppendFormat("
{0}
{1}
CUENTA BANCOMER SIN CUENTA O CIE
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
+ ErrorCuenta = True
+ End If
+ End If
+
+ If Not ErrorCuenta Then
+ If TotalDetalles > 0 Then
+ DetalleTexto &= vbCrLf
+ End If
+ GeneraAltaDetalleFyE()
+ TotalDetalles += 1
+ End If
+
+ End If
+ Next
+ FyEError.AppendFormat("
")
+
+
+ If TotalDetalles > 0 Then
+ FormarTextoAltaFyE(TotalDetalles)
+ CreaArchivo(2)
+
+ Dim Descargas As New StringBuilder()
+ Descargas.AppendFormat("
", FyEError.ToString)
+
+ Alert(String.Format(" El Layout fue creado satisfactoriamente.{1} Descargas:
{0}
", Descargas, TextoErrorProveedores), TipoMensaje.MsgInformacion)
+
+ 'NombreArchivo = "LayoutAltaProveedores"
+ 'DescargarArchivo()
+ Else
+ Alert("No hay proveedores que dar de alta", TipoMensaje.MsgInformacion)
+ End If
+
+
+ End Sub
+ Private Sub GeneraAltaDetalleFyE()
+ Dim Resultado = True
+ Dim CuentaDeposito As String = ""
+ Dim TipoCuentaDeposito As String = ""
+ Dim TipoCuenta As String = ""
+
+ ''''' LLENADO DE DETALLE
+ 'Campos #1-4 del Detalle
+ DetalleTexto &= String.Format("DA{0}N ", DTPendienteActual(0)("CveCuentaDeposito").ToString.ToUpper.PadLeft(30, PadCeros))
+
+ 'Banco BBVA
+ If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Then
+ 'Llenamos datos de BBVA
+ 'Campo #5-7 del detalle
+
+ 'Busca que cuenta sera la asignada para el proveedor
+ If DTPendienteActual(0)("CIE").ToString <> "" Then
+ CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros))
+ TipoCuenta = "50"
+ TipoCuentaDeposito = "CIE"
+ ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then
+ CuentaDeposito = DTPendienteActual(0)("Cuenta").ToString
+ TipoCuenta = "99"
+ TipoCuentaDeposito = "Cuenta"
+ ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then
+ CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
+ TipoCuenta = "40"
+ TipoCuentaDeposito = "CLABE"
+ End If
+
+
+ DetalleTexto &= String.Format("{0}{1}{2}", DTPendienteActual(0)("Abreviatura").ToString, TipoCuenta, CuentaDeposito.PadLeft(35, PadCeros))
+
+ 'Llenamos en blanco datos de otros bancos
+ 'Campos 8-17 del detalle --- 64 de otros bancos y 45 para FILLER --- Fecha de Alta
+ DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(109), DateTime.Now().ToString("yyyy-MM-dd"))
+
+
+ 'Otros Bancos NACIONAL!!
+ Else
+
+ CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
+ TipoCuentaDeposito = "CLABE"
+
+ 'Llenamos en blanco datos de BBVA
+ DetalleTexto &= Vacio.PadRight(40)
+
+ 'Llenamos datos de otros bancos
+ 'Campos 8- 17 del detalle --- 44 de otros bancos --- 20 de internacional --- 45 Filler -- Fecha de Alta
+ DetalleTexto &= String.Format("{0}40{1}{2}{3}{4}{5}", DTPendienteActual(0)("Abreviatura").ToString, DTPendienteActual(0)("CLABE").ToString.PadLeft(35, PadCeros), DTPendienteActual(0)("CLABE").ToString.Substring(0, 3).PadLeft(4, PadCeros), Vacio.PadRight(20), Vacio.PadRight(45), DateTime.Now().ToString("yyyy-MM-dd"))
+ End If
+
+ 'Llenamos datos de Tipo de Persona - Fisica
+ ' nombres Primer apellido Segundo apellido
+ DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), DTPendienteActual(0)("Nombres").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("APaterno").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("AMaterno").ToString.PadRight(20).Substring(0, 20))
+
+ 'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC
+ DetalleTexto &= String.Format("{0}{1}", DTPendienteActual(0)("FechaNacimiento").ToString.ToDate.ToString("yyyy-MM-dd"), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14))
+
+ 'Campos 27-32 --- Fillers --- datos de otros bancos (internacional)
+ DetalleTexto &= Vacio.PadLeft(153)
+
+ 'Campos 33-36 --- Datos de confirmacion
+ DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), CorreoNotificacionesEmpresa.ToUpper.PadRight(50))
+
+ 'If DTPendienteActual(0)("ContactoMail").ToString.Length > 0 Then
+ ' 'DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), DTPendienteActual(0)("ContactoMail").ToString.ToUpper.PadRight(50))
+ 'ElseIf DTPendienteActual(0)("ContactoMail").ToString.Length <= 0 Then
+ ' DetalleTexto &= String.Format("{0}00{1}", Vacio.PadRight(40), Vacio.PadRight(50))
+ 'End If
+
+ 'Campos 37-39 -- FILLER
+ DetalleTexto &= String.Format("00{0}", Vacio.PadRight(38))
+
+
+ ''LLENA DT PARA REPORTE
+ Dim Row = DtAlta.NewRow()
+ Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString
+ Row("Banco") = DTPendienteActual(0)("BancoNombre").ToString
+ Row("TipoCuenta") = TipoCuentaDeposito
+ Row("Cuenta") = String.Format("{0}", CuentaDeposito)
+ DtAlta.Rows.Add(Row)
+ End Sub
+ Protected Sub FormarTextoAltaFyE(Registros As Integer)
+ '''''' LLENADO HEADER
+ Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString
+ 'Campos #1-4 del Header
+ HeaderTexto = String.Format("H{0}{1}GRUPO01 ", convenio.PadLeft(9, PadCeros), DateTime.Now().ToString("yyyy-MM-dd"))
+ 'Campo #5 del Header
+ HeaderTexto &= String.Format("{0}{1}", UsuarioActual.CveUsuario, DateTime.Now().ToString("yyyyMMdd")).PadRight(20)
+ 'Campos #6-8 del Header
+ HeaderTexto &= String.Format("00").PadRight(586)
+ Dim HeaderLength = HeaderTexto.Length
+
+ ''''' LLENADO DE TRAILER
+ TrailerTexto = String.Format("T{0}{1}{2}", Registros.ToString.PadLeft(10, PadCeros), Vacio.PadRight(50, PadCeros), Vacio.PadRight(575))
+
+ ''''' ARMADO DEL TEXTO COMPLETO
+ TextoCompleto = String.Format("{1}{0}{2}{0}{3}{0}", vbCrLf, HeaderTexto, DetalleTexto, TrailerTexto)
+ 'TxtAltas.Text = TextoCompleto
+ End Sub
+#End Region
+
+
+
+ 'TABS
+#Region "R E P O R T E S"
+ Protected Sub BtnConsultarReportes_Click(sender As Object, e As EventArgs)
+ CargaReporte()
+ End Sub
+
+ Private Sub CargaReporte()
+ Dim ObjBancos As New ClsBancos
+ Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
+ Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
+
+ If ObjBancos.GetLayoutPagosEnviados(DdlCuentaReportes.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, DdlTipoReportes.SelectedValue, FechaI, DateAdd(DateInterval.Day, 1, FechaF.ToDate).ToShortDateString) Then
+ DTReportes = ObjBancos.DtResultados
+ Else
+ DTReportes = Nothing
+ End If
+ ObjBancos.Dispose()
+
+ If DTReportes.Rows.Count > 0 Then
+ GvReportes.DataSource = DTReportes
+ End If
+ GvReportes.DataBind()
+
+ UpDatosReportes.Update()
+
+ End Sub
+
+ Protected Sub GvReportes_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.DataRow Then
+
+ 'Colorea GV
+ If e.Row.DBCampo("CveProveedor").ToString = "" Then
+ e.Row.BackColor = Drawing.Color.LightGray
+ Else
+ e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
+ End If
+ End If
+ End Sub
+
+
+#End Region
+
+
+#Region "C A R G A - M A S I V A"
+ Protected Sub BtnCargaMasiva_Click(sender As Object, e As EventArgs)
+ If DdlTipoCargaMasiva.SelectedValue.ToEntero = 1 Then
+ TipoMasiva = 1
+ GvProveedores.Columns(0).HeaderText = "Proveedor"
+ CargaProveedores()
+ BtnGenerarProveedores.Text = "Generar Layout Alta Proveedores"
+ Else
+ TipoMasiva = 2
+ GvProveedores.Columns(0).HeaderText = "Funcionario"
+ CargaFyE()
+ BtnGenerarProveedores.Text = "Generar Layout Alta Funcionarios"
+ End If
+ End Sub
+ Protected Sub BtnGenerarProveedores_Click(sender As Object, e As EventArgs)
+
+ If Not DdlCuenta.SelectedValue.ToEntero > 0 Then
+ Alert("Primero debe seleccionar una Cuenta", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If TipoMasiva = 1 Then
+ AltaProveedores(2)
+ Else
+ GeneraAltaFyE()
+ End If
+
+ End Sub
+ Private Sub CargaProveedores()
+ Dim ObjBancos As New ClsBancos
+
+ If ObjBancos.GetLayoutProveedores(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
+ DTProveedores = ObjBancos.DtResultados.FiltraParametros("LEN(RFC) IN (12,13)")
+ Else
+ DTProveedores = Nothing
+ End If
+ ObjBancos.Dispose()
+
+ If DTProveedores.Rows.Count > 0 Then
+ GvProveedores.DataSource = DTProveedores
+ End If
+ GvProveedores.DataBind()
+
+ UpProveedores.Update()
+ End Sub
+ Protected Sub GvProveedores_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ If TipoMasiva = 1 Then
+ e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
+ Else
+ e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal"))
+ End If
+ End If
+
+
+
+ End Sub
+#End Region
+
+
+
+ 'CORREO
+#Region " GENERA Y MANDA CORREO "
+ Private Sub MandaCorreo(data As Object)
+ Dim Parametros As List(Of String) = DirectCast(data, List(Of String))
+
+ Dim Mail As New ClsSisMail()
+ Dim Para As String = Parametros(0)
+ Dim Asunto As String = Parametros(1)
+ Dim Body As String = Parametros(2)
+
+ 'NO SE OCUPAN
+ 'Dim CveIE As Integer = Parametros(3).ToEntero
+ 'Dim CveTipoTransaccion As Integer = Parametros(4).ToEntero
+ 'Dim Estatus As Integer = If(CveTipoTransaccion = 2, 2, 1) ' cuando es transferencia, no lo pasa por entregar
+
+ ' Mail.MandaCorreo(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body)
+ Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body)
+ End Sub
+
+ Private Function GeneraCorreo(CveIE As Integer, objIE As ClsBancos) As String
+ Dim strBody As New StringBuilder
+
+ If objIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then
+ strBody.Append(" ")
+ strBody.Append(" ")
+ strBody.Append(" ")
+ strBody.Append(" ")
+ strBody.Append(" ")
+ strBody.AppendFormat("
")
+
+
+ If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then
+ If ObjIE.DtResultados.Rows.Count > 0 Then
+ Dim dtMovs As DataTable
+
+ Dim Mov As New ClsContabilidad
+ If Mov.GetPrePolizasDetalle(-1, CveIE) Then
+ dtMovs = Mov.DtResultados.FiltraParametros("CveConceptoContable IN (17)")
+
+ strBody.Append("
")
+ strBody.Append("
Listado de facturas pagadas
")
+
+ strBody.Append(" ")
+ strBody.Append("
")
+ strBody.Append("
Factura ")
+ strBody.Append("
Fecha ")
+ strBody.Append("
Original ")
+ strBody.Append("
Abonado ")
+ strBody.Append("
Nota Crédito ")
+ strBody.Append("
Saldo ")
+ strBody.Append("
")
+ strBody.Append(" ")
+ strBody.Append(" ")
+
+ For Each Dr2 As DataRow In dtMovs.Rows
+ strBody.Append("
")
+ Next
+
+ strBody.Append(" ")
+ strBody.Append("
")
+
+ strBody.Append("
")
+ strBody.Append(" ")
+ strBody.Append(" ")
+
+ End If
+ Mov.Dispose()
+
+ End If
+ End If
+
+ Return strBody.ToString
+ End Function
+#End Region
+
+
+
+#Region " IMPRIMIR "
+ Protected Sub BtnReporteAltaCarga_Click(sender As Object, e As EventArgs)
+ Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta))
+ Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
+
+
+ 'Estatus visible
+ Dim params As New List(Of ReportParameter)
+ params.Add(New ReportParameter("MostrarEstatus", "True"))
+
+ If Archivo.Exists Then
+ 'ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/LayoutAltaProveedor.rdlc", DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
+ ImprimirPDF(String.Format("{0}Formatos\LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta), DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
+ Else
+ Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
+
+ If Imagen.Exists Then
+ params.Add(New ReportParameter("LogoPath", logouri))
+ Else
+ params.Add(New ReportParameter("LogoPath", ""))
+ End If
+
+
+ params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
+ params.Add(New ReportParameter("Direccion", UsuarioActual.Empresa.Direccion))
+ params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
+ params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy")))
+
+
+ ImprimirPDF("Empresas/Grales/Formatos/LayoutAltaProveedor.rdlc", DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
+ End If
+ End Sub
+ Protected Sub BtnReporteAltaGenera_Click(sender As Object, e As EventArgs)
+ Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta))
+ Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
+
+ 'Estatus no visible
+ Dim params As New List(Of ReportParameter)
+ params.Add(New ReportParameter("MostrarEstatus", "False"))
+
+ If Archivo.Exists Then
+ ImprimirPDF(String.Format("{0}Formatos\LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta), DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
+ Else
+
+ Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
+
+ If Imagen.Exists Then
+ params.Add(New ReportParameter("LogoPath", logouri))
+ Else
+ params.Add(New ReportParameter("LogoPath", ""))
+ End If
+
+ params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
+ params.Add(New ReportParameter("Direccion", UsuarioActual.Empresa.Direccion))
+ params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
+ params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy")))
+ ImprimirPDF("Empresas/Grales/Formatos/LayoutAltaProveedor.rdlc", DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
+ End If
+
+ End Sub
+ Protected Sub BtnReportePago_Click(sender As Object, e As EventArgs)
+ Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta))
+ Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
+
+ Dim params As New List(Of ReportParameter)
+
+
+ If Archivo.Exists Then
+ ImprimirPDF(String.Format("{0}Formatos\LayoutPagoProveedor.rdlc", UsuarioActual.Empresa.Ruta), DtPago, params, "LayoutPagoProveedor", RDSName:="DSPagoElectronicoV2")
+ Else
+ Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
+
+ If Imagen.Exists Then
+ params.Add(New ReportParameter("LogoPath", logouri))
+ Else
+ params.Add(New ReportParameter("LogoPath", ""))
+ End If
+
+ params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
+ params.Add(New ReportParameter("Direccion", UsuarioActual.Empresa.Direccion))
+ params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
+ params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy")))
+ ImprimirPDF("Empresas/Grales/Formatos/LayoutPagoProveedor.rdlc", DtPago, params, "LayoutPagoProveedor", RDSName:="DSPagoElectronicoV2")
+ End If
+
+ End Sub
+#End Region
+
+
+ 'NO QUITAR, SE OCUPA PARA EXPORTAR PDF
+ Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
+ Return
+ End Sub
+
+
+
+End Class
diff --git a/Bancos/PopIECompras.aspx b/Bancos/PopIECompras.aspx
index 9d8a06644..f2f318896 100644
--- a/Bancos/PopIECompras.aspx
+++ b/Bancos/PopIECompras.aspx
@@ -210,7 +210,7 @@
-
diff --git a/Bancos/PopIECompras.aspx.vb b/Bancos/PopIECompras.aspx.vb
index 4a5e80e2b..c27586b07 100644
--- a/Bancos/PopIECompras.aspx.vb
+++ b/Bancos/PopIECompras.aspx.vb
@@ -48,6 +48,17 @@ Partial Class Bancos_PopIECompras
ViewState("CveCompra") = value
End Set
End Property
+
+ Private Property CveTipoConcepto As Integer
+ Get
+ Return ViewState("CveTipoConcepto").ToString.ToEntero
+ End Get
+ Set(value As Integer)
+ ViewState("CveTipoConcepto") = value
+ End Set
+ End Property
+
+
Private Property IdPoliza As Integer
Get
Return ViewState("IdPoliza").ToString.ToEntero
@@ -426,6 +437,7 @@ Partial Class Bancos_PopIECompras
CveProveedor = -1
CveCompra = -1
+ CveTipoConcepto = 1
IdPoliza = -1
CveMoneda = 0
TipoTransaccion = "Egs"
@@ -600,6 +612,7 @@ Partial Class Bancos_PopIECompras
HdnCveProveedor.Value = CveProveedor.ToString
CargaProveedor(CveProveedor, "-1")
CveMoneda = dr("CveMoneda").ToString.ToEntero
+ CveTipoConcepto = dr("CveTipoConcepto").ToString.ToEntero
CveMonedaCompra = dr("CveMoneda").ToString.ToEntero
CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero
SerieFolio = dr("SerieFolio").ToString
@@ -1442,6 +1455,21 @@ Partial Class Bancos_PopIECompras
Select Case ConceptoContable
Case 17 'Pago Proveedores
+
+ If CveTipoConcepto = 2 Then ConceptoContable = 308 'cuando es acreedor
+ If CveMoneda <> 1 Then
+ Select Case ConceptoContable
+ Case 17
+ ConceptoContable = 312
+ Case 308
+ ConceptoContable = 309
+ Case Else
+ End Select
+ End If
+
+ Dim CveConceptoContableComplementaria As Integer = 206
+ If CveTipoConcepto = 2 Then CveConceptoContableComplementaria = 310 'cuando es acreedor
+
If RBLContado.SelectedValue.Contiene("3", "4", "5", "6") Then
For Each rw As GridViewRow In GvIngresos.Rows
If rw.FCCheckBox("Chk").Checked Then
@@ -1483,7 +1511,7 @@ Partial Class Bancos_PopIECompras
IdCtaContable = IdCtaContComplementaria
CveCuenta = CveCuentaComplementaria
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, 206, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
@@ -1534,7 +1562,7 @@ Partial Class Bancos_PopIECompras
IdCtaContable = IdCtaContComplementaria
CveCuenta = CveCuentaComplementaria
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, 206, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
@@ -1584,7 +1612,7 @@ Partial Class Bancos_PopIECompras
IdCtaContable = IdCtaContComplementaria
CveCuenta = CveCuentaComplementaria
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, 206, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
@@ -1633,7 +1661,7 @@ Partial Class Bancos_PopIECompras
IdCtaContable = IdCtaContComplementaria
CveCuenta = CveCuentaComplementaria
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, 206, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, rw.DataKey("CveVenta").ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, rw.DataKey("CveVenta").ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
@@ -1671,7 +1699,7 @@ Partial Class Bancos_PopIECompras
IdCtaContable = IdCtaContComplementaria
CveCuenta = CveCuentaComplementaria
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, 206, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, TxtObservaciones.Text, CveConceptoContableComplementaria, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioCompra - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompra, CveCuenta:=CveCuenta) Then
MsgError = "No se pudo insertar la póliza"
End If
ImporteMX = ImporteMovimiento
diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx
index 23de03c5a..3ddb46e81 100644
--- a/Bancos/ProveedoresAbonar.aspx
+++ b/Bancos/ProveedoresAbonar.aspx
@@ -358,7 +358,7 @@
diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb
index bf0ac93bf..a067637eb 100644
--- a/Bancos/ProveedoresAbonar.aspx.vb
+++ b/Bancos/ProveedoresAbonar.aspx.vb
@@ -939,6 +939,18 @@ Partial Class Bancos_ProveedoresAbonar
Select Case ConceptoContable
Case 17 'Pago Proveedores
+
+ If gvr.DataKey("CveTipoConcepto").ToEntero = 2 Then ConceptoContable = 308 'cuando es acreedor
+ If CveMoneda <> 1 Then
+ Select Case ConceptoContable
+ Case 17
+ ConceptoContable = 312
+ Case 308
+ ConceptoContable = 309
+ Case Else
+ End Select
+ End If
+
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
importeMX = ImporteMovimiento
@@ -961,12 +973,15 @@ Partial Class Bancos_ProveedoresAbonar
IdCtaContable = CtaProveedor
CveCuenta = CveCuentaProveedor
Else
+ Dim CveConceptoComplementaria As Integer = 206
+ If gvr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoComplementaria = 310
+
ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
IdCtaContable = IdCtaContComplementaria
CveCuenta = CveCuentaProveedorExtranjera
If ImporteMovimiento <> 0 AndAlso (UsuarioActual.CveEmpresa = 119 Or IdCtaContable > 0) Then 'Cuando tiene complementaria lo dividimos en dos
importeMX = ImporteMovimiento
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0.00D, Referencia, 206, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=Math.Round(ImporteMovimiento * tipoCambioCompraValuacion - ImporteMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompraValuacion, CveCuenta:=CveCuentaComplementaria) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0.00D, Referencia, CveConceptoComplementaria, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=Math.Round(ImporteMovimiento * tipoCambioCompraValuacion - ImporteMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioCompraValuacion, CveCuenta:=CveCuentaComplementaria) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
@@ -2072,7 +2087,18 @@ Partial Class Bancos_ProveedoresAbonar
'Saco el porcentaje de pago
If gvr.DataKey("Original").ToDouble > 0 Then PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal / gvr.DataKey("Original").ToDecimal Else PorcentajePago = 1
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, gvr.FCTextBox("TxtAbonar").Text.ToDecimal, TxtObservaciones.Text, 17, "", Now, 0, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=gvr.FCTextBox("TxtAbonar").Text.ToDecimal) Then
+ Dim CveConceptoContablePago As Integer = 17
+ If gvr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoContablePago = 308 'cuando es acreedor
+ If CveMoneda <> 1 Then
+ Select Case CveConceptoContablePago
+ Case 17
+ CveConceptoContablePago = 312
+ Case 308
+ CveConceptoContablePago = 309
+ Case Else
+ End Select
+ End If
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, gvr.FCTextBox("TxtAbonar").Text.ToDecimal, TxtObservaciones.Text, CveConceptoContablePago, "", Now, 0, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=gvr.FCTextBox("TxtAbonar").Text.ToDecimal) Then
MsgError = "Detalle"
Exit For
Else
@@ -2389,6 +2415,10 @@ Partial Class Bancos_ProveedoresAbonar
'cuando es layout
If tTipoTransaccion = 9 Then
dt = dt.FiltraParametros("UsaLayout = 1")
+ End If
+
+ If tTipoTransaccion = 17 Then
+ dt = dt.FiltraParametros("UsaLayoutGrupos = 1")
End If
DdlCuenta.DataSource = dt
@@ -2462,7 +2492,8 @@ Partial Class Bancos_ProveedoresAbonar
Dim Dep As New ClsGenerales
If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor) Then
- If Dep.DtResultados.FiltraParametros("Estatus ='True'").Rows.Count > 0 Then
+ If Dep.DtResultados.FiltraParametros("Estatus ='True'").Rows.Count > 0 Then
+
If DdlTipoTransaccion.SelectedValue = "9" Then
If Dep.DtResultados.Rows.Count > 0 Then
@@ -2477,6 +2508,20 @@ Partial Class Bancos_ProveedoresAbonar
Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia)
End If
+ ElseIf DdlTipoTransaccion.SelectedValue = "17" Then
+
+ If Dep.DtResultados.Rows.Count > 0 Then
+ DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("EstatusPagoElectronicoGrupos = 'True' AND Estatus ='True'")
+ End If
+
+ If Dep.DtResultados.FiltraParametros("EstatusPagoElectronicoGrupos = 'True' AND Estatus ='True'").Rows.Count > 0 Then
+ trCuentaDeposito.Visible = True
+ DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1"))
+ Else
+ BtnIEGuardar.Enabled = False
+ Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia)
+ End If
+
Else
DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("Estatus ='True'")
If Dep.DtResultados.Rows.Count > 0 Then
@@ -2879,8 +2924,22 @@ Partial Class Bancos_ProveedoresAbonar
Dim TCCompra As Decimal = gr.DataKey("TipoCambio").ToDecimal
Dim TCPago As Decimal = GlobalTipoCambio(TxtFechaIncobrable.Text.ToDate).ToDecimal
Dim CveMoneda As Integer = gr.DataKey("CveMoneda").ToEntero
- Dim FechaCompra As Date = gr.DataKey("Fecha").ToDate
+ Dim FechaCompra As Date = gr.DataKey("Fecha").ToDate
+
+ Dim CveConceptoContablePago As Integer = 17
+ If gr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoContablePago = 308 'cuando es acreedor
+ If CveMoneda <> 1 Then
+ Select Case CveConceptoContablePago
+ Case 17
+ CveConceptoContablePago = 312
+ Case 308
+ CveConceptoContablePago = 309
+ Case Else
+ End Select
+ End If
+ Dim CveConceptoContableComplementaria As Integer = 206
+ If gr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoContableComplementaria = 310 'cuando es acreedor
Dim ConceptoPartida As String = String.Format("Saldar compra {0}", gr.DataKey("SerieFolio").ToString)
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/ProveedoresAbonar/Saldar", 98, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, TxtFechaIncobrable.Text.ToDate, ConceptoPartida, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
@@ -2888,13 +2947,13 @@ Partial Class Bancos_ProveedoresAbonar
If CveMoneda > 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then
IdCtaContable = IdCtaContComplementaria
CveCuenta = CveCuentaProveedorExtranjera
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, 0.00D, gr.DataKey("SerieFolio").ToString, 206, ConceptoPartida, Now, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=Math.Round(Saldo * TCCompra - Saldo, 2, MidpointRounding.AwayFromZero), ImporteME:=Saldo, TipoCambio:=TCCompra, CveCuenta:=CveCuentaComplementaria) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, 0.00D, gr.DataKey("SerieFolio").ToString, CveConceptoContableComplementaria, ConceptoPartida, Now, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=Math.Round(Saldo * TCCompra - Saldo, 2, MidpointRounding.AwayFromZero), ImporteME:=Saldo, TipoCambio:=TCCompra, CveCuenta:=CveCuentaComplementaria) Then
MsgError = "No se pudo insertar la póliza"
End If
IdCtaContable = IdCtaProveedorExtranjera
CveCuenta = CveCuentaProveedorExtranjera
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Saldo, gr.DataKey("SerieFolio").ToString, 17, ConceptoPartida, Now, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=Saldo, ImporteME:=If(CveMoneda > 1, Saldo, 0), TipoCambio:=TCCompra, CveCuenta:=CveCuenta) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoContablePago, ConceptoPartida, Now, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=Saldo, ImporteME:=If(CveMoneda > 1, Saldo, 0), TipoCambio:=TCCompra, CveCuenta:=CveCuenta) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
Else
@@ -2902,7 +2961,7 @@ Partial Class Bancos_ProveedoresAbonar
IdCtaContable = IdCtaProveedorExtranjera
CveCuenta = CveCuentaProveedorExtranjera
End If
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Saldo, gr.DataKey("SerieFolio").ToString, 17, ConceptoPartida, Now, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, Saldo, Saldo * TCCompra), ImporteME:=If(CveMoneda > 1, Saldo, 0), TipoCambio:=TCCompra, CveCuenta:=CveCuenta) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoContablePago, ConceptoPartida, Now, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, Saldo, Saldo * TCCompra), ImporteME:=If(CveMoneda > 1, Saldo, 0), TipoCambio:=TCCompra, CveCuenta:=CveCuenta) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
End If
diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx
index 6e0b5e8f0..0ea14cbaa 100644
--- a/Compras/Compras.aspx
+++ b/Compras/Compras.aspx
@@ -4692,7 +4692,7 @@
-
+
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 497f49e32..de7d61293 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -1621,7 +1621,6 @@ Partial Class Compras_Compras
' 'End If
'End If
-
'RegistraScript("ScrollVentanaAddProducto();")
End Sub
@@ -2193,7 +2192,7 @@ Partial Class Compras_Compras
If Msg <> "" Then
Alert($"El comprobante XML presenta las siguientes inconsistencias:
{Msg}", TipoMensaje.MsgAdvertencia)
- TAB.ActiveTabIndex = 0
+ Tab.ActiveTabIndex = 0
''''BLOQUEA ACCIONES''''
BtnGuardar.Enabled = False
@@ -2440,6 +2439,7 @@ Partial Class Compras_Compras
CvePrePoliza = dr("CvePrePoliza").ToString.ToEntero
EstatusAlmacen = dr("EstatusAlmacen").ToString.ToEntero
DdlTipoCompra.SelectedValueExist(dr("CveTipoCompra"))
+ CveTipoConcepto = dr("CveTipoConcepto").ToString.ToEntero
'Select Case dr("PorcentajeIVA").ToString.ToDouble
' Case 0
' DdlIVA.SelectedValue = "1"
@@ -2760,9 +2760,9 @@ Partial Class Compras_Compras
TxtSerie.Enabled = False
TxtFolio.Enabled = False
- TxtFecha.Enabled = UsuarioActual.TienePermisoProceso(216)
- ImgFecha.Enabled = UsuarioActual.TienePermisoProceso(216)
- CEFecha.Enabled = UsuarioActual.TienePermisoProceso(216)
+ TxtFecha.Enabled = False
+ ImgFecha.Enabled = False
+ CEFecha.Enabled = False
DdlProveedor.Enabled = False
DdlProveedorSucursal.Enabled = False
@@ -2872,7 +2872,7 @@ Partial Class Compras_Compras
'BLOQUEA OC
TxtOC.Enabled = False
ImgBtnBuscarOC.Visible = False
- TAB.ActiveTabIndex = 0
+ Tab.ActiveTabIndex = 0
GvAnticiposSel.DataSource = dtnc
GvAnticiposSel.DataBind()
@@ -4850,7 +4850,7 @@ Partial Class Compras_Compras
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
- If UsuarioActual.CveEmpresa = 119 AndAlso (DdlPersonalReembolso.SelectedValue.ToEntero > 0 Or DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero > 0) Then
+ If UsuarioActual.CveEmpresa = 119 AndAlso (DdlPersonalReembolso.SelectedValue.ToEntero > 0 Or DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero > 0 Or DdlTipoComprobante.SelectedValue = "Ant") Then
AutoConta = False
End If
@@ -5226,7 +5226,29 @@ Partial Class Compras_Compras
'P R E P O L I Z A S
Dim CveConceptoAfectacion As Integer = 5 'Proveedores
+ If CveTipoConcepto = 2 Then CveConceptoAfectacion = 305 'cuando es acreedor
+ If CveMoneda <> 1 Then
+ Select Case CveConceptoAfectacion
+ Case 5
+ CveConceptoAfectacion = 311
+ Case 305
+ CveConceptoAfectacion = 306
+ Case Else
+ End Select
+ End If
+
Dim CveConceptoAfectacionContado As Integer = 17 'Pago Proveedores
+ If CveTipoConcepto = 2 Then CveConceptoAfectacionContado = 308 'cuando es acreedor
+ If CveMoneda <> 1 Then
+ Select Case CveConceptoAfectacionContado
+ Case 17
+ CveConceptoAfectacionContado = 312
+ Case 308
+ CveConceptoAfectacionContado = 309
+ Case Else
+ End Select
+ End If
+
Dim CveConceptoCompra As Integer = 6 'Compra
Dim CveConceptoIVA As Integer = 14 'IVA Trasladado
Dim CveConceptoRetIVA As Integer = 15 'Ret IVA
@@ -5618,6 +5640,17 @@ Partial Class Compras_Compras
Case 17 'Pago Proveedores
+ If CveTipoConcepto = 2 Then ConceptoContable = 308 'cuando es acreedor
+ If CveMoneda <> 1 Then
+ Select Case ConceptoContable
+ Case 17
+ ConceptoContable = 312
+ Case 308
+ ConceptoContable = 309
+ Case Else
+ End Select
+ End If
+
importeMovimiento = importePagoProv
If CveMonedaPago = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 1 Then
importeMovimiento = importeMovimiento / TipoCambioCompra
@@ -5632,7 +5665,7 @@ Partial Class Compras_Compras
Dim IdSegmentoNegocio As Integer = -1
For Each Row2 As DataRow In TmpDT.Rows
- importeMovimiento = TxtTotal.Text.ToDecimal 'TmpDT.SUM("Total", String.Format("ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And ISNULL(AplicaCostoIndirecto,0) <> 1 And CveClasificacion = {0} And CveSubProyecto = {1} And ISNULL(CveTipoGasto,0) = {2}", Row2("CveClasificacion").ToString.ToEntero, Row2("CveSubProyecto").ToString.ToEntero, Row2("CveTipoGasto").ToString.ToEntero)).ToString.ToDecimal
+ importeMovimiento = TxtTotal.Text.ToDecimal 'TmpDT.SUM("Total", String.Format("ISNULL(TipoAF, 0) <> 2 And ISNULL(CveAlmacen, 0) = 0 And ISNULL(AplicaCostoIndirecto, 0) <> 1 And CveClasificacion = {0} And CveSubProyecto = {1} And ISNULL(CveTipoGasto, 0) = {2} Then", Row2("CveClasificacion").ToString.ToEntero, Row2("CveSubProyecto").ToString.ToEntero, Row2("CveTipoGasto").ToString.ToEntero)).ToString.ToDecimal
importeMN = importeMovimiento * tipoCambioActual * Multiplicador
'CLASIFICACION
If Row2("CveClasificacion").ToString.ToEntero > 0 Then
@@ -5719,7 +5752,7 @@ Partial Class Compras_Compras
End If
- If TipoCambioCompra > 1 AndAlso DdlMoneda.SelectedValue.ToEntero <> 1 Then Concepto += $" TC:{TipoCambioCompra} ${importeMovimiento.FormatoNumero(2)}"
+ If TipoCambioCompra > 1 AndAlso DdlMoneda.SelectedValue.ToEntero <> 1 Then Concepto += $" TC{TipoCambioCompra} ${importeMovimiento.FormatoNumero(2)}"
If TipoCambioCompra = 1 Or DdlMoneda.SelectedValue.ToEntero = 1 Then
IdCtaContable = CtaProveedor
@@ -5729,8 +5762,12 @@ Partial Class Compras_Compras
IdCtaContable = CtaProveedorComplementaria
CveCuenta = CveCuentaProveedorComplementaria
If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0) Then 'Cuando tiene complementaria lo dividimos en dos
+
+ Dim CveConceptoContableComplementaria As Integer = 206
+ If CveTipoConcepto = 2 Then CveConceptoContableComplementaria = 310 'cuando es acreedor
+
importeMN = importeMovimiento
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento * TipoCambioCompra - importeMovimiento, Referencia, 206, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * TipoCambioCompra - importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=TipoCambioCompra) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento * TipoCambioCompra - importeMovimiento, Referencia, CveConceptoContableComplementaria, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * TipoCambioCompra - importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=TipoCambioCompra) Then
ErrorPrepoliza = True
End If
End If
@@ -5746,7 +5783,7 @@ Partial Class Compras_Compras
End If
importeMN = importeMovimiento * TCPago * Multiplicador
- If TCPago > 1 AndAlso CveMonedaPago <> 1 Then Concepto += $" TC:{TCPago} ${importeMovimiento.FormatoNumero(2)}"
+ If TCPago > 1 AndAlso CveMonedaPago <> 1 Then Concepto += $" TC{TCPago} ${importeMovimiento.FormatoNumero(2)}"
If TCPago = 1 Or CveMonedaPago = 1 Then
IdCtaContable = IdCuentaBancaria
@@ -5802,16 +5839,16 @@ Partial Class Compras_Compras
End If
End If
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 14, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaIva, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVA, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 14, Concepto + If(tipoCambioActual > 1, $" TC {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaIva, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVA, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
ErrorPrepoliza = True
End If
End If
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
Case 14 'IVA X Acreditar
importeMovimiento = importeIVAxAcreditar
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
PorcentajeImpuesto = PorcentajeIVA
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
@@ -5824,7 +5861,7 @@ Partial Class Compras_Compras
If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then
importeMovimiento = ImporteIEPSxAcreditar
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
@@ -5837,7 +5874,7 @@ Partial Class Compras_Compras
If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then
importeMovimiento = OtrosImpuestos
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
IdCtaContable = If(UsuarioActual.CveEmpresa = 119, 1171, -1)
CveCuenta = -1
End If
@@ -5863,12 +5900,12 @@ Partial Class Compras_Compras
End If
End If
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 25, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaIEPS, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIEPS, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 25, Concepto + If(tipoCambioActual > 1, $" TC {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaIEPS, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIEPS, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
ErrorPrepoliza = True
End If
End If
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
End If
Case 22 'RetIVA Acreditable Honorarios/Serv. Prof.
@@ -5899,12 +5936,12 @@ Partial Class Compras_Compras
'Agregamos el Opuesto del 22 -> 15
If importeMovimiento <> 0 Then
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 15, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 15, Concepto + If(tipoCambioActual > 1, $" TC {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
ErrorPrepoliza = True
End If
End If
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
End If
End If
End If
@@ -5914,7 +5951,7 @@ Partial Class Compras_Compras
If DdlRetIVAConcepto.SelectedValue.ToEntero = 1 Then
importeMovimiento = importeRetIVAxAcreditar
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
If CtaProveedorRetIVA > 0 Then
IdCtaContable = CtaProveedorRetIVA
CveCuenta = CveCuentaProveedorRetIVA
@@ -5953,12 +5990,12 @@ Partial Class Compras_Compras
'Agregamos el Opuesto del 184 -> 183
If importeMovimiento <> 0 Then
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 183, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 183, Concepto + If(tipoCambioActual > 1, $" TC {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
ErrorPrepoliza = True
End If
End If
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
End If
End If
End If
@@ -5968,7 +6005,7 @@ Partial Class Compras_Compras
If DdlRetIVAConcepto.SelectedValue.ToEntero = 2 Then
importeMovimiento = importeRetIVAxAcreditar
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
If CtaProveedorRetIVA > 0 Then
IdCtaContable = CtaProveedorRetIVA
CveCuenta = CveCuentaProveedorRetIVA
@@ -5990,7 +6027,7 @@ Partial Class Compras_Compras
If DdlRetIVAConcepto.Items.Count > 0 AndAlso DdlRetIVAConcepto.SelectedValue.ToEntero = 4 Then
importeMovimiento = importeRetIVAxAcreditar
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
If CtaProveedorRetIVA > 0 Then
IdCtaContable = CtaProveedorRetIVA
CveCuenta = CveCuentaProveedorRetIVA
@@ -6029,12 +6066,12 @@ Partial Class Compras_Compras
'Agregamos el Opuesto del 186 -> 185
If importeMovimiento <> 0 Then
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 185, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 185, Concepto + If(tipoCambioActual > 1, $" TC {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then
ErrorPrepoliza = True
End If
End If
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
End If
End If
End If
@@ -6044,7 +6081,7 @@ Partial Class Compras_Compras
If DdlRetIVAConcepto.SelectedValue.ToEntero = 3 Then
importeMovimiento = importeRetIVAxAcreditar
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
If CtaProveedorRetIVA > 0 Then
IdCtaContable = CtaProveedorRetIVA
CveCuenta = CveCuentaProveedorRetIVA
@@ -6080,7 +6117,7 @@ Partial Class Compras_Compras
End If
End If
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
End If
End If
@@ -6105,12 +6142,12 @@ Partial Class Compras_Compras
' 'Agregamos el Opuesto del 23 -> 16
' If importeMovimiento <> 0 Then
- ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 15, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
+ ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 15, Concepto + If(tipoCambioActual > 1, $" TC {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
' ErrorPrepoliza = True
' End If
' End If
- ' If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ ' If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
' End If
' End If
Case 16 'Ret ISR X Acreditar
@@ -6118,7 +6155,7 @@ Partial Class Compras_Compras
If DdlRetISRConcepto.Items.Count > 0 AndAlso DdlRetISRConcepto.SelectedValue.ToEntero = 1 Then
importeMovimiento = importeRetISRxAcreditar
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
If CtaProveedorRetISR > 0 Then
IdCtaContable = CtaProveedorRetISR
CveCuenta = CveCuentaProveedorRetISR
@@ -6153,7 +6190,7 @@ Partial Class Compras_Compras
End If
End If
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
End If
End If
'Case 244 'RetISR Acreditable Terceros y Arrendamiento
@@ -6176,11 +6213,11 @@ Partial Class Compras_Compras
' End If
' 'Agregamos el Opuesto del 244 -> 243
' If importeMovimiento <> 0 Then
- ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 243, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
+ ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 243, Concepto + If(tipoCambioActual > 1, $" TC {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
' ErrorPrepoliza = True
' End If
' End If
- ' If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ ' If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
' End If
' End If
Case 64 'Ganancia
@@ -6249,7 +6286,7 @@ Partial Class Compras_Compras
If Not CveCompraRefacturacion > 0 OrElse ChkRefacNC.Checked Then
'AF TipoAF 2 Es para las compras
- DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) = 2 AND ISNULL(AplicaCostoIndirecto,0) <> 1")
+ DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) = 2 And ISNULL(AplicaCostoIndirecto,0) <> 1")
If DT.Rows.Count > 0 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then
For Each Row2 As DataRow In DT.Rows
importeMovimiento = If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, Row2("ImporteSinImpuestos").ToString.ToDecimal, Row2("Total").ToString.ToDecimal)
@@ -6287,7 +6324,7 @@ Partial Class Compras_Compras
'COSTO ALMACEN
Dim DtAlmacenes = GlobalDTAlmacen(UsuarioActual.CveEmpresa)
If UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then
- DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) > 0", "", {"CveAlmacen"})
+ DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) > 0", "", {"CveAlmacen"})
'RECORREMOS PARA DETECTAR LA MODALIDAD DEL ALMACEN, EN CASO DE SER SOLO EXISTENCIA LIMPIAMOS CVEALMACEN
For Each Dr As DataRow In DT.Rows
If DtAlmacenes.FiltroPrimeroValor("Modalidad", $"CveAlmacen = {Dr("CveAlmacen").ToString.ToEntero}").ToString = "Solo Existencia" Then
@@ -6340,7 +6377,7 @@ Partial Class Compras_Compras
'INV [MERCANCIA RECIBIDA POR ADELANTADO (OC) | MERCANCIA PENDIENTE POR RECIBIR (COMPRA) ]
If AgregaMercanciaInventario AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") AndAlso CveConceptoContableAlmacen.Contiene(205, 176, 237, 240) Then
- importeMovimiento = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND (ISNULL(CveTipoPS,0) = 2 OR (ISNULL(CveTipoPS,0) = 1 AND ISNULL(AplicaCostoIndirecto,0) = 1))").ToString.ToDecimal
+ importeMovimiento = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And (ISNULL(CveTipoPS,0) = 2 Or (ISNULL(CveTipoPS,0) = 1 And ISNULL(AplicaCostoIndirecto,0) = 1))").ToString.ToDecimal
importeMN = importeMovimiento * tipoCambioActual * Multiplicador
Dim ConceptoContabilizacion = 205
@@ -6390,9 +6427,9 @@ Partial Class Compras_Compras
Select Case ConceptoContabilizacion
Case 176
Dim SumatoriaOCINV = 0.0D, Importe176 = 0.0D, ImporteME176 = 0.0D, ImporteMN176 = 0.0D, Importe228 = 0.0D, ImporteME228 = 0.0D, ImporteMN228 = 0.0D, Importe229 = 0.0D, ImporteME229 = 0.0D, ImporteMN229 = 0.0D, ImporteCI176 = 0.0D
- For Each Dr As DataRow In TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND ISNULL(CveTipoPS,0) = 2").Rows
+ For Each Dr As DataRow In TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And ISNULL(AplicaCostoIndirecto,0) <> 1 And ISNULL(CveTipoPS,0) = 2").Rows
If ObjOC.OrdenesCompraDetalleCostoPP(Dr("CveOrdenCompraDetalle").ToString.ToEntero) AndAlso ObjOC.DtResultados.Rows.Count >= 1 Then
- Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text} OC: {ObjOC.DtResultados.FiltroPrimeroValor("Folio").ToString} Inv:{ObjOC.DtResultados.FiltroPrimeroValor("FolioAlmacen").ToString}"
+ Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text} OC {ObjOC.DtResultados.FiltroPrimeroValor("Folio").ToString} Inv{ObjOC.DtResultados.FiltroPrimeroValor("FolioAlmacen").ToString}"
Importe176 = ObjOC.DtResultados.FiltroPrimeroValor("Importe176").ToDecimal * Dr("Cantidad").ToString.ToDecimal : ImporteME176 = ObjOC.DtResultados.FiltroPrimeroValor("ImporteME176").ToDecimal * Dr("Cantidad").ToString.ToDecimal : ImporteMN176 = ObjOC.DtResultados.FiltroPrimeroValor("ImporteMN176").ToDecimal * Dr("Cantidad").ToString.ToDecimal
Importe228 = ObjOC.DtResultados.FiltroPrimeroValor("Importe228").ToDecimal * Dr("Cantidad").ToString.ToDecimal : ImporteME228 = ObjOC.DtResultados.FiltroPrimeroValor("ImporteME228").ToDecimal * Dr("Cantidad").ToString.ToDecimal : ImporteMN228 = ObjOC.DtResultados.FiltroPrimeroValor("ImporteMN228").ToDecimal * Dr("Cantidad").ToString.ToDecimal
Importe229 = ObjOC.DtResultados.FiltroPrimeroValor("Importe229").ToDecimal * Dr("Cantidad").ToString.ToDecimal : ImporteME229 = ObjOC.DtResultados.FiltroPrimeroValor("ImporteME229").ToDecimal * Dr("Cantidad").ToString.ToDecimal : ImporteMN229 = ObjOC.DtResultados.FiltroPrimeroValor("ImporteMN229").ToDecimal * Dr("Cantidad").ToString.ToDecimal
@@ -6466,7 +6503,7 @@ Partial Class Compras_Compras
'NC CON PRODUCTOS - CUENTA PUENTE
If RegistraConcepto225 Then
- importeMovimiento = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND ISNULL(CveTipoPS,0) = 2").ToString.ToDecimal
+ importeMovimiento = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And ISNULL(AplicaCostoIndirecto,0) <> 1 And ISNULL(CveTipoPS,0) = 2").ToString.ToDecimal
importeMN = importeMovimiento * tipoCambioActual * Multiplicador
Dim ConceptoContabilizacionNC = 225
@@ -6509,7 +6546,7 @@ Partial Class Compras_Compras
Next
If ContienePSNeteoBonif Then
- importeMovimiento = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 ").ToString.ToDecimal
+ importeMovimiento = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And ISNULL(AplicaCostoIndirecto,0) <> 1 ").ToString.ToDecimal
importeMN = importeMovimiento * tipoCambioActual * Multiplicador
Dim IdCtaContableDescCompra As Integer = UsuarioActual.Empresa.Funcionalidad(405).ToEntero
If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importeMovimiento, Referencia, 259, Concepto, FechaMovimiento, IdCtaContableDescCompra, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then
@@ -6657,14 +6694,24 @@ Partial Class Compras_Compras
End If
Case 5 'Proveedores
If CveTipoConcepto = 2 Then ConceptoContable = 305 'cuando es acreedor
+ If tipoCambioActual <> 1 Then
+ Select Case ConceptoContable
+ Case 5
+ ConceptoContable = 311
+ Case 305
+ ConceptoContable = 306
+ Case Else
+ End Select
+ End If
+
If Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") Then
importeMovimiento = importeProv
importeMN = importeMovimiento * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
- Dim CveConceptoComplementario As Integer = 201
- If CveTipoConcepto = 2 Then CveConceptoComplementario = 310
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ Dim CveConceptoContableComplementaria As Integer = 201
+ If CveTipoConcepto = 2 Then CveConceptoContableComplementaria = 307
If tipoCambioActual = 1 Then
IdCtaContable = CtaProveedor
@@ -6674,7 +6721,7 @@ Partial Class Compras_Compras
CveCuenta = CveCuentaProveedorComplementaria
If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0 Or UsuarioActual.CveEmpresa = 119) Then 'Cuando tiene complementaria lo dividimos en dos Then
importeMN = importeMovimiento
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, CveConceptoComplementario, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * tipoCambioActual - importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, CveConceptoContableComplementaria, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * tipoCambioActual - importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
End If
End If
@@ -6754,7 +6801,7 @@ Partial Class Compras_Compras
Case 18 'NC - Notas de Credito
importeMovimiento = importeNC
importeMN = importeMovimiento * tipoCambioActual * Multiplicador
- If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
+ If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
IdCtaContable = CtaProveedor
CveCuenta = CveCuentaProveedor
If DdlMoneda.SelectedValue.ToEntero <> 1 And UsuarioActual.CveEmpresa.Contiene(119) Then
@@ -6792,9 +6839,13 @@ Partial Class Compras_Compras
IdCtaContable = CtaProveedorExtranjera
CveCuenta = CveCuentaProveedorExtranjera
If ObjConta.AddPrePolizasDetalle(CvePrePolizaTemp, False, importeMovimientoNC, Referencia, 272, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=Gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=TipoCambioFactura, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, CveCompraAmortizacion:=CveCompra) Then
+
+ Dim CveConceptoContableComplementaria As Integer = 206
+ If Gvr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoContableComplementaria = 310 'cuando es acreedor
+
IdCtaContable = CtaProveedorComplementaria
CveCuenta = CveCuentaProveedorComplementaria
- If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTemp, False, importeMNNC - importeMovimientoNC, Referencia, 206, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=Gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMNNC - importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=TipoCambioFactura, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, CveCompraAmortizacion:=CveCompra) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTemp, False, importeMNNC - importeMovimientoNC, Referencia, CveConceptoContableComplementaria, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=Gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMNNC - importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=TipoCambioFactura, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, CveCompraAmortizacion:=CveCompra) Then
ErrorPrepoliza = True
Exit For
End If
@@ -6991,9 +7042,13 @@ Partial Class Compras_Compras
IdCtaContable = CtaProveedorExtranjera
CveCuenta = CveCuentaProveedorExtranjera
If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimientoNC, Referencia, 272, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=tipoCambioActual, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
+
+ Dim CveConceptoContableComplementaria As Integer = 206
+ If CveTipoConcepto = 2 Then CveConceptoContableComplementaria = 310 'cuando es acreedor
+
IdCtaContable = CtaProveedorComplementaria
CveCuenta = CveCuentaProveedorComplementaria
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMNNC - importeMovimientoNC, Referencia, 206, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMNNC - importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=tipoCambioActual, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMNNC - importeMovimientoNC, Referencia, CveConceptoContableComplementaria, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMNNC - importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=tipoCambioActual, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
End If
@@ -7053,9 +7108,13 @@ Partial Class Compras_Compras
IdCtaContable = CtaProveedorExtranjera ' CtaProveedorAnticiposExtranjera
CveCuenta = CveCuentaProveedorExtranjera 'CveCuentaProveedorAnticiposExtranjera
If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimientoNC, Referencia, 272, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=tipoCambioActual, CveCuenta:=CveCuenta, CveCompraAmortizacion:=CveCompraNC, Contabilizable:=SeContabiliza) Then
+
+ Dim CveConceptoContableComplementaria As Integer = 206
+ If CveTipoConcepto = 2 Then CveConceptoContableComplementaria = 310 'cuando es acreedor
+
IdCtaContable = CtaProveedorExtranjera 'CtaProveedorAnticiposComplementaria
CveCuenta = CveCuentaProveedorExtranjera 'CveCuentaProveedorAnticiposComplementaria
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMNNC - importeMovimientoNC, Referencia, 206, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMNNC - importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=tipoCambioActual, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMNNC - importeMovimientoNC, Referencia, CveConceptoContableComplementaria, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMNNC - importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=tipoCambioActual, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
End If
@@ -7151,6 +7210,8 @@ Partial Class Compras_Compras
End If
If TxtTotal.Text.ToDouble > 0 AndAlso TieneAnticiposXML = False Then
+ Dim CveConceptoContableComplementaria As Integer = 201
+ If CveTipoConcepto = 2 Then CveConceptoContableComplementaria = 307
Dim IdCtaContablePago As Integer = CtaProveedor
Dim CveCuentaPago As Integer = CveCuentaProveedor
Dim usacomplementariaProveedor As Boolean = False
@@ -7158,7 +7219,7 @@ Partial Class Compras_Compras
If usacomplementariaProveedor Then
Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}"
importeMN = tipoCambioActual * importeMovimiento - importeMovimiento
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 201, Concepto, FechaMovimiento, CtaProveedorComplementaria, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaProveedorComplementaria, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, CveConceptoContableComplementaria, Concepto, FechaMovimiento, CtaProveedorComplementaria, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaProveedorComplementaria, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
End If
importeMN = importeMovimiento
@@ -7169,8 +7230,20 @@ Partial Class Compras_Compras
CveCuentaPago = CveCuentaProveedorExtranjera
End If
+ Dim CveConceptoContablePago As Integer = 17
+ If CveTipoConcepto = 2 Then CveConceptoContablePago = 308 'cuando es acreedor
+ If tipoCambioActual > 1 Then
+ Select Case CveConceptoContablePago
+ Case 17
+ CveConceptoContablePago = 312
+ Case 308
+ CveConceptoContablePago = 309
+ Case Else
+ End Select
+ End If
+
'Agregamos el 17
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 17, Concepto, FechaMovimiento, IdCtaContablePago, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaPago, Contabilizable:=SeContabiliza) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, CveConceptoContablePago, Concepto, FechaMovimiento, IdCtaContablePago, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaPago, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
End If
@@ -7267,7 +7340,7 @@ Partial Class Compras_Compras
Exit For
End If
- If importeMovimiento <> 0 Or (ConceptoContable.Contiene(5) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Fac", "Ant")) Or (ConceptoContable.Contiene(18) AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not GuardoConcepto18) Then
+ If importeMovimiento <> 0 Or (ConceptoContable.Contiene(5, 305, 306, 311) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Fac", "Ant")) Or (ConceptoContable.Contiene(18) AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not GuardoConcepto18) Then
'Conta ContPAQ
If IdCtaContable = 0 Then
CuentasContablesInvalidas.Append(" " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString)
@@ -7305,7 +7378,7 @@ Partial Class Compras_Compras
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 4) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
- GuardaLogAD($"Compras/Compras-Guardar | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
+ GuardaLogAD($"Compras/Compras-Guardar | Error{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
ErrorPrepolizaDescuadre = True
End If
End If
@@ -7341,7 +7414,7 @@ Partial Class Compras_Compras
'si hay una diferencia entre lo amortizado y el total, se registra la diferencia a proveedores y los ivas por acreditar
If TxtTotal.Text.ToDouble - ImporteAnticipo > 0 Then
PorcentajePago = (TxtTotal.Text.ToDecimal - ImporteAnticipo) / TxtTotal.Text.ToDecimal
- ConceptoRenglon = String.Format("GE Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
+ ConceptoRenglon = String.Format("GE Fact {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
If Not ObjContaAC.AddMovimiento(IdPoliza, CtaProveedor, True, TxtTotal.Text.ToDouble - ImporteAnticipo, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
ErrorACMEnsaje.Append(" - si hay una diferencia entre lo amortizado y el total, se registra la diferencia a proveedores y los ivas por acreditar ObjContaAC.AddMovimiento")
ErrorAC = True
@@ -7359,7 +7432,7 @@ Partial Class Compras_Compras
'EJERCIDO
If True Then
- ConceptoRenglon = String.Format("GE {0} F:{1}-{2}", DdlProveedor.SelectedItem.Text, TxtSerie.Text, TxtFolio.Text)
+ ConceptoRenglon = String.Format("GE {0} F{1}-{2}", DdlProveedor.SelectedItem.Text, TxtSerie.Text, TxtFolio.Text)
If ObjContaAC.AddMovimiento(IdPoliza, dr("IdCuentaEjercido").ToString.ToEntero, False, MultiplicadorNC * Total, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
'actualizo el idcuenta del presupuesto
If Not ObjContaAC.AddMovimiento(IdPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, MultiplicadorNC * Total, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
@@ -7373,7 +7446,7 @@ Partial Class Compras_Compras
End If
'PAGADO
- ConceptoRenglon = String.Format("GP {0} F:{1}-{2}", DdlProveedor.SelectedItem.Text, TxtSerie.Text, TxtFolio.Text)
+ ConceptoRenglon = String.Format("GP {0} F{1}-{2}", DdlProveedor.SelectedItem.Text, TxtSerie.Text, TxtFolio.Text)
If ObjContaAC.AddMovimiento(IdPoliza, dr("IdCuentaPagado").ToString.ToEntero, False, MultiplicadorNC * Total, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
'actualizo el idcuenta del presupuesto
If Not ObjContaAC.AddMovimiento(IdPoliza, dr("IdCuentaEjercido").ToString.ToEntero, True, MultiplicadorNC * Total, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
@@ -7389,7 +7462,7 @@ Partial Class Compras_Compras
Next
Else
- ErrorACMEnsaje.Append(" - error al obtener presupuestos ObjCompras.GetPresupuestosCompras")
+ ErrorACMEnsaje.Append(" - Error al obtener presupuestos ObjCompras.GetPresupuestosCompras")
ErrorAC = True
End If
@@ -7527,7 +7600,19 @@ Partial Class Compras_Compras
Dim CveCompraNC As Integer
For Each Ant As Compras_Compras.Anticipos In ArrAnticipos
CveCompraNC = CveCompra
+
Dim CveConceptoPago As Integer = 17
+ If CveTipoConcepto = 2 Then CveConceptoPago = 308 'cuando es acreedor
+ If CveMoneda > 1 Then
+ Select Case CveConceptoPago
+ Case 17
+ CveConceptoPago = 312
+ Case 308
+ CveConceptoPago = 309
+ Case Else
+ End Select
+ End If
+
Select Case Ant.TipoMovto
Case "NC", "DEV"
CveConceptoAnt = 60
@@ -7597,7 +7682,7 @@ Partial Class Compras_Compras
If UsuarioActual.Empresa.UsaAC Then
If CtaProveedor > 0 Then
- ConceptoRenglon = String.Format("GD Fact: {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
+ ConceptoRenglon = String.Format("GD Fact {0}-{1} {2}", TxtSerie.Text.Trim, TxtFolio.Text.Trim, DdlProveedor.SelectedItem.Text)
If Not ObjContaAC.AddMovimiento(IdPoliza, CtaProveedor, True, TxtTotal.Text.ToDouble - ImporteAnticipo, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
ErrorAC = True
ErrorACMEnsaje.Append("- CtaProveedor > 0 ObjContaAC.AddMovimiento")
@@ -7628,7 +7713,7 @@ Partial Class Compras_Compras
'EJERCIDO
If True Then
- ConceptoRenglon = String.Format("GE {0} F:{1}-{2}", DdlProveedor.SelectedItem.Text, TxtSerie.Text, TxtFolio.Text)
+ ConceptoRenglon = String.Format("GE {0} F{1}-{2}", DdlProveedor.SelectedItem.Text, TxtSerie.Text, TxtFolio.Text)
If ObjContaAC.AddMovimiento(IdPoliza, dr("IdCuentaEjercido").ToString.ToEntero, False, MultiplicadorNC * Total, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
'actualizo el idcuenta del presupuesto
If Not ObjContaAC.AddMovimiento(IdPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, MultiplicadorNC * Total, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
@@ -7643,7 +7728,7 @@ Partial Class Compras_Compras
End If
'PAGADO
- ConceptoRenglon = String.Format("GP {0} F:{1}-{2}", DdlProveedor.SelectedItem.Text, TxtSerie.Text, TxtFolio.Text)
+ ConceptoRenglon = String.Format("GP {0} F{1}-{2}", DdlProveedor.SelectedItem.Text, TxtSerie.Text, TxtFolio.Text)
If ObjContaAC.AddMovimiento(IdPoliza, dr("IdCuentaPagado").ToString.ToEntero, False, MultiplicadorNC * Total, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
'actualizo el idcuenta del presupuesto
If Not ObjContaAC.AddMovimiento(IdPoliza, dr("IdCuentaEjercido").ToString.ToEntero, True, MultiplicadorNC * Total, "", ConceptoRenglon, 0, TxtFechaPago.Text.ToDate, "") Then
@@ -7659,7 +7744,7 @@ Partial Class Compras_Compras
Next
Else
- ErrorACMEnsaje.Append("- error al obtener presupuestos 2")
+ ErrorACMEnsaje.Append("- Error al obtener presupuestos 2")
ErrorAC = True
End If
End If
@@ -7682,7 +7767,19 @@ Partial Class Compras_Compras
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImportePagar, " ", 29, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CvePersonal:=DdlFuncionarioEmpleado.SelectedValue.ToEntero, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveColectiva:=CveColectiva, CveIE:=CveIE, ImporteMX:=ImportePagar) Then
ErrorMovtosCxP = True
End If
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImportePagar, " ", 17, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CvePersonal:=DdlFuncionarioEmpleado.SelectedValue.ToEntero, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveColectiva:=CveColectiva, CveIE:=CveIE, ImporteMX:=ImportePagar) Then
+
+ Dim CveConceptoPago As Integer = 17
+ If CveTipoConcepto = 2 Then CveConceptoPago = 308 'cuando es acreedor
+ If CveMoneda > 1 Then
+ Select Case CveConceptoPago
+ Case 17
+ CveConceptoPago = 312
+ Case 308
+ CveConceptoPago = 309
+ Case Else
+ End Select
+ End If
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImportePagar, " ", CveConceptoPago, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CvePersonal:=DdlFuncionarioEmpleado.SelectedValue.ToEntero, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveColectiva:=CveColectiva, CveIE:=CveIE, ImporteMX:=ImportePagar) Then
ErrorMovtosCxP = True
End If
@@ -7791,7 +7888,7 @@ Partial Class Compras_Compras
'GUARDA BITACORA TIPO CAMBIO OC
If Not ErrorOC And TipoCambioOC > 0 Then
- If Not ObjEventos.AddEventoBitacora(String.Format("La vinculación con la orden de compra fue con un tipo de cambio de: ${0}", TipoCambioOC.ToString), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=CveCompra) Then
+ If Not ObjEventos.AddEventoBitacora(String.Format("La vinculación con la orden de compra fue con un tipo de cambio de ${0}", TipoCambioOC.ToString), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=CveCompra) Then
ErrorOC = True
End If
End If
@@ -7832,9 +7929,21 @@ Partial Class Compras_Compras
If Not ErrorCreditosCompra Then
+ Dim CveConceptoPago As Integer = 17
+ If CveTipoConcepto = 2 Then CveConceptoPago = 308 'cuando es acreedor
+ If CveMoneda > 1 Then
+ Select Case CveConceptoPago
+ Case 17
+ CveConceptoPago = 312
+ Case 308
+ CveConceptoPago = 309
+ Case Else
+ End Select
+ End If
+
If ObjIE.GetCreditos(DdlCredito.SelectedValue.ToEntero, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
CvePrePolizaCredito = ObjConta.AddPrePolizas("Compras/RegistrarCredito", -1, ObjIE.TotalFinanciado, ObjIE.TotalFinanciado, 1, TxtFecha.Text.ToDate, "Vinculación crédito con factura", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
- If ObjConta.AddPrePolizasDetalle(CvePrePolizaCredito, False, ObjIE.TotalFinanciado.ToDecimal, "", 17, "Vinculación crédito con factura", TxtFecha.Text.ToDate, CtaProveedor, -1, CveProveedor:=CveProveedor, CveCompra:=CveCompra, ImporteMX:=ObjIE.TotalFinanciado.ToDecimal, CvePrePolizaOriginal:=CvePrePolizaCredito) Then
+ If ObjConta.AddPrePolizasDetalle(CvePrePolizaCredito, False, ObjIE.TotalFinanciado.ToDecimal, "", CveConceptoPago, "Vinculación crédito con factura", TxtFecha.Text.ToDate, CtaProveedor, -1, CveProveedor:=CveProveedor, CveCompra:=CveCompra, ImporteMX:=ObjIE.TotalFinanciado.ToDecimal, CvePrePolizaOriginal:=CvePrePolizaCredito) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaCredito, True, ObjIE.TotalFinanciado.ToDecimal, "", 50, "Vinculación crédito con factura", TxtFecha.Text.ToDate, CtaProveedor, -1, CveProveedor:=CveProveedor, CveCompra:=CveCompra, ImporteMX:=ObjIE.TotalFinanciado.ToDecimal, CvePrePolizaOriginal:=CvePrePolizaCredito) Then
ErrorCreditosCompra = True
End If
@@ -7878,11 +7987,11 @@ Partial Class Compras_Compras
Alert("Error al actualizar la vinculacion del Activo Fijo", TipoMensaje.MsgAdvertencia)
ElseIf ErrorAC Then
Alert("Ocurrió un Error al insertar los movimientos contables.", TipoMensaje.MsgError)
- GuardaLog($" Error Compras DESCRIPCIÓN DETALLADA: {ErrorACMEnsaje.ToString} {vbCrLf} Usuario={UsuarioActual.CveUsuario}, Empresa={UsuarioActual.CveEmpresa}, CveFactura={CveFactura}, CveProveedor={CveProveedor}")
+ GuardaLog($" Error Compras DESCRIPCIÓN DETALLADA {ErrorACMEnsaje.ToString} {vbCrLf} Usuario={UsuarioActual.CveUsuario}, Empresa={UsuarioActual.CveEmpresa}, CveFactura={CveFactura}, CveProveedor={CveProveedor}")
ElseIf ErrorPrepolizaDescuadre Then
Alert(ObjConta.MensajePolizaDescuadre, TipoMensaje.MsgError)
ElseIf ErrorPrepoliza Then
- Alert("Ocurrió un error al verificar los movimientos contables", TipoMensaje.MsgError)
+ Alert("Ocurrió un Error al verificar los movimientos contables", TipoMensaje.MsgError)
ElseIf ErrorOC Then
Alert("Ocurrió un Error al vincular la Orden(es) de Compra. Por favor vuelva intentar.", TipoMensaje.MsgError)
ElseIf ErrorBitacora Then
@@ -7896,7 +8005,7 @@ Partial Class Compras_Compras
ElseIf ErrorSATPS Then
Alert("Ocurrió un Error al actualizar el producto/servicio SAT.", TipoMensaje.MsgError)
ElseIf ErrorSaldosInvComp Then
- Alert("Ocurrió un error al validar la mercancía recibida por adelantado.", TipoMensaje.MsgError)
+ Alert("Ocurrió un Error al validar la mercancía recibida por adelantado.", TipoMensaje.MsgError)
End If
ViewState("CveCompra") = -1
@@ -7919,7 +8028,7 @@ Partial Class Compras_Compras
If UsuarioActual.Empresa.UsaAC Then
MsgAccionAceptar = String.Format("window.opener.location.href = window.opener.location.href; window.open(""/Contabilidad/RegPoliza.aspx?IdPoliza={0}""); window.close();", IdPoliza)
Else
- MsgAccionAceptar = "if (window.opener){window.opener.location.href = window.opener.location.href; window.close();}"
+ MsgAccionAceptar = "If (window.opener){window.opener.location.href = window.opener.location.href; window.close();}"
End If
Else
MsgAccionAceptar = "location.href =""Compras.aspx"""
@@ -8454,6 +8563,18 @@ Partial Class Compras_Compras
ImporteMovimiento = 0
Case 17 'Pago Proveedores
+
+ If CveTipoConcepto = 2 Then ConceptoContable = 308 'cuando es acreedor
+ If CveMoneda > 1 Then
+ Select Case ConceptoContable
+ Case 17
+ ConceptoContable = 312
+ Case 308
+ ConceptoContable = 309
+ Case Else
+ End Select
+ End If
+
Dim TipoCambio17 = tipoCambio
If gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant", "Egsc") Then
TipoCambio17 = TipoCambioCompra
@@ -8469,9 +8590,13 @@ Partial Class Compras_Compras
IdCtaContable = CtaProveedorExtranjera
CveCuenta = CveCuentaProveedorExtranjera
If ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveCompraAmortizacion:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteMovimiento, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=ImporteMovimiento, TipoCambio:=TipoCambio17, CveCuenta:=CveCuenta) Then
+
+ Dim CveConceptoContableComplementaria As Integer = 206
+ If CveTipoConcepto = 2 Then CveConceptoContableComplementaria = 310 'cuando es acreedor
+
IdCtaContable = CtaProveedorComplementaria
CveCuenta = CveCuentaProveedorComplementaria
- If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, importeMN - ImporteMovimiento, Concepto, 206, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveCompraAmortizacion:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN - ImporteMovimiento, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=ImporteMovimiento, TipoCambio:=TipoCambio17, CveCuenta:=CveCuenta) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, importeMN - ImporteMovimiento, Concepto, CveConceptoContableComplementaria, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveCompraAmortizacion:=CveCompraNC, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN - ImporteMovimiento, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=ImporteMovimiento, TipoCambio:=TipoCambio17, CveCuenta:=CveCuenta) Then
ErrorMovtosCxP = 1
Exit Select
End If
@@ -8970,7 +9095,19 @@ Partial Class Compras_Compras
If CvePrePoliza > 0 Then
Dim CveConceptoCompra As Integer = 60
+
Dim CveConceptoPago As Integer = 17
+ If CveTipoConcepto = 2 Then CveConceptoPago = 308 'cuando es acreedor
+ If CveMoneda <> 1 Then
+ Select Case CveConceptoPago
+ Case 17
+ CveConceptoPago = 312
+ Case 308
+ CveConceptoPago = 309
+ Case Else
+ End Select
+ End If
+
Dim TipoMovimientoCompra As Boolean = True
Select Case gvr.DataKey("TipoDocto")
Case "NC", "DEV"
@@ -9790,29 +9927,15 @@ Partial Class Compras_Compras
Dim Referencia As String = $"{TxtSerie.Text}-{TxtFolio.Text}" ' concatenation interpolation
Select Case ConceptoContable
- Case 5
- importeMovimiento = TxtTotal.Text.ToDecimal
- importeMN = importeMovimiento * IIf(DdlMoneda.SelectedValue.ToEntero > 1, LblTC.Text.Replace("TC:", "").ToDecimal, 1D).ToString.ToDecimal
- IdCtaContable = -1 '--1244
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importeMovimiento, Referencia, 5, Referencia, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=DdlProveedor.SelectedValue.ToEntero, CvePersonal:=CvePersonal, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, TxtTotal.Text.ToDecimal), CveCuenta:=CveCuenta) Then
- ErrorPrepoliza = True
- End If
- 'If DdlMoneda.SelectedValue.ToEntero > 1 Then
- ' IdCtaContable = -1
- ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimiento, Referencia, 205, Referencia, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=DdlProveedor.SelectedValue.ToEntero, CvePersonal:=CvePersonal, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TxtTotal.Text.ToDecimal, ImporteME:=If(tipoCambioActual = 1, 0, TxtTotal.Text.ToDecimal), CveCuenta:=CveCuenta) Then
- ' ErrorPrepoliza = True
- ' End If
- 'End If
-
- Case 14
- importeMovimiento = TxtIVA.Text.ToDecimal
- importeMN = importeMovimiento * IIf(DdlMoneda.SelectedValue.ToEntero > 1, LblTC.Text.Replace("TC:", "").ToDecimal, 1).ToString.ToDecimal
- IdCtaContable = -1 '--1244
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimiento, Referencia, 14, Referencia, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=DdlProveedor.SelectedValue.ToEntero, CvePersonal:=CvePersonal, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, TxtTotal.Text.ToDecimal), CveCuenta:=CveCuenta) Then
- ErrorPrepoliza = True
- End If
-
-
+ 'Case 5
+ ' IdCtaContable = 1244
+ ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importeMovimiento, Referencia, 5, Referencia, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=DdlProveedor.SelectedValue.ToEntero, CvePersonal:=CvePersonal, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TxtTotal.Text.ToDecimal, ImporteME:=If(tipoCambioActual = 1, 0, TxtTotal.Text.ToDecimal), CveCuenta:=CveCuenta) Then
+ ' ErrorPrepoliza = True
+ ' End If
+ ' IdCtaContable = 1243
+ ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimiento, Referencia, 205, Referencia, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=DdlProveedor.SelectedValue.ToEntero, CvePersonal:=CvePersonal, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TxtTotal.Text.ToDecimal, ImporteME:=If(tipoCambioActual = 1, 0, TxtTotal.Text.ToDecimal), CveCuenta:=CveCuenta) Then
+ ' ErrorPrepoliza = True
+ ' End If
Case 6
Dim CveProveedorConcepto As Integer = 0, CveAcreedor As Integer = 0, CveIE As Integer = 0, CveColectiva As Integer = 0, CveCreditoDetalle As Integer = 0
Dim ConceptoPersonal As String = "", Concepto As String = ""
@@ -11725,7 +11848,7 @@ Partial Class Compras_Compras
#Region "TAB - ACTIVOS FIJOS -AF"
Protected Sub CargarGvActivosFijos(sender As Object, e As EventArgs)
- TAB.ActiveTabIndex = 3
+ Tab.ActiveTabIndex = 3
If GvAFInsumos.Rows.Count > 0 Then
llenaDtsAF()
@@ -13802,7 +13925,7 @@ Partial Class Compras_Compras
UpFacturar.Update()
TabGenerales.Enabled = True
- TAB.ActiveTabIndex = 0
+ Tab.ActiveTabIndex = 0
UpTabs.Update()
ImgClasificacion.Visible = False
@@ -14531,7 +14654,7 @@ Partial Class Compras_Compras
'SI NO ES UNA COMPRA REGISTRADA = ENABLE FALSE TAB GENERALES, ACTIVE TAB OC
If Not CveCompra > 0 Then
TabGenerales.Enabled = False
- TAB.ActiveTabIndex = 2
+ Tab.ActiveTabIndex = 2
UpTabs.Update()
End If
@@ -14680,7 +14803,7 @@ Partial Class Compras_Compras
If UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 And Not UsuarioActual.Empresa.Funcionalidad(153).ToEntero > 0 Then
Select Case DdlOCVinculaInv.SelectedValue.ToEntero
Case 176
- DTOCGV = DTOCGV.FiltraParametros("((EstatusInventario IN (3,5) AND CveTipoPS = 2) OR CveTipoPS = 1)")
+ DTOCGV = DTOCGV.FiltraParametros("((EstatusInventario IN (3,5) AND CveTipoPS = 2) OR CveTipoPS = 1) AND CantidadPorAdelantado > 0")
Case 205
DTOCGV = DTOCGV.FiltraParametros("(EstatusInventario IN (1,2) AND CveTipoPS = 2) OR CveTipoPS = 1")
End Select
@@ -15101,7 +15224,7 @@ Partial Class Compras_Compras
UpFacturar.Update()
TabGenerales.Enabled = True
- TAB.ActiveTabIndex = 0
+ Tab.ActiveTabIndex = 0
UpTabs.Update()
@@ -15204,7 +15327,7 @@ Partial Class Compras_Compras
UpFacturar.Update()
TabGenerales.Enabled = True
- TAB.ActiveTabIndex = 0
+ Tab.ActiveTabIndex = 0
UpTabs.Update()
ImgClasificacion.Visible = False
@@ -18093,7 +18216,7 @@ Partial Class Compras_Compras
RegistraScript("$('#ModalNCInv').modal('show');", "ModalNCInv")
Else
If ChkNCInvNC.Checked Then
- Alert("Ninguna de las facturas seleccionadas cuenta con productos pendientes de darles entrada.", TipoMensaje.MsgAdvertencia)
+ Alert("Niguna de las facturas seleccionadas cuenta con productos pendientes de darles entrada.", TipoMensaje.MsgAdvertencia)
ChkNCInvNC.Checked = False
UpChkNCInvNC.Update()
Exit Sub
@@ -18233,7 +18356,7 @@ Partial Class Compras_Compras
End Sub
Private Sub RegeneraPrePoliza()
- If CvePrePoliza <= 0 Then Alert($"CvePrePoliza de la compra: {CvePrePoliza}", TipoMensaje.MsgInformacion)
+ 'Alert($"CvePrePoliza de la compra: {CvePrePoliza}", TipoMensaje.MsgInformacion)
'MOVIMIENTOS DE ALMACEN DE LA COMPRA
Dim ObjInventarios As New ClsInventarios
diff --git a/Compras/ReembolsosComprobaciones.aspx b/Compras/ReembolsosComprobaciones.aspx
index 391e282bf..15887b7b5 100644
--- a/Compras/ReembolsosComprobaciones.aspx
+++ b/Compras/ReembolsosComprobaciones.aspx
@@ -291,7 +291,7 @@
-
+
diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb
index b8638b6db..359041716 100644
--- a/Compras/ReembolsosComprobaciones.aspx.vb
+++ b/Compras/ReembolsosComprobaciones.aspx.vb
@@ -630,6 +630,18 @@ Partial Class Compras_ReembolsosComprobaciones
ImportePagar = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
ImporteOriginal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
+ Dim CveConceptoContablePago As Integer = 17
+ If gvr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoContablePago = 308 'cuando es acreedor
+ If CveMoneda <> 1 Then
+ Select Case CveConceptoContablePago
+ Case 17
+ CveConceptoContablePago = 312
+ Case 308
+ CveConceptoContablePago = 309
+ Case Else
+ End Select
+ End If
+
If SaldoCheque > 0 Then
ImporteMovto = If(ImportePagar > SaldoCheque, SaldoCheque, ImportePagar)
CvePrePolizaPago = CvePrePolizaIERegistrado
@@ -670,7 +682,7 @@ Partial Class Compras_ReembolsosComprobaciones
End If
'Pago Proveedores
- If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteMovto, Referencia, 17, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteMovto, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle"
End If
@@ -935,7 +947,7 @@ Partial Class Compras_ReembolsosComprobaciones
If UsuarioActual.Empresa.Funcionalidad(506) = "1" And CbPermitirExcedente.Checked = True And SaldoExcedente > 0 Then
If DDlPermitirExcedente.SelectedValue = "1" Then
- If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, 17, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=(SaldoExcedente) * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=(SaldoExcedente) * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal"
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 132, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaOtrosProductos, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaOtrosProductos, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
@@ -943,7 +955,7 @@ Partial Class Compras_ReembolsosComprobaciones
End If
ElseIf DDlPermitirExcedente.SelectedValue = "2" Then
- If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, 17, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal Excedente"
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 29, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaPersonal, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaPersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
@@ -990,7 +1002,7 @@ Partial Class Compras_ReembolsosComprobaciones
If gvr.DataKey("Original").ToDecimal > 0 Then PorcentajePago = (ImporteMovto / gvr.DataKey("Original").ToDecimal).RoundSQL Else PorcentajePago = 1
- If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, 17, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=(ImporteMovto * tipoCambio), CveCuenta:=CveCuentaProveedor) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=(ImporteMovto * tipoCambio), CveCuenta:=CveCuentaProveedor) Then
MsgError = "Detalle"
Exit For
Else
diff --git a/Compras/RepComprasDetalle.aspx.vb b/Compras/RepComprasDetalle.aspx.vb
index 060289af1..d1c57402a 100644
--- a/Compras/RepComprasDetalle.aspx.vb
+++ b/Compras/RepComprasDetalle.aspx.vb
@@ -397,8 +397,8 @@ Partial Class Compras_RepComprasDetalle
ImprimirPDF(String.Format("{0}Formatos\Remesa.rdlc", UsuarioActual.Empresa.Ruta), DtDatos.FiltraParametros("CveCompra > 0"), params, "Remesa", RDSName:="DsCompras")
End Sub
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
- GvDatos.ExportToExcel("ReporteComprasDetalles" & Now.ToShortDateString)
- 'GenerarPDF("EXCEL")
+ 'GvDatos.ExportToExcel("ReporteComprasDetalles" & Now.ToShortDateString)
+ GenerarPDF("EXCEL")
End Sub
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs)
diff --git a/Contabilidad/PopUpAuxiliar.aspx b/Contabilidad/PopUpAuxiliar.aspx
index fd8deccef..50fe4092b 100644
--- a/Contabilidad/PopUpAuxiliar.aspx
+++ b/Contabilidad/PopUpAuxiliar.aspx
@@ -1,249 +1,249 @@
-<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PopUpAuxiliar.aspx.vb" Inherits="PopUpAuxiliar" %>
-
-<%@ Import Namespace="Extensiones" %>
-
-
-
-
-
-
-
-
- Auxiliar Contable -
-
-
-
-
-
-
+
+
+
diff --git a/Contabilidad2/CatCuentas.aspx.vb b/Contabilidad2/CatCuentas.aspx.vb
index 5f0fb2f53..f96e41d01 100644
--- a/Contabilidad2/CatCuentas.aspx.vb
+++ b/Contabilidad2/CatCuentas.aspx.vb
@@ -14,15 +14,66 @@ Partial Class Contabilidad2_CatCuentas
ViewState("DtDatos") = value
End Set
End Property
+
+ Private Property DtConceptosconta As DataTable
+ Get
+ Return CType(ViewState("DtConceptosconta"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DtConceptosconta") = value
+ End Set
+ End Property
Private Property IDSelected As Integer
Get
- Return ViewState("idsel").ToString.ToEntero
+ Return ViewState("idsel").ToString.ToEntero()
End Get
Set(value As Integer)
ViewState("idsel") = value
End Set
End Property
+#Region "Contabilidadnew"
+ Private Property CveProveedor As Integer
+ Get
+ Return ViewState("CveProveedor").ToString.ToEntero()
+ End Get
+ Set(value As Integer)
+ ViewState("CveProveedor") = value
+ End Set
+ End Property
+ Private Property CveCliente As Integer
+ Get
+ Return ViewState("CveCliente").ToString.ToEntero()
+ End Get
+ Set(value As Integer)
+ ViewState("CveCliente") = value
+ End Set
+ End Property
+ Private Property CveClasificacion As Integer
+ Get
+ Return ViewState("CveClasificacion").ToString.ToEntero()
+ End Get
+ Set(value As Integer)
+ ViewState("CveClasificacion") = value
+ End Set
+ End Property
+ Private Property CveBancoCuenta As Integer
+ Get
+ Return ViewState("CveBancoCuenta").ToString.ToEntero()
+ End Get
+ Set(value As Integer)
+ ViewState("CveBancoCuenta") = value
+ End Set
+ End Property
+ Private Property CveAlmacen As Integer
+ Get
+ Return ViewState("CveAlmacen").ToString.ToEntero()
+ End Get
+ Set(value As Integer)
+ ViewState("CveAlmacen") = value
+ End Set
+ End Property
+#End Region
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
@@ -30,9 +81,18 @@ Partial Class Contabilidad2_CatCuentas
'inicio()
'RegistraScript("$('#Tsubcuenta').mask('00000-0000-0000-00000');")
' If UsuarioActual.Empresa.UsaContabilidad Then
+ DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
+ DdlAlmacen.DataBind()
CargaMonedas()
CargaAgrupadorSAT()
CargaDatos()
+ Using objconta As New ClsContabilidad
+ objconta.GetConta_ConceptosContables(1)
+ DtConceptosconta = objconta.DtResultados
+ End Using
+ DdlConcepto.DataSource = DtConceptosconta
+ DdlConcepto.DataBind()
+ DdlConcepto.Items.Insert(0, New ListItem("Seleccione", "-1"))
'Else
' Alert("Este módulo requiere el uso de Contabilidad.", TipoMensaje.MsgAdvertencia)
' MEECuenta.Enabled = False
@@ -126,9 +186,28 @@ Partial Class Contabilidad2_CatCuentas
updatos.Update()
End Sub
+ Private Sub limpiavalorescontables()
+
+ DdlConcepto.SelectedValueExist(-1)
+ onconceptochange()
+ CveProveedor = -1
+ DdlProveedores.SelectedText = ""
+ DdlProveedores.SelectedValue = CveProveedor
+ CveCliente = -1
+ DdlClientesWS.SelectedText = ""
+ DdlClientesWS.SelectedValue = CveCliente
+ Dim PorcentajeImpuesto As Decimal = -1
+ DdlClasificacion.SelectedValueExist(PorcentajeImpuesto)
+ CveClasificacion = -1
+ DdlClasificacion.SelectedValueExist(CveClasificacion)
+ CveBancoCuenta = -1
+ CveAlmacen = -1
+ DdlAlmacen.SelectedValueExist(CveAlmacen)
+ End Sub
Protected Sub editar_Click(sender As Object, e As EventArgs) Handles ArbolCuentas.editclick
LimpiarCampos()
+ limpiavalorescontables()
Dim dt As DataTable
Dim obj As ADServerControl.DragableItem = DirectCast(sender, ADServerControl.DragableItem)
IDSelected = obj.Cve
@@ -141,6 +220,29 @@ Partial Class Contabilidad2_CatCuentas
DTcuenta.SelectedValue = dr("Tipo").ToString()
DcuentaMayor.SelectedValue = dr("CtaMayor").ToString
DdlMoneda.SelectedValue = dr("CveMoneda").ToString
+ Using objconta As New ClsContabilidad
+ objconta.GetConta_CuentasDataContabilidad(IDSelected, UsuarioActual.CveEmpresa)
+ If objconta.DtResultados.Rows.Count > 0 Then
+ Dim rowcc As DataRow = objconta.DtResultados.Rows(0)
+
+ DdlConcepto.SelectedValueExist(rowcc("CveConceptoAdmin").ToString().ToEntero())
+ onconceptochange()
+ CveProveedor = rowcc("CveProveedor").ToString().ToEntero()
+ DdlProveedores.SelectedText = rowcc("Proveedor").ToString().ToEntero()
+ DdlProveedores.SelectedValue = CveProveedor
+ CveCliente = rowcc("CveCliente").ToString().ToEntero()
+ DdlClientesWS.SelectedText = rowcc("Cliente").ToString().ToEntero()
+ DdlClientesWS.SelectedValue = CveCliente
+ Dim PorcentajeImpuesto As Decimal = rowcc("PorcentajeImpuesto").ToString().ToDecimal() * 100
+ DdlClasificacion.SelectedValueExist(PorcentajeImpuesto)
+ CveClasificacion = rowcc("CveClasificacion").ToString().ToEntero()
+ DdlClasificacion.SelectedValueExist(CveClasificacion)
+ CveBancoCuenta = rowcc("CveBancoCuenta").ToString().ToEntero()
+ CveAlmacen = rowcc("CveAlmacen").ToString().ToEntero()
+ DdlAlmacen.SelectedValueExist(CveAlmacen)
+ End If
+
+ End Using
If dr("CveAgrupadorSAT").ToString.ToEntero = 0 Then
DdlAgrupadorSAT.SelectedValue = -1
@@ -178,23 +280,33 @@ Partial Class Contabilidad2_CatCuentas
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
Dim ObjConta As New ClsContabilidad
- Dim ObjConta2 As New ClsContPAQi(UsuarioActual.Empresa)
- If ObjConta.UpdateCuenta(IDSelected.ToEntero, Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToString.ToEntero, DdlAgrupadorSAT.SelectedValue.ToEntero, TxtNomIngles.Text.ToString) Then
+ Dim CveConceptoAdmin As Integer = DdlConcepto.SelectedValue.ToEntero()
+ Dim CveProveedor As Integer = DdlProveedores.SelectedValue.ToEntero()
+ Dim CveCliente As Integer = DdlClientesWS.SelectedValue.ToEntero()
+ Dim CveClasificacion As Integer = DdlClasificacion.SelectedValue.ToEntero()
+ Dim PorcentajeImpuesto As Decimal = TxtPorcentaje.Text.ToDecimal() / 100
+ Dim CveBancoCuenta As Integer = -1
+ Dim CveAlmacen As Integer = DdlAlmacen.SelectedValue.ToEntero()
+ If ObjConta.UpdateCuenta(IDSelected.ToEntero, Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToString.ToEntero, DdlAgrupadorSAT.SelectedValue.ToEntero, TxtNomIngles.Text.ToString,
+ CveConceptoAdmin:=CveConceptoAdmin, CveProveedor:=CveProveedor, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeImpuesto, CveBancoCuenta:=CveBancoCuenta, CveAlmacen:=CveAlmacen) Then
Dim codigo As String = DtDatos.FiltroPrimeroValor("Codigo", $"CveCuenta={IDSelected}")
- If ObjConta2.GetCuentas(-1, "-1", -1) Then
- Dim Id As Integer = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"Codigo='{codigo}'").ToEntero
- Dim IdAgrupador As Integer
+ Using ObjConta2 As New ClsContPAQi(UsuarioActual.Empresa)
- If ObjConta2.GetAgrupadoresSAT() Then
- IdAgrupador = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"CodigoNombre='{DdlAgrupadorSAT.SelectedItem.Text}'").ToEntero
- End If
- If Id > 0 Then
- If ObjConta2.UpdateCuenta(Id, Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, DdlMoneda.SelectedValue.ToEntero, IdAgrupador, SubCuentaDe:=Tsubcuenta.Text.Trim) > 0 Then
+ If ObjConta2.GetCuentas(-1, "-1", -1) Then
+ Dim Id As Integer = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"Codigo='{codigo}'").ToEntero
+ Dim IdAgrupador As Integer
+
+ If ObjConta2.GetAgrupadoresSAT() Then
+ IdAgrupador = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"CodigoNombre='{DdlAgrupadorSAT.SelectedItem.Text}'").ToEntero
+ End If
+ If Id > 0 Then
+ If ObjConta2.UpdateCuenta(Id, Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, DdlMoneda.SelectedValue.ToEntero, IdAgrupador, SubCuentaDe:=Tsubcuenta.Text.Trim) > 0 Then
+ End If
End If
End If
- End If
+ End Using
Dim customerRow As Data.DataRow
customerRow = DtDatos.Select(String.Format("CveCuenta = {0}", IDSelected))(0)
@@ -216,7 +328,6 @@ Partial Class Contabilidad2_CatCuentas
End If
ObjConta.Dispose()
- ObjConta2.Dispose()
End Sub
Protected Sub nuevacuenta_Click(sender As Object, e As EventArgs) Handles nuevacuenta.Click
@@ -373,4 +484,47 @@ Partial Class Contabilidad2_CatCuentas
'Protected Sub BtnCambiaAgrupadorSAT_Click(sender As Object, e As EventArgs)
' CargaAgrupadorSAT()
'End Sub
+ Protected Sub DdlConcepto_SelectedIndexChanged(sender As Object, e As EventArgs)
+ onconceptochange()
+ End Sub
+ Private Sub onconceptochange(Optional CveCuenta As Integer = -1)
+ PnlOpcion1.Visible = False
+ pnlOpcion2.Visible = False
+ pnlOpcion3.Visible = False
+ pnlOpcion4.Visible = False
+ pnlOpcion5.Visible = False
+ pnlOpcion6.Visible = False
+ Dim CveConceptoContable As Integer = DdlConcepto.SelectedValue.ToEntero()
+ Dim row As DataRow = Nothing
+ Dim CveTipoSaldo As Integer = 0
+ Dim CveParejaContable As Integer = 0
+ If CveConceptoContable > 0 Then
+ row = DtConceptosconta.FiltroPrimero(String.Format("CveConceptoContable={0}", CveConceptoContable))
+ CveTipoSaldo = row("CveTipoSaldo").ToString.ToEntero()
+ CveParejaContable = row("CveParejaContable").ToString().ToEntero()
+ End If
+ If Not IsNothing(row) Then
+ Select Case CveTipoSaldo
+ Case 1
+ PnlOpcion1.Visible = True
+ Case 2
+ pnlOpcion2.Visible = True
+ Case 3
+ pnlOpcion3.Visible = True
+ If DdlClasificacion.Items.Count < 2 Then
+ DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=1)
+ DdlClasificacion.DataBind()
+ End If
+ Case 4
+ pnlOpcion4.Visible = True
+ Case 5
+ pnlOpcion5.Visible = True
+
+ Case 6
+ pnlOpcion6.Visible = True
+
+ End Select
+ End If
+ End Sub
+
End Class
\ No newline at end of file
diff --git a/Empresas/141/Formatos/Cotizacion.rdlc b/Empresas/141/Formatos/Cotizacion.rdlc
index f3e160397..eb94d461e 100644
--- a/Empresas/141/Formatos/Cotizacion.rdlc
+++ b/Empresas/141/Formatos/Cotizacion.rdlc
@@ -905,7 +905,7 @@
- =Fields!PS.Value & " " & Fields!Obs.Value
+ =Fields!PS.Value & IIF(Fields!Obs.Value <> "",System.Environment.NewLine &"Observaciones: ","") & Fields!Obs.Value
-
-
- Actualizar Precios
-
-
-
-
-