@@ -124,9 +127,10 @@
-
+
+
-
+
diff --git a/Acumuladores/RepEntradasUsadosClientes.aspx.vb b/Acumuladores/RepEntradasUsadosClientes.aspx.vb
index e83cfdea4..25e180f3d 100644
--- a/Acumuladores/RepEntradasUsadosClientes.aspx.vb
+++ b/Acumuladores/RepEntradasUsadosClientes.aspx.vb
@@ -19,6 +19,7 @@ Partial Class Acumuladores_RepEntradasUsadosClientes
If Not Page.IsPostBack Then
CargaCombos()
+ CargaNombreClientes()
End If
End Sub
@@ -26,8 +27,11 @@ Partial Class Acumuladores_RepEntradasUsadosClientes
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
+ End Sub
+ Private Sub CargaNombreClientes()
+ DdlNombre.setEsWebService(True)
+ DdlNombre.Attributes.Add("data-metodo", "getcliente")
End Sub
-
Public Sub CargaCombos()
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 22)
DdlAlmacen.DataBind()
@@ -44,11 +48,11 @@ Partial Class Acumuladores_RepEntradasUsadosClientes
FechaI = If(IsDate(TxtFechaI.Text.Trim()), TxtFechaI.Text.Trim.todate, minfecha)
FechaF = If(IsDate(TxtFechaF.Text.Trim()), TxtFechaF.Text.Trim.todate, maxfecha)
- Dim CveAlmacen As Integer = If(DdlAlmacen.SelectedValue = "", "-1", DdlAlmacen.SelectedValue).ToString.toentero
-
+ Dim CveAlmacen As Integer = If(DdlAlmacen.SelectedValue = "", "-1", DdlAlmacen.SelectedValue).ToString.ToEntero
+ Dim CveCliente As Integer = If(DdlNombre.SelectedValue = "", "-1", DdlNombre.SelectedValue).ToString.ToEntero
Dim Acum As New ClsAcumuladores
- If Acum.EntradasUsadosClientesRep(CveAlmacen, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
+ If Acum.EntradasUsadosClientesRep(CveAlmacen, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente) Then
GvDatos.DataSource = Acum.DtResultados.FiltraParametros("Codigo_Clientes <> 'Total:'") 'los renglones generados con esta caracteriztica son con un grouping set en la consulta, se pueden quitar
DatosEntradasUsadosClientes = Acum.DtResultados.FiltraParametros("Codigo_Clientes <> 'Total:'")
End If
diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb
index a52ab1a98..365c14035 100644
--- a/App_Code/ClsAcumuladores.vb
+++ b/App_Code/ClsAcumuladores.vb
@@ -1076,7 +1076,7 @@ Public Class ClsAcumuladores
Return Retorno
End Function
- Public Function EntradasUsadosClientesRep(CveAlmacen As Integer, FechaI As Date, FechaF As Date, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
+ Public Function EntradasUsadosClientesRep(CveAlmacen As Integer, FechaI As Date, FechaF As Date, CveUsuario As Integer, CveEmpresa As Integer, Optional CveCliente As Integer = -1) As Boolean
Dim Retorno As Boolean = False
'Data = New DataTable
@@ -1088,6 +1088,8 @@ Public Class ClsAcumuladores
.Add("@FechaFin", SqlDbType.Date).Value = FechaF
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
+
End With
Try
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 4c4d73133..ccb61fddf 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -4802,7 +4802,6 @@ Public Class ClsPaginas
#End Region
#Region "Planeacion"
'PLANEACIÓN
- PaginaDict.Add("/Planeacion/CatSucursales.aspx".ToUpper(), 17)
PaginaDict.Add("/Planeacion/Sucursal.aspx".ToUpper(), 17)
PaginaDict.Add("/Planeacion/CatProyectos.aspx".ToUpper(), 34)
PaginaDict.Add("/Planeacion/CatSubProyectos.aspx".ToUpper(), 35)
diff --git a/App_Code/ClsSucursales.vb b/App_Code/ClsSucursales.vb
new file mode 100644
index 000000000..b7d3f0f00
--- /dev/null
+++ b/App_Code/ClsSucursales.vb
@@ -0,0 +1,383 @@
+Option Explicit On
+Option Strict On
+
+Imports System.Data
+Imports System.Data.SqlClient
+Imports Extensiones
+Imports System
+Imports System.Configuration
+
+Public Class ClsSucursales
+ Implements IDisposable
+
+#Region "Campos"
+
+ 'SQL
+ Private SqlConexion As SqlConnection
+ Private SqlAdapter As SqlDataAdapter
+ Private SqlTransacc As SqlTransaction
+ Private SqlCommand As SqlCommand
+ Private Data As DataTable
+
+ Private disposedValue As Boolean = False
+
+ 'Atributos de la clase
+ Private _Calle As String
+ Private _NoExt As String
+ Private _NoInt As String
+ Private _Colonia As String
+ Private _Localidad As String
+ Private _Municipio As String
+ Private _Estado As String
+ Private _Pais As String
+ Private _CP As Integer
+ 'PARA REGISTRAR CONEXION
+ Private CveConexion As Integer = 0
+#End Region
+
+#Region "Propiedades"
+ Public ReadOnly Property Calle As String
+ Get
+ Return _Calle
+ End Get
+ End Property
+
+ Public ReadOnly Property NoExt As String
+ Get
+ Return _NoExt
+ End Get
+ End Property
+
+ Public ReadOnly Property NoInt As String
+ Get
+ Return _NoInt
+ End Get
+ End Property
+
+ Public ReadOnly Property Colonia As String
+ Get
+ Return _Colonia
+ End Get
+ End Property
+
+ Public ReadOnly Property Localidad As String
+ Get
+ Return _Localidad
+ End Get
+ End Property
+
+ Public ReadOnly Property Municipio As String
+ Get
+ Return _Municipio
+ End Get
+ End Property
+
+ Public ReadOnly Property Estado As String
+ Get
+ Return _Estado
+ End Get
+ End Property
+
+ Public ReadOnly Property Pais As String
+ Get
+ Return _Pais
+ End Get
+ End Property
+
+ Public ReadOnly Property CP As Integer
+ Get
+ Return _CP
+ End Get
+ End Property
+
+ Public ReadOnly Property DtResultados() As DataTable
+ Get
+ DtResultados = Data
+ End Get
+ End Property
+#End Region
+
+ Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
+
+ If TransaccionCompartida Is Nothing Then
+ SqlConexion = New SqlConnection
+ SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
+ Try
+ SqlConexion.Open()
+ Catch ex As Exception
+ OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
+ End Try
+ Else
+ SqlConexion = TransaccionCompartida.Connection
+ SqlTransacc = TransaccionCompartida
+ End If
+
+ SqlCommand = New SqlCommand("", SqlConexion)
+ SqlAdapter = New SqlDataAdapter("", SqlConexion)
+ ConexionAdd()
+ End Sub
+ Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand
+ .Parameters.Clear()
+ .CommandText = StrSQL
+ .CommandType = TipoComando
+ End With
+ If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
+ Data = New DataTable
+ End Sub
+#Region "Conexiones"
+
+ Private Sub ConexionAdd()
+ If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+
+ Try
+ 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo
+ DataAdapter("PA_Sis_RegistrarConexion")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
+ .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString)
+ .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
+ End With
+ SqlAdapter.Fill(Data)
+ CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
+ Catch ex As Exception
+ OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+
+ End If
+ End Sub
+
+ Private Sub ConexionClose()
+ If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+
+ DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
+ Try
+ SqlAdapter.Fill(Data)
+
+ Catch ex As Exception
+ OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ CveConexion = 0
+
+ End If
+
+ End Sub
+#End Region
+ Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
+ With SqlCommand
+ .Parameters.Clear()
+ .CommandText = pStrSQL
+ .CommandType = TipoComando
+ End With
+
+ If Not SqlTransacc Is Nothing Then SqlCommand.Transaction = SqlTransacc
+
+ End Sub
+ Public Function IniciaTransacSQL() As SqlTransaction
+ If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
+ Return SqlTransacc
+ End Function
+
+ Public Sub RollBack()
+ If SqlTransacc IsNot Nothing Then SqlTransacc.Rollback()
+ SqlTransacc = Nothing
+ End Sub
+ Public Sub Commit()
+ If SqlTransacc IsNot Nothing Then SqlTransacc.Commit()
+ SqlTransacc = Nothing
+ End Sub
+
+ 'Public Function GetSucursalesEmpresa(CveEmpresa As Integer) As Boolean
+ ' Dim Retorno As Boolean = False
+ ' Data = New DataTable
+ ' SqlAdapter = New SqlDataAdapter("PA_GetSucursalesEmpresa", SqlConexion)
+ ' SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
+
+ ' With SqlAdapter.SelectCommand.Parameters
+ ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ ' End With
+
+
+ ' Try
+ ' SqlAdapter.Fill(Data)
+ ' Retorno = True
+ ' Catch ex As SqlException
+ ' OnError("Ocurrió un error al consultar las Sucursales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ ' End Try
+ ' SqlAdapter.Dispose()
+ ' Return Retorno
+ 'End Function
+
+
+
+
+ Public Function GetSucursales(Optional CveEmpresa As Integer = -1) As Boolean
+ Dim Retorno As Boolean = False
+ Data = New DataTable
+ SqlAdapter = New SqlDataAdapter("PA_SucursalesGet", SqlConexion)
+ SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As SqlException
+ OnError("Ocurrió un error al consultar las Sucursales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ SqlAdapter.Dispose()
+ Return Retorno
+ End Function
+
+
+
+
+ Public Function AddSucursal(Sucursal As String, Serie As String, IVA As Double, FormatoFactura As String, CveUsuario As Integer, CveEmpresa As Integer,
+ Calle As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Municipio As String, Estado As String, Pais As String, CP As String, TipoSucursal As Integer) As Integer
+ Dim Retorno = -1
+
+ DataAdapter("PA_SucursalAdd")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Sucursal", SqlDbType.VarChar).Value = Sucursal
+ .Add("@Serie", SqlDbType.VarChar).Value = Serie
+ .Add("@IVA", SqlDbType.Float).Value = IVA
+ .Add("@FormatoFactura", SqlDbType.VarChar).Value = FormatoFactura
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+
+ .Add("@Calle", SqlDbType.VarChar).Value = Calle
+ .Add("@NoExt", SqlDbType.VarChar).Value = NoExt
+ .Add("@NoInt", SqlDbType.VarChar).Value = NoInt
+ .Add("@Colonia", SqlDbType.VarChar).Value = Colonia
+ .Add("@Localidad", SqlDbType.VarChar).Value = Localidad
+ .Add("@Municipio", SqlDbType.VarChar).Value = Municipio
+ .Add("@Estado", SqlDbType.VarChar).Value = Estado
+ .Add("@Pais", SqlDbType.VarChar).Value = Pais
+ .Add("@CP", SqlDbType.VarChar).Value = CP
+ .Add("@TipoSucursal", SqlDbType.Int).Value = TipoSucursal
+ .Add("@pCveSucursal", SqlDbType.Int).Direction = ParameterDirection.Output
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = SqlAdapter.SelectCommand.Parameters("@pCveSucursal").Value.ToString.ToEntero
+ Catch Ex1 As SqlException
+ If Ex1.Message.Contains("Número: 2627;") Then
+ Alert("Ya existe una Sucursal con el mismo nombre: " & Sucursal & ".", TipoMensaje.MsgAdvertencia)
+ Else
+ Me.OnError("Ocurrió un error al Guardar la Sucursal.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End If
+ Catch ex As Exception
+ OnError("Ocurrió un error al Guardar la Sucursal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ SqlAdapter.Dispose()
+ Return Retorno
+ End Function
+
+ Public Function UpdateSucursal(Sucursal As String, Serie As String, IVA As Double, FormatoFactura As String, Estatus As Boolean, CveUsuario As Integer, CveSucursal As Integer,
+ Calle As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Municipio As String, Estado As String, Pais As String, CP As String, TipoSucursal As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ Data = New DataTable
+ SqlAdapter = New SqlDataAdapter("PA_SucursalUpdate", SqlConexion)
+ SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Sucursal", SqlDbType.VarChar).Value = Sucursal
+ .Add("@Serie", SqlDbType.VarChar).Value = Serie
+ .Add("@IVA", SqlDbType.Float).Value = IVA
+ .Add("@FormatoFactura", SqlDbType.VarChar).Value = FormatoFactura
+ .Add("@Estatus", SqlDbType.Bit).Value = If(Estatus, 1, 0)
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+ .Add("@CveSucursal", SqlDbType.Int).Value = CveSucursal
+ .Add("@Calle", SqlDbType.VarChar).Value = Calle
+ .Add("@NoExt", SqlDbType.VarChar).Value = NoExt
+ .Add("@NoInt", SqlDbType.VarChar).Value = NoInt
+ .Add("@Colonia", SqlDbType.VarChar).Value = Colonia
+ .Add("@Localidad", SqlDbType.VarChar).Value = Localidad
+ .Add("@Municipio", SqlDbType.VarChar).Value = Municipio
+ .Add("@Estado", SqlDbType.VarChar).Value = Estado
+ .Add("@Pais", SqlDbType.VarChar).Value = Pais
+ .Add("@CP", SqlDbType.VarChar).Value = CP
+ .Add("@TipoSucursal", SqlDbType.Int).Value = TipoSucursal
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch Ex1 As SqlException
+ If Ex1.Message.Contains("Número: 2627;") Then
+ Alert("Ya existe una Sucursal con el mismo nombre: " & Sucursal & ".", TipoMensaje.MsgAdvertencia)
+ Else
+ Me.OnError("Ocurrió un error al guardar los cambios en la Sucursal", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End If
+ Catch ex As Exception
+ OnError("Ocurrió un error al guardar los cambios en la Sucursal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ SqlAdapter.Dispose()
+ Return Retorno
+ End Function
+
+ Public Function RemoveSucursal(CveSucursal As Integer) As Boolean
+ Dim OnError As Boolean = False
+ SqlAdapter = New SqlDataAdapter("PA_SucursalRemove", SqlConexion)
+ SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveSucursal", SqlDbType.Int).Value = CveSucursal
+ End With
+ Data = New DataTable()
+ Try
+ SqlAdapter.Fill(Data)
+ OnError = True
+ Catch Ex1 As SqlException
+ If Ex1.Message.Contains("Número: 547;") Then
+ Alert("La Sucursal no se pudo eliminar por que esta siendo usada por un registro.", TipoMensaje.MsgAdvertencia)
+ Else
+ Me.OnError("Ocurrió un error al eliminar la Sucursal.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End If
+ Catch ex As Exception
+ Me.OnError("Ocurrió un error al eliminar la Sucursal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ SqlAdapter.Dispose()
+ Return OnError
+ End Function
+
+#Region "IDisposable Support"
+
+
+ ' IDisposable
+ Protected Overridable Sub Dispose(disposing As Boolean)
+ If Not Me.disposedValue Then
+ If disposing Then
+ ' TODO: dispose managed state (managed objects).
+ If Not Data Is Nothing Then Data.Dispose()
+ If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose()
+ If Not SqlCommand Is Nothing Then SqlCommand.Dispose()
+ If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
+ If Not SqlConexion Is Nothing Then SqlConexion.Dispose()
+ End If
+
+ ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
+ ' TODO: set large fields to null.
+ End If
+ Me.disposedValue = True
+ End Sub
+
+ ' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources.
+ 'Protected Overrides Sub Finalize()
+ ' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
+ ' Dispose(False)
+ ' MyBase.Finalize()
+ 'End Sub
+
+ ' This code added by Visual Basic to correctly implement the disposable pattern.
+ Public Sub Dispose() Implements IDisposable.Dispose
+ ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
+ ConexionClose()
+ Dispose(True)
+ GC.SuppressFinalize(Me)
+ End Sub
+#End Region
+
+End Class
diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx
index 445f02eb9..7b5e09dbd 100644
--- a/Bancos/DepositosCaja.aspx
+++ b/Bancos/DepositosCaja.aspx
@@ -136,7 +136,7 @@
-
+
@@ -144,10 +144,7 @@
-
-
-
-
+
@@ -155,7 +152,7 @@
-
+
@@ -167,11 +164,11 @@
-
+
-
+
@@ -183,21 +180,47 @@
-
+
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -272,7 +295,8 @@
var comision = 0;
var descuento = 0;
var saldo = 0;
- var IVA = 0
+ var IVA = 0;
+ var ComisionIntermediario = 0;
function FnSuma(chk, cantidad) {
var saldoInicial = ToDouble($('#C_lblValorTotal').text());
@@ -318,26 +342,7 @@
//debugger;
}
}
- var txtcomision = ToDouble($('#C_TxtIVA').val());
- if (txtcomision != 0) {
- var comisionNegativa = 0;
- if (txtcomision < 0) {
- comisionNegativa = txtcomision * -1;
- }
- if (comisionNegativa > saldo) {
- $('#C_TxtIVA').val(0);
- comision = 0;
- descuento = 0;
- txtcomision = 0;
- alert("No es posible poner un importe IVA superior a lo seleccionado");
- saldo = 0;
- $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
- debugger;
- } else {
-
- //debugger;
- }
- }
+
}
if ($('#C_ChkDescuento').attr('checked')) {
var txtdescuento = ToDouble($('#C_TxtDescuento').val());
@@ -363,6 +368,54 @@
}
}
}
+ if ($('#C_ChkIntermediario').attr('checked')) {
+ var txtimporte= ToDouble($('#C_TxtComisionIntermediario').val());
+ if (txtimporte != 0) {
+ var DescuentoNegativa = 0;
+ if (txtimporte > 0) {
+ DescuentoNegativa = txtimporte * -1;
+ }
+ if (DescuentoNegativa > saldo) {
+ $('#C_TxtDescuento').val(0);
+ comision = 0;
+ descuento = 0;
+ IVA = 0;
+ txtimporte = 0;
+ alert("No es posible poner un descuento superior a lo seleccionado");
+ saldo = 0;
+ $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
+ debugger;
+ } else {
+ //saldo = ValorTotalSeleccionado + txtdescuento + comision;
+ //$('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
+ //descuento = ToDouble($('#C_TxtDescuento').val())
+ //debugger;
+ }
+ }
+
+ var txtcomision = ToDouble($('#C_TxtIVA').val());
+ if (txtcomision != 0) {
+ var comisionNegativa = 0;
+ if (txtcomision < 0) {
+ comisionNegativa = txtcomision * -1;
+ }
+ if (comisionNegativa > saldo) {
+ $('#C_TxtIVA').val(0);
+ comision = 0;
+ descuento = 0;
+ IVA = 0;
+ ComisionIntermediario = 0;
+ txtcomision = 0;
+ alert("No es posible poner un importe IVA superior a lo seleccionado");
+ saldo = 0;
+ $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
+ debugger;
+ } else {
+
+ //debugger;
+ }
+ }
+ }
}
@@ -376,7 +429,7 @@
$('#C_TxtComision').val(0)
alert("No es posible poner una comision superior a lo seleccionado")
} else {
- saldo = ValorTotalSeleccionado + comision2 + descuento + IVA;
+ saldo = ValorTotalSeleccionado + comision2 + descuento - IVA - ComisionIntermediario;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
comision = ToDouble($('#C_TxtComision').val())
}
@@ -393,7 +446,7 @@
$('#C_TxtDescuento').val(descuento)
alert("No es posible poner un descuento superior a lo seleccionado")
} else {
- saldo = ValorTotalSeleccionado + comision2 + comision + IVA;
+ saldo = ValorTotalSeleccionado + comision2 + comision - IVA - ComisionIntermediario;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
descuento = ToDouble($('#C_TxtDescuento').val())
}
@@ -403,21 +456,30 @@
function txtSumaIVA(txt) {
var comision2 = ToDouble($('#C_TxtIVA').val());
- var comisionNegativa = 0;
- if (comision2 < 0) {
- comisionNegativa = comision2 * -1;
- }
- if (comisionNegativa > ValorTotalSeleccionado) {
+ if (comision2 > ValorTotalSeleccionado) {
$('#C_TxtIVA').val(descuento)
alert("No es posible poner un IVA superior a lo seleccionado")
} else {
- saldo = ValorTotalSeleccionado + descuento + comision + comision2;
+ saldo = ValorTotalSeleccionado + descuento + comision - comision2 - ComisionIntermediario;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
IVA = ToDouble($('#C_TxtIVA').val())
}
}
+ function txtSumaTntermediario(txt) {
+ var comision2 = ToDouble($('#C_TxtComisionIntermediario').val());
+ if (comision2 > ValorTotalSeleccionado) {
+ $('#C_TxtComisionIntermediario').val(descuento)
+ alert("No es posible poner un importe superior a lo seleccionado")
+ } else {
+ saldo = ValorTotalSeleccionado + descuento + comision - comision2 - IVA;
+ $('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
+ ComisionIntermediario = ToDouble($('#C_TxtComisionIntermediario').val())
+ }
+
+ }
+
function CheckFaltante(chk) {
if (chk.checked == true) {
$('#DivComision').css("display", "block");
@@ -425,7 +487,6 @@
$('#divSubProyecto').css("display", "block");
$('#LblClasificacion').css("display", "block");
$('#divClasificacion').css("display", "block");
- $('#DivIVA').css("display", "block");
} else {
$('#DivComision').css("display", "none");
@@ -433,7 +494,6 @@
$('#divSubProyecto').css("display", "none");
$('#LblClasificacion').css("display", "none");
$('#divClasificacion').css("display", "none");
- $('#DivIVA').css("display", "none");
}
}
@@ -454,6 +514,14 @@
$('#divClasificacionDescuento').css("display", "none");
}
}
+
+ function CheckIntermediario(chk) {
+ if (chk.checked == true) {
+ $('#DivInter').css("display", "block");
+ } else {
+ $('#DivInter').css("display", "none");
+ }
+ }
diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb
index b245a4e7d..4e578253e 100644
--- a/Bancos/DepositosCaja.aspx.vb
+++ b/Bancos/DepositosCaja.aspx.vb
@@ -24,11 +24,14 @@ Partial Class Bancos_DepositosCaja
TxtComision.Attributes.Add("onKeyUp", "txtSuma(event);")
TxtDescuento.Attributes.Add("onKeyUp", "txtSumaDescuento(event);")
TxtIVA.Attributes.Add("onKeyUp", "txtSumaIVA(event);")
+ TxtComisionIntermediario.Attributes.Add("onKeyUp", "txtSumaTntermediario(event);")
CargaCuentas()
ChkFaltante.Attributes.Add("onclick", "CheckFaltante(this);")
ChkDescuento.Attributes.Add("onclick", "CheckDescuento(this);")
+ ChkIntermediario.Attributes.Add("onclick", "CheckIntermediario(this);")
+
End If
End Sub
@@ -46,19 +49,30 @@ Partial Class Bancos_DepositosCaja
DdlSubProyectoDeposito.DataSource = DdlSubProyectos.DataSource
DdlSubProyectoDeposito.DataBind()
- DdlSubProyectos.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ DdlSubProyectoDeposito.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlSubProyectoDescuento.DataSource = DdlSubProyectos.DataSource
DdlSubProyectoDescuento.DataBind()
- DdlSubProyectos.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ DdlSubProyectoDescuento.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=2)
DdlClasificacion.DataBind()
- DdlSubProyectos.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ DdlClasificacion.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlClasificacionDescuento.DataSource = DdlClasificacion.DataSource
DdlClasificacionDescuento.DataBind()
- DdlSubProyectos.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ DdlClasificacionDescuento.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
+ 'intermediario
+ DdlProveedorIntermediario.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveProveedor in ({0})", 73343))
+ DdlProveedorIntermediario.DataBind()
+
+ DdlClasificacionIntermediario.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=2)
+ DdlClasificacionIntermediario.DataBind()
+
+ DdlSubProyectoIntermediario.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa)
+ DdlSubProyectoIntermediario.DataBind()
+
End Sub
@@ -80,7 +94,7 @@ Partial Class Bancos_DepositosCaja
UpGvFacturas.Update()
GvFacturas.DataBind()
lblValorTotal.Text = "0.00"
- TxtComision.text = ""
+ TxtComision.Text = ""
divLabelTotal.Visible = True
End Sub
@@ -91,6 +105,7 @@ Partial Class Bancos_DepositosCaja
Dim Comision As Decimal = TxtComision.Text.ToDecimal
Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal
Dim IVA As Decimal = TxtIVA.Text.ToDecimal
+ Dim ImporteInter As Decimal = TxtComisionIntermediario.Text.ToDecimal
For Each Gvr As GridViewRow In GvFacturas.Rows
@@ -104,7 +119,7 @@ Partial Class Bancos_DepositosCaja
TotalImportePrePoliza = TotalImporte
If Comision <> 0 Then
- TotalImporte = TotalImporte + Comision + Descuento + IVA
+ TotalImporte = TotalImporte + Comision + Descuento
'Comision = -(Comision) ' se inverte el valor, va cargada
'Descuento = -(Descuento) ' se inverte el valor, va cargada
If DdlSubProyectoDeposito.SelectedValue.ToEntero = -1 Or DdlClasificacion.SelectedValue.ToEntero = -1 Then
@@ -113,6 +128,10 @@ Partial Class Bancos_DepositosCaja
End If
End If
+ If TxtComisionIntermediario.Text.ToDecimal <> 0 Then
+ TotalImporte = TotalImporte - TxtComisionIntermediario.Text.ToDecimal - IVA
+ End If
+
Dim OcurrioError As Boolean = False
Dim ObjContabilidad As New ClsContabilidad()
Dim ObjBancos As New ClsBancos(ObjContabilidad.IniciaTransacSQL())
@@ -134,8 +153,11 @@ Partial Class Bancos_DepositosCaja
Dim CveSubProyectoDescuento As Integer = -1
Dim CveClasificacion As Integer = -1
Dim CveClasificacionDescuento As Integer = -1
- Dim documentos As String = "Los Depósitos se realizaron exitósamente
"
+ Dim documentos As String = "Los Depósitos se realizaron exitosamente
"
Dim imprimirFolios As String = ""
+ Dim CveSubProyectoIntermediario As Integer = -1
+ Dim CveClasificacionIntermediario As Integer = -1
+
If drOrigen IsNot Nothing Then
CveMoneda = drOrigen("CveMoneda").ToString.ToEntero
IdCuentaBancariaOrigen = drOrigen("IdCtaContable").ToString.ToEntero
@@ -148,37 +170,59 @@ Partial Class Bancos_DepositosCaja
CveCuentaBancariaDestino = drDestino("IdCtaContableSIG").ToString.ToEntero
End If
- NuevaCvePrePoliza = ObjContabilidad.AddPrePolizas("Vta", 13, TotalImportePrePoliza, TotalImportePrePoliza, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
+ NuevaCvePrePoliza = ObjContabilidad.AddPrePolizas("Vta", 13, TotalImportePrePoliza, TotalImportePrePoliza, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=1)
+
+
+ If ChkIntermediario.Checked Then
+
+ CveSubProyectoIntermediario = DdlSubProyectoIntermediario.SelectedValue.ToEntero
+ CveClasificacionIntermediario = DdlClasificacionIntermediario.SelectedValue.ToEntero
+ CveProveedorIntermediario = DdlProveedorIntermediario.SelectedValue.ToEntero
+
+
+ If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, DdlClasificacionIntermediario.SelectedItem.Text, 95, DdlClasificacionIntermediario.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, ImporteMX:=TotalImporte, CveProveedor:=CveProveedorIntermediario, CveCuenta:=57619) Then
+ OcurrioError = True
+ End If
+
+ If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, TotalImporte, DdlClasificacionIntermediario.SelectedItem.Text, 95, DdlClasificacionIntermediario.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, ImporteMX:=TotalImporte, CveProveedor:=CveProveedorIntermediario, CveCuenta:=57619) Then
+ OcurrioError = True
+ End If
+
+
+ If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, ImporteInter, DdlClasificacionIntermediario.SelectedItem.Text, 51, DdlClasificacionIntermediario.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, ImporteMX:=ImporteInter) Then
+ OcurrioError = True
+ End If
+
+ If IVA <> 0 Then
+ If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, IVA, DdlClasificacionIntermediario.SelectedItem.Text, 14, DdlClasificacionIntermediario.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, ImporteMX:=IVA, PorcentajeImpuesto:=0.16D) Then
+ OcurrioError = True
+ End If
+ End If
+
+ End If
'Entrada a bancos
FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, 13)
If Not FolioIE > 0 Then
OcurrioError = True
End If
- CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, 13, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
+ CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, 13, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorIntermediario:=CveProveedorIntermediario)
documentos += String.Format("Depósito: {1}     ", CveIEOrigen, FolioIE)
- If ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen, ImporteMX:=TotalImporte * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then
+ If ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen, ImporteMX:=TotalImporte * TipoCambio) Then
If ChkFaltante.Checked Then
CveSubProyecto = DdlSubProyectoDeposito.SelectedValue.ToEntero
CveClasificacion = DdlClasificacion.SelectedValue.ToEntero
If Comision <> 0 Then
- If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Comision, DdlClasificacion.SelectedItem.Text, 51, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, ImporteMX:=Comision * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then
+ If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Comision, DdlClasificacion.SelectedItem.Text, 51, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, ImporteMX:=Comision * TipoCambio) Then
OcurrioError = True
End If
End If
- If IVA <> 0 Then
- IVA = CDec(0.16)
- If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, IVA, DdlClasificacion.SelectedItem.Text, 14, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, ImporteMX:=Comision * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then
- OcurrioError = True
- End If
- End If
-
End If
If ChkDescuento.Checked Then
@@ -189,62 +233,86 @@ Partial Class Bancos_DepositosCaja
OcurrioError = True
End If
End If
- Else
- OcurrioError = True
- End If
- For Each Gvr As GridViewRow In GvFacturas.Rows
+ If 1 = 1 Then
- If Gvr.FCCheckBox("ChkFactura").Checked Then
- 'Datos de las Nuevas PrePolizas
- 'Entrada a Bancos
+ CveSubProyectoIntermediario = DdlSubProyectoIntermediario.SelectedValue.ToEntero
+ CveSubProyectoIntermediario = DdlClasificacionIntermediario.SelectedValue.ToEntero
- Dim Importe As Decimal = Gvr.DataKey("Importe").ToDecimal
- Dim SerieFolio As String = Gvr.DataKey("SerieFolio").ToString
+ If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, Descuento, DdlClasificacionDescuento.SelectedItem.Text, 51, DdlClasificacionDescuento.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacionDescuento, CveSubProyecto:=CveSubProyecto, ImporteMX:=Comision * TipoCambio) Then
+ OcurrioError = True
+ End If
- 'Datos de las Prepolizas A Cancelar
- Dim CveIE As Integer = Gvr.DataKey("CveIE").ToEntero
- Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero
- Dim CvePrePoliza As Integer = Gvr.DataKey("CvePrePoliza").ToEntero
+ If IVA <> 0 Then
+ If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, IVA, DdlClasificacionIntermediario.SelectedItem.Text, 14, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacionIntermediario, CveSubProyecto:=CveSubProyectoIntermediario, ImporteMX:=IVA, CveCuenta:=CveCuentaBancariaOrigen, PorcentajeImpuesto:=0.16D) Then
+ OcurrioError = True
+ End If
+ End If
- FolioIE = ObjBancos.GetNextFolio(DdlCajaChica.SelectedValue.ToEntero, 2)
- If Not FolioIE > 0 Then
- OcurrioError = True
- End If
- CveIEDestino = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, 2, Fecha, FolioIE.ToString, String.Format("Depósito Bancario: {0}", SerieFolio), Importe, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
-
-
- If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, SerieFolio, 30, String.Format("Depósito Bancario: {0}", SerieFolio), Fecha, IdCuentaBancariaDestino, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEDestino, ImporteMX:=Importe * TipoCambio, CveCuenta:=CveCuentaBancariaDestino) Then
- OcurrioError = True
End If
- 'Asignamos la cuenta Deposito
- If Not ObjBancos.UpdateBancos_IECuentaDeposito(CveIEDestino, CveIE) Then
- OcurrioError = True
- End If
- Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEDestino}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}")
-
- 'documentos += String.Format("Imprimir {1}
", StrEncript, SerieFolio)
+ Else
+ OcurrioError = True
End If
- Next
+ For Each Gvr As GridViewRow In GvFacturas.Rows
+
+ If Gvr.FCCheckBox("ChkFactura").Checked Then
+ 'Datos de las Nuevas PrePolizas
+ 'Entrada a Bancos
+
+ Dim Importe As Decimal = Gvr.DataKey("Importe").ToDecimal
+ Dim SerieFolio As String = Gvr.DataKey("SerieFolio").ToString
+
+ 'Datos de las Prepolizas A Cancelar
+ Dim CveIE As Integer = Gvr.DataKey("CveIE").ToEntero
+ Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero
+ Dim CvePrePoliza As Integer = Gvr.DataKey("CvePrePoliza").ToEntero
+
+ FolioIE = ObjBancos.GetNextFolio(DdlCajaChica.SelectedValue.ToEntero, 2)
+ If Not FolioIE > 0 Then
+ OcurrioError = True
+ Exit For
+ End If
+ CveIEDestino = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, 2, Fecha, FolioIE.ToString, String.Format("Depósito Bancario: {0}", SerieFolio), Importe, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
- If OcurrioError Then
- ObjContabilidad.RollBack()
- Alert("Ocurrio un error al realizar los depositos", TipoMensaje.MsgError)
- Else
- ObjContabilidad.Commit()
- CargaDatos()
+ If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, SerieFolio, 30, String.Format("Depósito Bancario: {0}", SerieFolio), Fecha, IdCuentaBancariaDestino, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEDestino, ImporteMX:=Importe * TipoCambio, CveCuenta:=CveCuentaBancariaDestino) Then
+ OcurrioError = True
+ Exit For
+ End If
- documentos += String.Format("Prepóliza
", NuevaCvePrePoliza)
+ 'Asignamos la cuenta Deposito
+ If Not OcurrioError AndAlso Not ObjBancos.UpdateBancos_IECuentaDeposito(CveIEDestino, CveIE) Then
+ OcurrioError = True
+ Exit For
+ End If
+ Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEDestino}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}")
- Alert(documentos.ToString)
+ 'documentos += String.Format("Imprimir {1}
", StrEncript, SerieFolio)
+ End If
+
+ Next
- End If
+ If OcurrioError Then
+ ObjContabilidad.RollBack()
+ Alert("Ocurrio un error al realizar los depositos", TipoMensaje.MsgError)
+ Else
+ ObjContabilidad.Commit()
+ CargaDatos()
- ObjContabilidad.Dispose()
+ documentos += String.Format("Prepóliza
", NuevaCvePrePoliza)
+
+ Alert(documentos.ToString)
+
+
+ End If
+ TxtComision.Text = ""
+ TxtDescuento.Text = ""
+ TxtIVA.Text = ""
+ TxtComisionIntermediario.Text = ""
+ ObjContabilidad.Dispose()
End Sub
Private Sub ObtenerTotalImporta()
diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb
index e48ffc632..341045a66 100644
--- a/Bancos/IE.aspx.vb
+++ b/Bancos/IE.aspx.vb
@@ -1243,7 +1243,6 @@ Partial Class Bancos_IE
Else
BtnEditar.Visible = False
- LnkEliminar.Visible = False
LnkCancelarComplemento.Visible = False
LnkCancelarComplementoImporte.Visible = False
DVGenerarComplementoModal.Visible = False
diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb
index 4f4b7bb7f..fdf1a13af 100644
--- a/Bancos/ProveedoresAbonar.aspx.vb
+++ b/Bancos/ProveedoresAbonar.aspx.vb
@@ -974,7 +974,6 @@ Partial Class Bancos_ProveedoresAbonar
Dim importeMX As Decimal
Dim FechaMovimiento As Date = TxtFechaDocumento.Text.ToDate
Dim IdCtaContable As Integer = 0
- Dim CveCuenta As Integer = 0
Dim ConceptoMovimiento As String
Dim Referencia As String
Dim tipoCambioCompra As Decimal
@@ -1003,6 +1002,14 @@ Partial Class Bancos_ProveedoresAbonar
End If
End If
+
+ Dim DttPlantilla As DataTable = Nothing
+ If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
+ DttPlantilla = ObjMov.DtResultados
+ End If
+
+ Dim TipoContabilidad As Integer = UsuarioActual.Empresa.TipoContabilidad
+
'inserto las compras que voy a pagar
For Each gvr As GridViewRow In GvCxP.Rows
If gvr.FCCheckBox("Chk").Checked Then
@@ -1031,33 +1038,17 @@ Partial Class Bancos_ProveedoresAbonar
End If
CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero
- If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
- For Each Row As DataRow In ObjMov.DtResultados.Rows
+ 'If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
+ If DttPlantilla IsNot Nothing AndAlso DttPlantilla.Rows.Count > 0 Then
+ For Each Row As DataRow In DttPlantilla.Rows
ConceptoContable = Row("CveConcepto").ToString.ToEntero
TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False)
ImporteMovimiento = 0
IdCtaContable = 0
- CveCuenta = 0
ConceptoMovimiento = $"{HplProveedor.Text} F:{gvr.DataKey("SerieFolio")}"
Referencia = gvr.DataKey("SerieFolio").ToString
Dim PorcentajeImpuesto As Decimal = 0
- If ConceptoContable.Contiene(14, 19) AndAlso gvr.DataKey("CveCompra").ToEntero > 0 Then
-
- If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
- If gvr.DataKey("EsImportacion").ToString = "1" Then
- EsImportacion = True
- If ConceptoContable = 14 Then
- ConceptoContable = 287
- Else
- ConceptoContable = 288
- End If
- Else
- EsImportacion = False
- End If
- End If
-
- End If
Select Case ConceptoContable
Case 17 'Pago Proveedores
@@ -1096,7 +1087,6 @@ Partial Class Bancos_ProveedoresAbonar
IdCtaContable = CtaAcreedor
Else
IdCtaContable = CtaProveedor
- CveCuenta = CveCuentaProveedor
End If
Else
@@ -1105,7 +1095,6 @@ Partial Class Bancos_ProveedoresAbonar
ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
IdCtaContable = IdCtaContComplementaria
- CveCuenta = CveCuentaProveedorExtranjera
If ImporteMovimiento <> 0 AndAlso (UsaComplementariaProveedores Or IdCtaContable > 0) Then 'Cuando tiene complementaria lo dividimos en dos
importeMX = ImporteMovimiento
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
@@ -1113,7 +1102,6 @@ Partial Class Bancos_ProveedoresAbonar
End If
End If
IdCtaContable = IdCtaProveedorExtranjera
- CveCuenta = CveCuentaProveedorExtranjera
End If
Case 15 'Ret IVA X Acreditar Honorarios/Serv. Prof.
If gvr.DataKey("CveRetIVAConcepto").ToEntero = 1 Then
@@ -1145,23 +1133,13 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(307).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(307).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
- 'Conta SIG
- If CveCuentaRetIVA <> 0 Then
- CveCuenta = CveCuentaRetIVA
- Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
- If ObjMov.DtResultados.Rows.Count > 0 Then
- CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero
- End If
- End If
- End If
End If
Case 22 'Ret IVA Acreditable Honorarios/Serv. Prof.
If gvr.DataKey("CveRetIVAConcepto").ToEntero = 1 Then
@@ -1192,7 +1170,7 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(308).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(308).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
@@ -1228,23 +1206,13 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(309).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(309).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
- 'Conta SIG
- If CveCuentaRetIVA <> 0 Then
- CveCuenta = CveCuentaRetIVA
- Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
- If ObjMov.DtResultados.Rows.Count > 0 Then
- CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero
- End If
- End If
- End If
End If
Case 184 'Ret IVA Acreditable Fletes P.F.
If gvr.DataKey("CveRetIVAConcepto").ToEntero = 2 Then
@@ -1275,7 +1243,7 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(310).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(310).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
@@ -1311,23 +1279,13 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(311).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(311).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
- 'Conta SIG
- If CveCuentaRetIVA <> 0 Then
- CveCuenta = CveCuentaRetIVA
- Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
- If ObjMov.DtResultados.Rows.Count > 0 Then
- CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero
- End If
- End If
- End If
End If
Case 186 'Ret IVA Acreditable Fletes P.M.
If gvr.DataKey("CveRetIVAConcepto").ToEntero = 3 Then
@@ -1358,7 +1316,7 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(312).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(312).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
@@ -1394,7 +1352,7 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(313).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(313).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
@@ -1430,7 +1388,7 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(314).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(314).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
@@ -1465,7 +1423,7 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(578).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
@@ -1500,7 +1458,7 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf UsuarioActual.Empresa.Funcionalidad(582).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(582).ToEntero
Else
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
@@ -1541,16 +1499,7 @@ Partial Class Bancos_ProveedoresAbonar
' End If
' End If
- ' 'Conta SIG
- ' If CveCuentaRetISR <> 0 Then
- ' CveCuenta = CveCuentaRetISR
- ' Else
- ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
- ' If ObjMov.DtResultados.Rows.Count > 0 Then
- ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero
- ' End If
- ' End If
- ' End If
+
' End If
'Case 23 'Ret ISR Acreditable
' If gvr.DataKey("CveRetISRConcepto").ToEntero = 1 Then
@@ -1586,16 +1535,7 @@ Partial Class Bancos_ProveedoresAbonar
' End If
' End If
- ' 'Conta SIG
- ' If CveCuentaRetISR <> 0 Then
- ' CveCuenta = CveCuentaRetISR
- ' Else
- ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
- ' If ObjMov.DtResultados.Rows.Count > 0 Then
- ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero
- ' End If
- ' End If
- ' End If
+
' End If
'Case 243 'Ret ISR x Acreditar Terceros y Arrendamiento
' If gvr.DataKey("CveRetISRConcepto").ToEntero = 2 Then
@@ -1631,16 +1571,7 @@ Partial Class Bancos_ProveedoresAbonar
' End If
' End If
- ' 'Conta SIG
- ' If CveCuentaRetISR <> 0 Then
- ' CveCuenta = CveCuentaRetISR
- ' Else
- ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
- ' If ObjMov.DtResultados.Rows.Count > 0 Then
- ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero
- ' End If
- ' End If
- ' End If
+
' End If
'Case 244 'Ret ISR Acreditable Terceros y Arrendamiento
' If gvr.DataKey("CveRetISRConcepto").ToEntero = 2 Then
@@ -1676,15 +1607,6 @@ Partial Class Bancos_ProveedoresAbonar
' End If
' End If
- ' 'Conta SIG
- ' If CveCuentaRetISR <> 0 Then
- ' CveCuenta = CveCuentaRetISR
- ' Else
- ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
- ' If ObjMov.DtResultados.Rows.Count > 0 Then
- ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero
- ' End If
- ' End If
' End If
' End If
Case 14 'Iva X Acreditar
@@ -1742,83 +1664,21 @@ Partial Class Bancos_ProveedoresAbonar
Dim IdCtaIVAXAcreditar As Integer = 0
Dim IdCtaIVAAcreditable As Integer = 0
+ If gvr.DataKey("EsImportacion").ToString.contiene("1", "True") Then
+ ConceptoContable = 287
+ End If
+
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
End If
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
- CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero
End If
End If
- Case 287 'Iva X Acreditar Importacion
- Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
- If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
- 'funcionalidad que toma el 100% del pago para acreditamiento de iva
- If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then
- If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
- ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
- importeMX = ImporteMovimiento
- ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
- tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
- ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
- importeMX = ImporteMovimiento * tipoCambioCompra
- ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
- ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
- importeMX = ImporteMovimiento * tipoCambioCompra
- ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
- tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
- ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
- importeMX = ImporteMovimiento * tipoCambioCompra
- End If
- ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
- importeMX = Math.Round(importeMX, 2)
-
- If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
- Else
- ImporteMovimiento = 0
- importeMX = 0
- End If
- Else
- ImporteMovimiento = gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago
-
-
- If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
- importeMX = ImporteMovimiento
- ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
- tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
- importeMX = ImporteMovimiento * tipoCambioCompra
- ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
- importeMX = ImporteMovimiento * tipoCambioCompra
- ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
- tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
- importeMX = ImporteMovimiento * tipoCambioCompra
- End If
- ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
- importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
-
- If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
- End If
- TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
-
- PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
- Dim IdCtaIVAXAcreditar As Integer = 0
- Dim IdCtaIVAAcreditable As Integer = 0
-
- If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
- IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
- IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
- End If
- IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
- If ObjMov.DtResultados.Rows.Count > 0 Then
- IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
- CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
- End If
- End If
Case 19 'Iva Acreditado
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
@@ -1869,7 +1729,9 @@ Partial Class Bancos_ProveedoresAbonar
End If
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
-
+ If gvr.DataKey("EsImportacion").ToString.contiene("1", "True") Then
+ ConceptoContable = 288
+ End If
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
Dim IdCtaIVAXAcreditar As Integer = 0
@@ -1888,7 +1750,7 @@ Partial Class Bancos_ProveedoresAbonar
Dim ImporteNOIVA As Decimal = gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal * PorcentajePago
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteNOIVA, Referencia, 280, ConceptoMovimiento, FechaMovimiento, IdCtaContableNoIVA, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=ImporteNOIVA, ImporteME:=If(TipoCambioPago = 1, 0, ImporteMovimiento), CveCuenta:=CveCuenta, TipoCambio:=TipoCambioGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteNOIVA, Referencia, 280, ConceptoMovimiento, FechaMovimiento, IdCtaContableNoIVA, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=ImporteNOIVA, ImporteME:=If(TipoCambioPago = 1, 0, ImporteMovimiento), TipoCambio:=TipoCambioGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then
MsgError = "No se pudo insertar la póliza"
Exit For
@@ -1896,94 +1758,12 @@ Partial Class Bancos_ProveedoresAbonar
End If
End If
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero
- CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero
End If
End If
- Case 288 'Iva Acreditado
- Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
- If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
- 'funcionalidad que toma el 100% del pago para acreditamiento de iva
- If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then
- If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
- ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
- importeMX = ImporteMovimiento
- ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
- tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
- ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
- importeMX = gvr.DataKey("IVADeducible").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
- ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
- ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
- importeMX = ImporteMovimiento * tipoCambioCompra
- ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
- tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
- ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
- importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
- End If
- ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
- importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
-
- If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
- Else
- ImporteMovimiento = 0
- importeMX = 0
- End If
- Else
- ImporteMovimiento = gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago
-
- If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
- importeMX = ImporteMovimiento
- ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
- tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
- importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
- ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
- importeMX = ImporteMovimiento * tipoCambioCompra
- ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
- tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
-
- importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
- End If
- ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
- importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
-
- If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
- End If
- TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
-
-
-
- PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
- Dim IdCtaIVAXAcreditar As Integer = 0
- Dim IdCtaIVAAcreditable As Integer = 0
- Dim IdCtaContableNoIVA As Integer = 0
-
- If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
- IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
- IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
- IdCtaContableNoIVA = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVANoAcreditable").ToString.ToEntero
- End If
- IdCtaContable = If(IdCtaIVAAcreditable > 0, IdCtaIVAAcreditable, 0)
-
- 'se registra el iva no acreditable
- If gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal > 0 Then
-
- Dim ImporteNOIVA As Decimal = gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal * PorcentajePago
-
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteNOIVA, Referencia, 280, ConceptoMovimiento, FechaMovimiento, IdCtaContableNoIVA, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=ImporteNOIVA, ImporteME:=If(TipoCambioPago = 1, 0, ImporteMovimiento), CveCuenta:=CveCuenta, TipoCambio:=TipoCambioGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then
- MsgError = "No se pudo insertar la póliza"
- Exit For
- End If
- End If
-
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
- If ObjMov.DtResultados.Rows.Count > 0 Then
- IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
- CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
- End If
- End If
Case 25 'IEPS X Acreditar
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
ImporteMovimiento = gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago
@@ -2003,10 +1783,9 @@ Partial Class Bancos_ProveedoresAbonar
TipoCambioGeneral = tipoCambioCompra
If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
- CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero
End If
End If
Case 26 'IEPS Acreditable
@@ -2027,17 +1806,15 @@ Partial Class Bancos_ProveedoresAbonar
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
- If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
+ If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
- CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero
End If
End If
Case 64 'Ganancia
If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
- CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
'tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal)
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
@@ -2076,7 +1853,6 @@ Partial Class Bancos_ProveedoresAbonar
'Dim IEPS As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IEPSPorPagar").ToDecimal - (gvr.DataKey("IEPS").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) 'If(TotalImporte = gvr.DataKey("Saldo").ToDecimal, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago)
'IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
- 'CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
'Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompraValuacion)
'TipoCambioGeneral = TCImpuestos
'''' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra
@@ -2096,7 +1872,6 @@ Partial Class Bancos_ProveedoresAbonar
If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
- CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
'tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal)
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
@@ -2117,7 +1892,6 @@ Partial Class Bancos_ProveedoresAbonar
'Dim IEPS As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IEPSPorPagar").ToDecimal - (gvr.DataKey("IEPS").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) 'If(TotalImporte = gvr.DataKey("Saldo").ToDecimal, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago)
'IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
- 'CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
'Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompraValuacion)
'' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra
'If TipoCambioPago > tipoCambioCompra AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
@@ -2169,10 +1943,8 @@ Partial Class Bancos_ProveedoresAbonar
ObjCreditos.GetTarjetasCreditos(DdlCuenta.SelectedValue.ToEntero, DdlTarjeta.SelectedValue.ToEntero)
If ObjCreditos.DtResultados.Rows.Count > 0 AndAlso (ObjCreditos.DtResultados.Rows(0)("IdCtaContableTarjeta").ToString.ToEntero > 0 Or ObjCreditos.DtResultados.Rows(0)("IdCtaContableTarjetaSIG").ToString.ToEntero > 0) Then
IdCtaContable = ObjCreditos.DtResultados.Rows(0)("IdCtaContableTarjeta").ToString.ToEntero
- CveCuenta = ObjCreditos.DtResultados.Rows(0)("IdCtaContableTarjetaSIG").ToString.ToEntero
Else
IdCtaContable = IdCuenta
- CveCuenta = CveCuentaB
End If
ImporteMovimiento = TxtImporte.Text.ToDecimal
@@ -2207,13 +1979,7 @@ Partial Class Bancos_ProveedoresAbonar
idCuentaContabilizacion = 0
End If
- 'Conta SIG
- If CveCuenta = 0 Then
- CuentasContablesInvalidasSIG.Append(" " & GlobalDTContaConceptosContables(-1).FiltroPrimeroValor("ConceptoContable", String.Format("CveConceptoContable = {0}", ConceptoContable)))
- CveCuentaContabilizacion = 0
- End If
-
- If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, CveSubProyecto:=CveSubProyecto, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=importeMX, ImporteME:=If(TipoCambioPago = 1, 0, ImporteMovimiento), CveCuenta:=CveCuenta, TipoCambio:=TipoCambioGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, CveSubProyecto:=CveSubProyecto, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=importeMX, ImporteME:=If(TipoCambioPago = 1, 0, ImporteMovimiento), TipoCambio:=TipoCambioGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then
MsgError = "No se pudo insertar la póliza"
Exit For
End If
@@ -3407,7 +3173,7 @@ Partial Class Bancos_ProveedoresAbonar
Dim IVA As Decimal = PorcentajePago * gr.DataKey("IVA").ToDecimal
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, gr.DataKey("SerieFolio").ToString, 14, ConceptoPartida, Now, IdCtaContable:=IdCtaIVAXAcreditar, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, IVA, IVA * If(FuncionalidadFluctuacionImpuestos, TCPago, TCCompra)), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, gr.DataKey("SerieFolio").ToString, 14, ConceptoPartida, Now, IdCtaContable:=IdCtaIVAXAcreditar, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, IVA, IVA * If(FuncionalidadFluctuacionImpuestos, TCPago, TCCompra)), PorcentajeImpuesto:=PorcentajeImpuesto) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
@@ -3449,11 +3215,11 @@ Partial Class Bancos_ProveedoresAbonar
If TCCompra > TCPago Then
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 64, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCCompra, TipoCambioPago:=TCPago) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 64, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TCCompra, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
Else
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 65, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCCompra, TipoCambioPago:=TCPago) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 65, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TCCompra, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
End If
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 282e4212a..71212231f 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -10586,7 +10586,6 @@ Partial Class Compras_Compras
If ObjConta.GetRetCuenta(49, Row2("CveActivoFijo").ToString.ToEntero) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContActivoFijo").ToString.ToEntero
- CveCuenta = ObjConta.DtResultados.Rows(0)("IdCtaContActivoFijoSIG").ToString.ToEntero
End If
End If
@@ -10626,7 +10625,6 @@ Partial Class Compras_Compras
If ObjConta.GetRetCuenta(68, GvInv.HeaderRow.FCDropDownList("ddlAlmacen").SelectedValue.ToString.ToEntero) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
- CveCuenta = ObjConta.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
End If
End If
If importeMovimiento <> 0 Then
@@ -10709,7 +10707,7 @@ Partial Class Compras_Compras
DtAlmacenes.Dispose()
'QUITA 1-[MERCANCIA RECIBIDA POR ADELANTADO (OC) | MERCANCIA PENDIENTE POR RECIBIR (COMPRA)] 2-[NC CON PRODUCTOS]
- If UsuarioActual.CveEmpresa.Contiene(119) And UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen > 0 Then
+ If UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen > 0 Then
DT = DT.FiltraParametros("CveTipoPS <> 2")
End If
@@ -10736,10 +10734,8 @@ Partial Class Compras_Compras
If ObjConta.GetRetCuenta(6, Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero) Then
If ObjConta.DtResultados.Rows.Count > 0 AndAlso ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero
- CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaGastoSIG").ToString.ToEntero
Else
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToString.ToEntero
- CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToString.ToEntero
End If
End If
End If
diff --git a/Compras/RepComprasAFDetalle.aspx.vb b/Compras/RepComprasAFDetalle.aspx.vb
index c75979d6e..1f5ae872f 100644
--- a/Compras/RepComprasAFDetalle.aspx.vb
+++ b/Compras/RepComprasAFDetalle.aspx.vb
@@ -86,7 +86,6 @@ Partial Class Compras_RepComprasAFDetalle
If Not IsPostBack Then
CargaCombos()
'ImgPersonalizar.Attributes.Add("onclick", "javascript:$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');")
- DdlPS.ddl.Visible = False
@@ -190,6 +189,17 @@ Partial Class Compras_RepComprasAFDetalle
DdlActivoFijo.DataBind()
DdlActivoFijo.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
+ If DdlPS.UsaWebService Then
+ DdlPS.ddlWS.Attributes.Add("data-Estatus", "-1")
+ DdlPS.ddlWS.Attributes.Add("data-pagina", "Inventarios")
+ DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue)
+
+ 'DdlClasificacion.AutoPostBack = False
+ Else
+ DdlPS.ddl.Items.Add(New ListItem("Seleccione", "-1"))
+ DdlPS.ddl.Items.Add(New ListItem("*** Actualizar listado de Productos o Servicios ***", "-2"))
+ End If
If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then
DdlProyecto.Visible = False
diff --git a/Contabilidad/FiltraPolizas.aspx b/Contabilidad/FiltraPolizas.aspx
index 32e4f7f93..98d6eb33c 100644
--- a/Contabilidad/FiltraPolizas.aspx
+++ b/Contabilidad/FiltraPolizas.aspx
@@ -17,6 +17,13 @@
Imprimir EXCEL
+
+
+ Paquete Egresos
+
+
+
+
@@ -133,7 +140,8 @@
-
+
@@ -179,6 +187,13 @@
+
+
+
+
+
+
+
diff --git a/Contabilidad/FiltraPolizas.aspx.vb b/Contabilidad/FiltraPolizas.aspx.vb
index a2095a75f..cf6c11e5c 100644
--- a/Contabilidad/FiltraPolizas.aspx.vb
+++ b/Contabilidad/FiltraPolizas.aspx.vb
@@ -1,5 +1,7 @@
Imports System.Data
+Imports System.IO
Imports Extensiones
+Imports iTextSharp.text.pdf
Imports Microsoft.Reporting.WebForms
Partial Class Contabilidad_FiltraPolizas
@@ -13,6 +15,14 @@ Partial Class Contabilidad_FiltraPolizas
ViewState("DtDatos") = value
End Set
End Property
+ Public Property Tick As String
+ Get
+ Return CType(ViewState("Tick"), String)
+ End Get
+ Set(value As String)
+ ViewState("Tick") = value
+ End Set
+ End Property
#End Region
@@ -215,5 +225,313 @@ Partial Class Contabilidad_FiltraPolizas
#End Region
+ Protected Sub LnkPaqueteEgre_Click(sender As Object, e As EventArgs) Handles LnkPaqueteEgre.Click
+ Dim filtro() As String = {"CveCompra", "CveIE", "CveConceptoContable"}
+ Dim filtroComplemento() As String = {"CveIE"}
+ Dim Pathpdf As New List(Of String)
+ Dim pdfs = New List(Of Byte())
+ Dim Path As String
+ Dim ObjCompra As New ClsCompras
+ Dim ObjIE As New ClsBancos()
+ Dim pathPoliza As String = ""
+ Dim TieneComprobante As String = ""
+ Tick = DateTime.Now.Ticks.ToString
+ Dim ObjContabilidad As New ClsContabilidad
+ Dim CvePrePoliza As Integer
+ Dim PolizasSinComprobante As String = "Polizas sin comprobante: "
+ Dim SinComprobante As Boolean = False
+ Dim contador As Integer = 0
+ Try
+ If Gv.Rows.Count > 0 Then
+
+
+ For Each TempPolizas As GridViewRow In Gv.Rows
+ If TempPolizas.FCCheckBox("ChkPoliza").Checked Then
+ contador += 1
+ CvePrePoliza = TempPolizas.DataKey("CvePrePoliza").ToString.ToEntero
+ ObjContabilidad.GetContabilizacionDiarioDetalle(CvePrePoliza)
+ TieneComprobante = VerificarComprobante(ObjContabilidad.DtResultados)
+
+ If TieneComprobante = "" And Not SinComprobante Then
+
+ Path = ImprimirPolizaPDF(CvePrePoliza)
+ pathPoliza = Path
+ If File.Exists(Path) Then
+ Pathpdf.Add(Path)
+ End If
+ Dim dt As DataTable = ObjContabilidad.DtResultados.FiltraParametros("", "", filtro)
+
+ For Each Row As DataRow In dt.Rows
+ If Row("CveConceptoContable").ToString.ToEntero = 30 Then
+ If Row("CveIE").ToString.ToEntero > 0 Then
+ If ObjIE.GetBancosIE(Row("CveIE").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
+ If ObjIE.DtResultados.Rows.Count > 0 Then
+ Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
+ If File.Exists(Path) Then
+ Dim formato As String = System.IO.Path.GetExtension(Path)
+ If formato.ToLower.Contiene(".jpg", ".png", ".jpeg") Then
+ Dim ComprobantePDF As String = String.Format("{0}\{1}\comprobante.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick)
+ Using crea_archivo = New iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 18, 18, 18, 18)
+ PdfWriter.GetInstance(crea_archivo, New FileStream(ComprobantePDF, FileMode.Create))
+ crea_archivo.Open()
+ Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(Path)
+ If image.Height > image.Width Then
+ Dim percentage As Double = 0.0F
+ percentage = 700 / image.Height
+ image.ScalePercent(percentage * 100)
+ Else
+ Dim percentage As Double = 0.0F
+ percentage = 540 / image.Width
+ image.ScalePercent(percentage * 100)
+ End If
+ crea_archivo.Add(image)
+ End Using
+ Pathpdf.Add(ComprobantePDF)
+ Else
+ Pathpdf.Add(Path)
+ End If
+ End If
+ End If
+ End If
+ End If
+ End If
+ If Row("CveConceptoContable").ToString.ToEntero.Contiene(17, 309, 312, 308) Then
+ If ObjCompra.GetCompras(Row("CveCompra").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
+ If ObjCompra.DtResultados IsNot Nothing AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then
+ Dim dr As DataRow = ObjCompra.DtResultados.Rows(0)
+ Dim RFC As String = dr("RFC").ToString
+ Dim CveFactura As String = dr("CveFactura").ToString
+ Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura)
+ If File.Exists(Path) Then
+
+ Pathpdf.Add(Path)
+ End If
+ End If
+ End If
+ End If
+ Next
+
+
+ dt = ObjContabilidad.DtResultados.FiltraParametros("", "", filtroComplemento)
+ For Each Row As DataRow In dt.Rows
+ If ObjCompra.GetCompraComplementoPago(-1, UsuarioActual.CveEmpresa, Row("CveIE").ToString.ToEntero) Then
+ If ObjCompra.DtResultados IsNot Nothing AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then
+ Dim dr As DataRow = ObjCompra.DtResultados.Rows(0)
+ Dim RFC As String = dr("RFCde").ToString
+ Dim CveFactura As String = dr("CveFactura").ToString
+ Console.WriteLine(RFC & CveFactura)
+ If CveFactura <> "" Then
+ Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura)
+ Console.WriteLine(Path)
+ If File.Exists(Path) Then
+ Pathpdf.Add(Path)
+ End If
+ End If
+ End If
+ End If
+ Next
+ Else
+ If TieneComprobante <> "" Then
+ PolizasSinComprobante += String.Format("{1} {2} ", TieneComprobante, TempPolizas.DataKey("TipoPol").ToString, TempPolizas.DataKey("Folio").ToString)
+ SinComprobante = True
+ End If
+
+ End If
+
+ End If
+ Next
+ If contador > 0 Then
+ If SinComprobante Then
+ Alert(PolizasSinComprobante, TipoMensaje.MsgAdvertencia)
+ Else
+ MergePdfFiles(Pathpdf.ToArray)
+ If File.Exists(pathPoliza) Then
+ Directory.Delete(String.Format("{0}/{1}", AppDomain.CurrentDomain.BaseDirectory, Tick), True)
+ End If
+
+ End If
+ Else
+ Alert("No hay polizas seleccionadas para imprimir", TipoMensaje.MsgAdvertencia)
+
+ End If
+
+ Else
+ Alert("No hay informacion cargada", TipoMensaje.MsgAdvertencia)
+ End If
+ Catch ex As Exception
+ Alert("Error al descargar el paquete", TipoMensaje.MsgError)
+ If File.Exists(pathPoliza) Then
+ Directory.Delete(String.Format("{0}/{1}", AppDomain.CurrentDomain.BaseDirectory, Tick), True)
+ End If
+ End Try
+
+ ObjCompra.Dispose()
+ ObjIE.Dispose()
+ End Sub
+ Private Function ImprimirPolizaPDF(CvePrePoliza As Integer) As String
+ Dim ObjConta As New ClsContabilidad
+ 'Dim ObjPoliza As New ClsContPAQi(UsuarioActual.Empresa)
+
+ Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/Polizas.rdlc", UsuarioActual.Empresa.Ruta))
+ Dim params As New List(Of ReportParameter)
+ Dim Bytes As Byte() = Nothing
+
+
+ 'If ObjPoliza.GetPoliza(IdPoliza, -1, -1, -1, -1) AndAlso ObjPoliza.DtResultados.Rows.Count > 0 Then
+ If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
+ Dim dtVC As DataTable
+ Dim dr As DataRow
+ dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden")
+ dr = dtVC.Rows(0)
+ Dim ruta As String = ""
+ params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
+ params.Add(New ReportParameter("TipoPoliza", dr("TipoPoliza").ToString))
+ params.Add(New ReportParameter("Finicio", dr("Fecha").ToString.ToDate.ToShortDateString))
+ params.Add(New ReportParameter("FFin", dr("Fecha").ToString.ToDate.ToShortDateString))
+ params.Add(New ReportParameter("Fecha", dr("Fecha").ToString.ToDate.ToShortDateString))
+ 'params.Add(New ReportParameter("Nombre", dr("Cuenta").ToString))
+ 'params.Add(New ReportParameter("Cuenta", dr("Codigo").ToString))
+ params.Add(New ReportParameter("Numero", dr("FolioPoliza").ToString))
+ params.Add(New ReportParameter("Moneda", ""))
+ params.Add(New ReportParameter("CodigoPostal", ""))
+ If UsuarioActual.CveEmpresa = 119 Then
+ params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("CveUsuario").ToString.ToEntero).FiltroPrimeroValor("Nombre")))
+ End If
+ If UsuarioActual.CveEmpresa = 140 Then
+ params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
+ End If
+ If Archivo.Exists Then
+ ruta = UsuarioActual.Empresa.Ruta & "Formatos/Polizas.rdlc"
+ Else
+ ruta = "Empresas/Grales/Formatos/Polizas.rdlc"
+ End If
+ Bytes = StreamPDF(ruta, dtVC, params, "ppoliza")
+ If Not File.Exists(String.Format("{0}{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, CvePrePoliza.ToString)) Then
+ DirectoryExistsCreate(String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, Tick))
+ File.WriteAllBytes(String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, CvePrePoliza.ToString), Bytes)
+ End If
+ End If
+ Return String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, CvePrePoliza.ToString)
+ ObjConta.Dispose()
+
+ End Function
+ Private Sub MergePdfFiles(ByVal pdfFiles() As String)
+ Dim result As Boolean = False
+ Dim pdfCount As Integer = 0
+ Dim f As Integer = 0
+ Dim fileName As String
+ Dim reader As iTextSharp.text.pdf.PdfReader = Nothing
+ Dim pageCount As Integer = 0
+ Dim pdfDoc As iTextSharp.text.Document = Nothing
+ Dim writer As PdfWriter = Nothing
+ Dim cb As PdfContentByte = Nothing
+
+ Dim page As PdfImportedPage = Nothing
+ Dim rotation As Integer = 0
+
+
+ Try
+ pdfCount = pdfFiles.Length
+ If pdfCount > 0 Then
+ fileName = pdfFiles(f)
+ reader = New iTextSharp.text.pdf.PdfReader(fileName)
+ pageCount = reader.NumberOfPages
+ pdfDoc = New iTextSharp.text.Document(reader.GetPageSizeWithRotation(1), 18, 18, 18, 18)
+ writer = PdfWriter.GetInstance(pdfDoc, New FileStream(String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, "poliza"), FileMode.Create))
+
+ With pdfDoc
+ .Open()
+ End With
+ cb = writer.DirectContent
+ While f < pdfCount
+ Dim i As Integer = 0
+ While i < pageCount
+ i += 1
+ pdfDoc.SetPageSize(reader.GetPageSizeWithRotation(i))
+ pdfDoc.NewPage()
+ page = writer.GetImportedPage(reader, i)
+ rotation = reader.GetPageRotation(i)
+ If rotation = 90 Then
+ cb.AddTemplate(page, 0, -1.0F, 1.0F, 0, 0, reader.GetPageSizeWithRotation(i).Height)
+ ElseIf rotation = 270 Then
+ cb.AddTemplate(page, 0, 1.0F, -1.0F, 0, reader.GetPageSizeWithRotation(i).Width + 60, -30)
+ Else
+ cb.AddTemplate(page, 1.0F, 0, 0, 1.0F, 0, 0)
+ End If
+ End While
+ f += 1
+ If f < pdfCount Then
+ fileName = pdfFiles(f)
+ reader = New iTextSharp.text.pdf.PdfReader(fileName)
+ pageCount = reader.NumberOfPages
+ End If
+ End While
+
+
+ pdfDoc.Close()
+
+ Dim Archivo As New System.IO.FileInfo(String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, "Poliza"))
+
+ If Archivo.Exists Then
+ Response.Clear()
+ Response.ContentType = Nothing
+ Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
+ Response.AddHeader("Content-Length", Archivo.Length.ToString())
+ Response.TransmitFile(String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, "Poliza"))
+ Response.Flush() ' send it to the client to download
+ HttpContext.Current.Response.SuppressContent = True
+ HttpContext.Current.ApplicationInstance.CompleteRequest()
+
+
+ End If
+ result = True
+ End If
+ Catch ex As Exception
+ End Try
+
+
+
+ End Sub
+
+ Private Function VerificarComprobante(ByVal PrepolizaDetalle As DataTable) As String
+ Dim filtro() As String = {"CveIE", "CveConceptoContable"}
+ Dim Path As String
+ Dim dt As DataTable = PrepolizaDetalle.FiltraParametros("", "", filtro)
+ Dim ObjIE As New ClsBancos()
+ Dim TieneComprobante As String = ""
+
+ For Each Row As DataRow In dt.FiltraParametros("CveConceptoContable = 30").Rows
+
+ If ObjIE.GetBancosIE(Row("CveIE").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
+ If ObjIE.DtResultados.Rows.Count > 0 Then
+ Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
+ If File.Exists(Path) Then
+ TieneComprobante = ""
+ Exit For
+ Else
+ TieneComprobante = Row("CveIE").ToString
+ Exit For
+ End If
+ Else
+ TieneComprobante = Row("CveIE").ToString
+ Exit For
+ End If
+ End If
+
+ Next
+ ObjIE.Dispose()
+ Return TieneComprobante
+
+ End Function
+
+ Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles Gv.RowDataBound
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ 'If e.Row.DataKey("Comprobante").ToString <> "" AndAlso e.Row.DataKey("Comprobante").ToString IsNot Nothing Then
+ ' e.Row.FCCheckBox("ChkPoliza").Enabled = True
+ 'Else
+ ' e.Row.FCCheckBox("ChkPoliza").ToolTip = "No se tiene cargado comprobante de pago"
+ 'End If
+ End If
+ End Sub
End Class
diff --git a/Contabilidad/RegPrePoliza.aspx b/Contabilidad/RegPrePoliza.aspx
index 57d916c51..5f72a908d 100644
--- a/Contabilidad/RegPrePoliza.aspx
+++ b/Contabilidad/RegPrePoliza.aspx
@@ -80,6 +80,9 @@
Cargar Comprobante
+
+ Imprimir Poliza
+
diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb
index 88620e043..279ed572d 100644
--- a/Contabilidad/RegPrePoliza.aspx.vb
+++ b/Contabilidad/RegPrePoliza.aspx.vb
@@ -250,14 +250,16 @@ Partial Class ContabilidadC_RegPrePoliza
GvConcepto.Columns(4).Visible = False
GvMov.Columns(5).Visible = False
End If
+ LnkExcel.Visible = False
+ LnkImprimirPoliza.Visible = True
If IfNull(Request("Conta"), "").ToString = "1" Then
Contabilizar()
End If
Exit Sub
- LnkExcel.Visible = False
Else
LnkExcel.Visible = True
+ LnkImprimirPoliza.Visible = False
CreaDT()
BtnEliminar.Visible = False
@@ -517,13 +519,13 @@ Partial Class ContabilidadC_RegPrePoliza
'Asignamos los Subproyectos
e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlSubProyecto").DataBind()
- 'e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1"))
+ e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1"))
e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto"))
'Asignamos los Tipos de Gasto
e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlTipoGasto").DataBind()
- 'e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1"))
+ e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1"))
e.Row.FCDropDownList("DdlTipoGasto").SelectedValueExist(e.Row.DataKey("CveTipoGasto"))
'ASignamos las CuentasContables
@@ -1840,21 +1842,21 @@ Partial Class ContabilidadC_RegPrePoliza
Next
- dt = DtMovimientos.FiltraParametros("", "", filtroComplemento)
- For Each Row As DataRow In dt.Rows
+
+ For Each Row As DataRow In dt.FiltraParametros("CveConceptoContable = 30").Rows
If ObjCompra.GetCompraComplementoPago(-1, UsuarioActual.CveEmpresa, Row("CveIE").ToString.ToEntero) Then
If ObjCompra.DtResultados IsNot Nothing AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then
- Dim dr As DataRow = ObjCompra.DtResultados.Rows(0)
- Dim RFC As String = dr("RFCde").ToString
- Dim CveFactura As String = dr("CveFactura").ToString
- Console.WriteLine(RFC & CveFactura)
- If CveFactura <> "" Then
- Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura)
- Console.WriteLine(Path)
- If File.Exists(Path) Then
- Pathpdf.Add(Path)
+ For Each RowComple As DataRow In ObjCompra.DtResultados.FiltraParametros("", "", {"RFCde", "CveFactura"}).Rows
+ Dim RFC As String = RowComple.Item("RFCde").ToString
+ Dim CveFactura As String = RowComple.Item("CveFactura").ToString
+ If CveFactura <> "" Then
+ Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura)
+ If File.Exists(Path) Then
+ Pathpdf.Add(Path)
+ End If
End If
- End If
+ Next
+
End If
End If
Next
@@ -1889,7 +1891,7 @@ Partial Class ContabilidadC_RegPrePoliza
If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
Dim dtVC As DataTable
Dim dr As DataRow
- dtVC = ObjConta.DtResultados
+ dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden")
dr = dtVC.Rows(0)
Dim ruta As String = ""
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
@@ -1905,6 +1907,9 @@ Partial Class ContabilidadC_RegPrePoliza
If UsuarioActual.CveEmpresa = 119 Then
params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("CveUsuario").ToString.ToEntero).FiltroPrimeroValor("Nombre")))
End If
+ If UsuarioActual.CveEmpresa = 140 Then
+ params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
+ End If
If Archivo.Exists Then
ruta = UsuarioActual.Empresa.Ruta & "Formatos/Polizas.rdlc"
Else
@@ -2340,20 +2345,20 @@ Partial Class ContabilidadC_RegPrePoliza
For Each Row As DataRow In dt.FiltraParametros("CveConceptoContable = 30").Rows
If ObjIE.GetBancosIE(Row("CveIE").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
- If ObjIE.DtResultados.Rows.Count > 0 Then
- Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
- If File.Exists(Path) Then
- TieneComprobante = True
- Exit For
- Else
- TieneComprobante = False
- Exit For
- End If
+ If ObjIE.DtResultados.Rows.Count > 0 Then
+ Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
+ If File.Exists(Path) Then
+ TieneComprobante = True
+ Exit For
Else
TieneComprobante = False
Exit For
End If
+ Else
+ TieneComprobante = False
+ Exit For
End If
+ End If
Next
ObjIE.Dispose()
@@ -2361,5 +2366,53 @@ Partial Class ContabilidadC_RegPrePoliza
End Function
+ Protected Sub LnkImprimirPoliza_Click(sender As Object, e As EventArgs)
+ ImprimirPolizaPDFRunTime(IdPoliza)
+ End Sub
+ Private Function ImprimirPolizaPDFRunTime(IdPoliza As Integer) As String
+ Dim ObjConta As New ClsContabilidad
+ 'Dim ObjPoliza As New ClsContPAQi(UsuarioActual.Empresa)
+
+ Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/Polizas.rdlc", UsuarioActual.Empresa.Ruta))
+ Dim params As New List(Of ReportParameter)
+ Dim Bytes As Byte() = Nothing
+
+
+ 'If ObjPoliza.GetPoliza(IdPoliza, -1, -1, -1, -1) AndAlso ObjPoliza.DtResultados.Rows.Count > 0 Then
+ If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
+ Dim dtVC As DataTable
+ Dim dr As DataRow
+ dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden")
+ dr = dtVC.Rows(0)
+ Dim ruta As String = ""
+ params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
+ params.Add(New ReportParameter("TipoPoliza", dr("TipoPoliza").ToString))
+ params.Add(New ReportParameter("Finicio", dr("Fecha").ToString.ToDate.ToShortDateString))
+ params.Add(New ReportParameter("FFin", dr("Fecha").ToString.ToDate.ToShortDateString))
+ params.Add(New ReportParameter("Fecha", dr("Fecha").ToString.ToDate.ToShortDateString))
+ 'params.Add(New ReportParameter("Nombre", dr("Cuenta").ToString))
+ 'params.Add(New ReportParameter("Cuenta", dr("Codigo").ToString))
+ params.Add(New ReportParameter("Numero", dr("FolioPoliza").ToString))
+ params.Add(New ReportParameter("Moneda", ""))
+ params.Add(New ReportParameter("CodigoPostal", ""))
+ If UsuarioActual.CveEmpresa = 119 Then
+ params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("CveUsuario").ToString.ToEntero).FiltroPrimeroValor("Nombre")))
+ End If
+ If UsuarioActual.CveEmpresa = 140 Then
+ params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
+ End If
+ If Archivo.Exists Then
+ ruta = UsuarioActual.Empresa.Ruta & "Formatos/Polizas.rdlc"
+ Else
+ ruta = "Empresas/Grales/Formatos/Polizas.rdlc"
+ End If
+ ImprimirbytesPDF(StreamPDF(ruta, dtVC, params, "ppoliza"), String.Format("{0}-{1}", TipoPoliza, dr("FolioPoliza").ToString), "PDF", True)
+
+ End If
+ Return String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString)
+ ObjConta.Dispose()
+
+ End Function
+
End Class
diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx
index 78866b5ae..858da02e8 100644
--- a/Contabilidad/RegPrePolizaS.aspx
+++ b/Contabilidad/RegPrePolizaS.aspx
@@ -75,14 +75,14 @@
Crear Complemento de Pago