This commit is contained in:
rakcsle
2021-05-19 10:18:11 -07:00
26 changed files with 3780 additions and 2994 deletions

View File

@@ -66,7 +66,10 @@
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="TxtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="TxtFechaF" PopupButtonID="ImgFechaF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
<div class="col-md-1 truncate v-center" style="text-align: right!important">Cliente:</div>
<div class="col-md-2 v-center">
<ADS:Dropdownlost ID="DdlNombre" runat="server" CssStyle="width: 195px;" DataTextField="NombreComercial" DataValueField="CveCliente"></ADS:Dropdownlost>
</div>
</div>
</div>
</div>
@@ -124,9 +127,10 @@
<asp:GridView ID="GvVentas" ClientIDMode="Static" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron datos con los filtros especificados"
CssClass="table table-striped table-hover Widthall" BorderColor="#D3D3D3" GridLines="None">
<Columns>
<asp:HyperLinkField HeaderText="Folio" DataTextField="SerieFolio" Target="_blank" ItemStyle-Width="20%" ItemStyle-CssClass="Texto Izquierda" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:HyperLinkField HeaderText="Folio" DataTextField="SerieFolio" Target="_blank" ItemStyle-Width="15%" ItemStyle-CssClass="Texto Izquierda" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:HyperLinkField HeaderText="Mov. Almacen" DataTextField="Folio" Target="_blank" ItemStyle-Width="15%" ItemStyle-CssClass="Texto" DataNavigateUrlFields="CveMovimiento" DataNavigateUrlFormatString="/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}" />
<asp:HyperLinkField HeaderText="Fecha" DataTextField="Fecha" Target="_blank" ItemStyle-Width="10%" ItemStyle-CssClass="Texto" DataTextFormatString="{0:d}" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:HyperLinkField HeaderText="Sucursal" DataTextField="SubProyecto" Target="_blank" ItemStyle-Width="15%" ItemStyle-CssClass="Texto Izquierda" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:HyperLinkField HeaderText="Sucursal" DataTextField="SubProyecto" Target="_blank" ItemStyle-Width="20%" ItemStyle-CssClass="Texto Izquierda" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:HyperLinkField HeaderText="Cantidad" DataTextField="Cantidad" Target="_blank" ItemStyle-Width="5%" ItemStyle-CssClass="Derecha" DataTextFormatString="{0:###,##0.00##}" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:HyperLinkField HeaderText="Total" DataTextField="Total" Target="_blank" ItemStyle-Width="20%" ItemStyle-CssClass="Derecha" DataTextFormatString="{0:###,###,##0.00##}" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}"/>
</Columns>

View File

@@ -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

View File

@@ -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

View File

@@ -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)

383
App_Code/ClsSucursales.vb Normal file
View File

@@ -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

View File

@@ -136,7 +136,7 @@
</div>
</div>
<div class="row">
<div class="row" style="border:solid">
<div class="col-md-2" runat="server" id="DivFaltante">
<asp:CheckBox ID="ChkFaltante" runat="server" Text="Faltante/Sobrante"/>
</div>
@@ -144,10 +144,7 @@
<label>Importe:</label>
<asp:TextBox runat="server" ID="TxtComision" Class=" input-sm " Width="75px"></asp:TextBox>
</div>
<div class="col-md-1" id="DivIVA" style="display: none">
<label>IVA:</label>
<asp:TextBox runat="server" ID="TxtIVA" Class=" input-sm " Width="75px"></asp:TextBox>
</div>
<div class="col-md-3" style="display: none" id="divSubProyecto">
<label class="col-md-1 truncate" style="width: 110px; display: none" id="LblSubproyecto" >SubProyecto:</label>
@@ -155,7 +152,7 @@
</asp:DropDownList>
</div>
<div class="col-md-4" style="display: none" id="divClasificacion">
<div class="col-md-5" style="display: none" id="divClasificacion">
<label class="col-md-1 truncate" style="width: 110px;" id="LblClasificacion">Clasificación:</label>
@@ -167,11 +164,11 @@
</div>
<div class="row">
<div class="row" style="border:solid">
<div class="col-md-2" runat="server" id="Div1">
<asp:CheckBox ID="ChkDescuento" runat="server" Text="Descuento"/>
</div>
<div class="col-md-3" id="DivDescuento" style="display: none">
<div class="col-md-2" id="DivDescuento" style="display: none">
<label>Importe:</label>
<asp:TextBox runat="server" ID="TxtDescuento" Class=" input-sm " Width="75px"></asp:TextBox>
</div>
@@ -183,21 +180,47 @@
</asp:DropDownList>
</div>
<div class="col-md-4" style="display: none" id="divClasificacionDescuento">
<div class="col-md-5" style="display: none" id="divClasificacionDescuento">
<label class="col-md-1 truncate" style="width: 110px;" id="LblClasificacionDescuento">Clasificación:</label>
<asp:DropDownList ID="DdlClasificacionDescuento" AutoPostBack="false" Class="table-group-action-input form-control input-inline input-small input-sm select2me" runat="server" AppendDataBoundItems="true" DataTextField="Clasificacion" DataValueField="CveClasificacion">
</asp:DropDownList>
</div>
</div>
<div class="row" style="border:solid">
<div class="col-md-1" runat="server" id="Div2">
<asp:CheckBox ID="ChkIntermediario" runat="server" Text="Intermediario"/>
</div>
<div class="col-md-11" id="DivInter" style="display: none">
<div class="col-md-2" id="dd">
<asp:Dropdownlist ID="DdlProveedorIntermediario" CssClassDdl="select2me" Width="100px" CssStyle="100%" DataTextField="RazonSocial" DataValueField="CveProveedor" runat="server"></asp:Dropdownlist>
</div>
<div class="col-md-2" id="DivinterImporte" >
<label>Importe:</label>
<asp:TextBox runat="server" ID="TxtComisionIntermediario" Class=" input-sm " Width="75px"></asp:TextBox>
</div>
<div class="col-md-2" id="DivIVA" >
<label>IVA:</label>
<asp:TextBox runat="server" ID="TxtIVA" Class=" input-sm " Width="75px"></asp:TextBox>
</div>
<div class="col-md-2" id="dd2">
<label id="LblClasificacion3">Gasto:</label>
<asp:DropDownList ID="DdlClasificacionIntermediario" AutoPostBack="false" Class="table-group-action-input form-control input-inline input-small input-sm select2me" runat="server" AppendDataBoundItems="true" DataTextField="Clasificacion" DataValueField="CveClasificacion">
</asp:DropDownList>
</div>
<div class="col-md-3" id="divSubProyectoIntermediario">
<label id="LblSubproyectoIntermediario">SubProyecto:</label>
<asp:DropDownList ID="DdlSubProyectoIntermediario" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
</asp:DropDownList>
</div>
</div>
</div>
<br />
<div style="height:550px;overflow-x:scroll">
<asp:GridView ID="GvFacturas" runat="server" AutoGenerateColumns="False" DataKeyNames="CveVenta, CvePrePoliza, CveIE, TipoCambio, CveMoneda, CveCliente, IdCtaContableBancos, IdCtaContClientes, Importe, SerieFolio" CssClass="table table-striped table-advance table-hover" Style="text-align: center; float: right; width: 100%; " GridLines="None">
@@ -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");
}
}
</script>

View File

@@ -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<br/><br/>"
Dim documentos As String = "Los Depósitos se realizaron exitosamente<br/><br/>"
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("<a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>Depósito: {1}</a> &nbsp &nbsp <br/> ", 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("<a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir {1}</a> <br/><br/> ", 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("<a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"">Prepóliza</a> <br/><br/> ", 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("<a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir {1}</a> <br/><br/> ", 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("<a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"">Prepóliza</a> <br/><br/> ", NuevaCvePrePoliza)
Alert(documentos.ToString)
End If
TxtComision.Text = ""
TxtDescuento.Text = ""
TxtIVA.Text = ""
TxtComisionIntermediario.Text = ""
ObjContabilidad.Dispose()
End Sub
Private Sub ObtenerTotalImporta()

View File

@@ -1243,7 +1243,6 @@ Partial Class Bancos_IE
Else
BtnEditar.Visible = False
LnkEliminar.Visible = False
LnkCancelarComplemento.Visible = False
LnkCancelarComplementoImporte.Visible = False
DVGenerarComplementoModal.Visible = False

View File

@@ -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("<br>" & 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

View File

@@ -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

View File

@@ -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

View File

@@ -17,6 +17,13 @@
<li>
<asp:LinkButton ID="LnkExcel" runat="server"><i class="fa fa-ad-excel"></i> Imprimir EXCEL</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkPaqueteEgre" runat="server"><i class="fa fa-ad-pdf"></i> Paquete Egresos</asp:LinkButton>
</li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
@@ -133,7 +140,8 @@
</div>
<div style="">
<asp:GridView ID="Gv" runat="server" TShowHeader="true" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" GridLines="None" AutoGenerateColumns="false">
<asp:GridView ID="Gv" runat="server" TShowHeader="true" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" GridLines="None"
AutoGenerateColumns="false" DataKeyNames="CvePrePoliza, Folio, Id, TipoPol">
<Columns>
<asp:TemplateField HeaderText="Fecha">
<ItemTemplate>
@@ -179,6 +187,13 @@
</ItemTemplate>
<ItemStyle Width="100px"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="ChkPoliza" runat="server"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="Titulos"></HeaderStyle>
</asp:GridView>

View File

@@ -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: <br/>"
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("<a href='/Bancos/IE.aspx?CveIE={0}'>{1} {2}</a> <br/>", 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

View File

@@ -80,6 +80,9 @@
<li>
<asp:LinkButton ID="LnkComprobante" runat="server" Visible="false" data-toggle="modal" data-target="#ModalUpload" Style="color: #686868;"><i class="fa fa-upload" style="color:#686868;"></i> Cargar Comprobante</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkImprimirPoliza" runat="server" Visible="true" OnClick="LnkImprimirPoliza_Click" Style="color: #686868;"><i class="fa fa-print" style="color:#686868;"></i> Imprimir Poliza</asp:LinkButton>
</li>

View File

@@ -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

View File

@@ -75,14 +75,14 @@
<asp:LinkButton ID="LnkComplementoPago" runat="server" Visible="false" OnClick="LnkComplementoPago_Click" Style="color: #686868;"><i class="fa fa-money" style="color:#686868;"></i> Crear Complemento de Pago</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkImprimirPDF" runat="server" OnClick="LnkImprimirPDF_Click" Style="color: #686868;"><i class="fa fa-file-pdf-o" style="color:#686868;"></i> Imprimir Poliza</asp:LinkButton>
<asp:LinkButton ID="LnkImprimirPDF" runat="server" Visible="true" OnClick="LnkImprimirPDF_Click" Style="color: #686868;"><i class="fa fa-file-pdf-o" style="color:#686868;"></i> Imprimir Poliza</asp:LinkButton>
</li>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkAddConcepto" runat="server" OnClick="LnkAddConcepto_Click" Visible="false"><i class="fa fa-plus" ></i> Agregar Concepto</asp:LinkButton>
<asp:LinkButton ID="LnkAddConcepto" runat="server" OnClick="LnkAddConcepto_Click" Visible="true"><i class="fa fa-plus" ></i> Agregar Concepto</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
@@ -406,7 +406,6 @@
<ItemTemplate>
<asp:LinkButton ID="LnkE" runat="server" AlternateText="Editar" CausesValidation="False" CommandName="Edit" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
<asp:ImageButton Visible="false" ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" ImageUrl="/Imagenes/Btn_Delete.png" OnClientClick="javascript:return C();" />
</ItemTemplate>
</asp:TemplateField>
@@ -454,7 +453,7 @@
<div class="portlet-body nomarginleftright form-horizontal form-row-sepe formnombottom ">
<asp:GridView ID="GvPrePoliza" runat="server" AutoGenerateColumns="False" CssClass="table table-striped table-advance table-hover mysmallbtn GvPrePoliza" GridLines="None"
DataKeyNames="CvePrePolizaDetalle, CveConceptoContable, IdCtaContable, CveSubProyecto, CveTipoGasto,Referencia,CveVenta,CveCompra, CveProveedor, CveCliente, CvePersonal" Width="100%" >
DataKeyNames="CvePrePolizaDetalle, CveConceptoContable, IdCtaContable, CveSubProyecto, CveTipoGasto,Referencia,CveVenta,CveCompra, CveProveedor, CveCliente, CvePersonal, CveCuenta" Width="100%" >
<Columns>
<asp:TemplateField>
<HeaderTemplate>Movimiento</HeaderTemplate>
@@ -559,6 +558,13 @@
<ItemStyle HorizontalAlign="Right" Width="20px" />
</asp:TemplateField>
<asp:TemplateField >
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkModificado" Checked="false" Visible="false"/>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" Width="0px" />
</asp:TemplateField>
</Columns>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
@@ -720,7 +726,7 @@
Cuenta:
</div>
<div class="col-xs-4">
<asp:DropDownList ID="DdlCtaContableE" runat="server" CssClass="form-control input-sm select2me" DataValueField="Id" DataTextField="CtaCodigo"></asp:DropDownList><br />
<asp:DropDownList ID="DdlCtaContableE" runat="server" CssClass="form-control input-sm select2me" DataValueField="CveCuenta" DataTextField="CtaCodigo"></asp:DropDownList><br />
</div>
</div>
<br />

View File

@@ -232,10 +232,13 @@ Partial Class ContabilidadC_RegPrePolizaS
DivTG.Visible = False
GvMov.Columns(5).Visible = False
End If
Exit Sub
Else
CreaDT()
BtnEliminar.Visible = False
BtnEliminar.Visible = False
LnkExcel.Visible = True
LnkImprimirPDF.Visible = False
End If
@@ -466,8 +469,9 @@ Partial Class ContabilidadC_RegPrePolizaS
' row.FCTextBox("TxtCargo").Enabled = False
' row.FCTextBox("TxtAbono").Enabled = False
'Next
End If
End If
LnkExcel.Visible = False
LnkImprimirPDF.Visible = True
Else
Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia)
BtnEliminar.Visible = False
@@ -996,37 +1000,39 @@ Partial Class ContabilidadC_RegPrePolizaS
For Each row As GridViewRow In GvPrePoliza.Rows
If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
If Not ObjContabilidad.UpdatePrepolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCLiteral("TxtConcepto").Text, row.DataKey("CveSubProyecto").ToEntero,
row.DataKey("IdCtaContable").ToEntero, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero),
CveConceptoContable:=row.DataKey("CveConceptoContable").ToEntero, CveProveedor:=row.DataKey("CveProveedor").ToEntero, CveCompra:=row.DataKey("CveCompra").ToEntero,
CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
Else
If row.FCCheckBox("chkModificado").Checked Then
If Not ObjContabilidad.UpdatePrepolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCLiteral("TxtConcepto").Text, row.DataKey("CveSubProyecto").ToEntero,
row.DataKey("IdCtaContable").ToEntero, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero),
CveConceptoContable:=row.DataKey("CveConceptoContable").ToEntero, CveProveedor:=row.DataKey("CveProveedor").ToEntero, CveCompra:=row.DataKey("CveCompra").ToEntero,
CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
End If
Else
If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), row.DataKey("Referencia").ToString,
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), row.DataKey("Referencia").ToString,
row.DataKey("CveConceptoContable").ToEntero, row.FCLiteral("TxtConcepto").Text, Now,
row.DataKey("IdCtaContable").ToEntero, 0, CveSubProyecto:=row.DataKey("CveSubProyecto").ToEntero,
CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero),
ImporteMX:=If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveProveedor:=row.DataKey("CveProveedor").ToEntero,
CveCompra:=row.DataKey("CveCompra").ToEntero, CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero,
CvePersonal:=row.DataKey("CvePersonal").ToEntero) Then
OcurrioError = True
Exit For
End If
End If
Next
If Not OcurrioError Then
ObjContabilidad.Commit()
Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion)
Else
ObjContabilidad.RollBack()
Alert("Ocurrio un error al actualizar la PrePoliza.", TipoMensaje.MsgError)
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveProveedor:=row.DataKey("CveProveedor").ToEntero,
CveCompra:=row.DataKey("CveCompra").ToEntero, CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero,
CvePersonal:=row.DataKey("CvePersonal").ToEntero) Then
OcurrioError = True
Exit For
End If
End If
Next
If Not OcurrioError Then
ObjContabilidad.Commit()
Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion)
Else
ObjContabilidad.RollBack()
Alert("Ocurrio un error al actualizar la PrePoliza.", TipoMensaje.MsgError)
End If
ObjContabilidad.Dispose()
@@ -1064,7 +1070,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim Referencia As String = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtRef").Text
Dim CveSubProyecto As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveSubProyecto").ToString.ToEntero
Dim CveTipoGasto As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveTipoGasto").ToString.ToEntero
Dim IdCtaContable As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("IdCtaContable").ToString.ToEntero
Dim CveCuenta As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveCuenta").ToString.ToEntero
Dim Cargo As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtCargo").Text.ToDouble
Dim Abono As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtAbono").Text.ToDouble
@@ -1091,7 +1097,7 @@ Partial Class ContabilidadC_RegPrePolizaS
CargaTipoGastoE()
DdlTipoGastoE.SelectedValueExist(CveTipoGasto)
CargaCtaContableE()
DdlCtaContableE.SelectedValueExist(IdCtaContable)
DdlCtaContableE.SelectedValueExist(CveCuenta)
If Cargo <> 0 Then
TxtCargoE.Text = Cargo
@@ -1359,8 +1365,10 @@ Partial Class ContabilidadC_RegPrePolizaS
GvPrePoliza.DataSource = DtMovimientos
GvPrePoliza.DataBind()
UpPrePoliza.Update()
End If
End If
GvPrePoliza.Columns(11).Visible = True
GvPrePoliza.Rows(IndiceGrid).FCCheckBox("chkModificado").Checked = True
End If
End If
@@ -2026,7 +2034,7 @@ Partial Class ContabilidadC_RegPrePolizaS
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))

File diff suppressed because it is too large Load Diff

View File

@@ -57,6 +57,10 @@
<DataField>ConceptoContable</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="CodigoPadre">
<DataField>CodigoPadre</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>DataSet3</rd:DataSetName>
@@ -667,14 +671,14 @@
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="CuentaFormato1">
<Textbox Name="CodigoPadre">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!CuentaFormato.Value</Value>
<Value>=Fields!CodigoPadre.Value</Value>
<Style>
<FontSize>7pt</FontSize>
</Style>
@@ -685,7 +689,7 @@
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>CuentaFormato1</rd:DefaultName>
<rd:DefaultName>CodigoPadre</rd:DefaultName>
<Style>
<Border>
<Style>None</Style>
@@ -776,7 +780,7 @@
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!AgrupadorSAT.Value</Value>
<Value>=Fields!Codigo.Value &amp; " - " &amp; Fields!CodigoPadre.Value</Value>
<Style>
<FontSize>7pt</FontSize>
</Style>
@@ -971,7 +975,7 @@
<RepeatRowHeaders>true</RepeatRowHeaders>
<DataSetName>DataSet1</DataSetName>
<Height>0.98834cm</Height>
<Width>24.33863cm</Width>
<Width>24.33862cm</Width>
<Style>
<Border>
<Style>None</Style>

File diff suppressed because it is too large Load Diff

View File

@@ -3075,7 +3075,8 @@ Partial Class Inventarios_EntregaAlmacen
End If
Dim ObjInventario As New ClsInventarios : ObjInventario.IniciaTransacSQL()
Dim ObjGeneral As New ClsGenerales(ObjInventario.IniciaTransacSQL())
Dim ObjGeneral As New ClsGenerales(ObjInventario.IniciaTransacSQL())
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
Dim CveMovimientoSalida As Integer
Dim ConceptoMovimiento = 0
Dim FolioSalida As Integer
@@ -3221,38 +3222,39 @@ Partial Class Inventarios_EntregaAlmacen
TextoError = "Ocurrió un error al generar el movimiento de salida."
ErrorMovInv = True
End If
End If
End If
Dim ValorTraspaso As Decimal = 0
'ENTRADA POR TRASPASO
If Not ErrorMovInv Then
'sino es transitorio, los transitorios, ya no se hace otro movimiento
If Not ChkTransitorio.Checked Then
ConceptoMovimiento = 27 ' If(ChkTransitorio.Checked, 2, 27)
Almacen2 = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero(), CveAlmacenTraspasoDestino)
If Not ErrorMovInv Then
'sino es transitorio, los transitorios, ya no se hace otro movimiento
ConceptoMovimiento = If(ChkTransitorio.Checked, 2, 27)
Almacen2 = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero(), CveAlmacenTraspasoDestino)
CveMovimientoEntrada = ObjInventario.AddMovimiento(Almacen2, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim,
Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalida, CveAlmacenDestino:=CveAlmacenTraspasoDestino,
Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), Modulo:="RE/GT1", CveOP:=CveOP)
FolioEntrada = ObjInventario.Folio
If CveMovimientoEntrada > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Dim CveSeccionAlmacen As Integer = -1
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), Modulo:="RE/GT1", CveOP:=CveOP)
FolioEntrada = ObjInventario.Folio
If CveMovimientoEntrada > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Dim CveSeccionAlmacen As Integer = -1
ValorTraspaso = ObjInventario.DtResultados.SUMD("Total").RoundSQL
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
CveSeccionAlmacen = -3
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), FechaCaducidad:=Dr("FechaCaducidad").ToString().ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For
End If
Next
End If
Else
TextoError = "Ocurrió un error al generar el movimiento de entrada"
ErrorMovInv = True
End If
CveSeccionAlmacen = -3
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), FechaCaducidad:=Dr("FechaCaducidad").ToString().ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For
End If
Next
End If
Else
TextoError = "Ocurrió un error al generar el movimiento de entrada"
ErrorMovInv = True
End If
End If
End If
'MARCA SOLICITUD CON EL MOVIMIENTO GENERADO
@@ -3261,18 +3263,18 @@ Partial Class Inventarios_EntregaAlmacen
TextoError = "Ocurrió un error al vincular los movimientos con la solicitud de traspaso. Por favor verifique y vuelva a intentar"
ErrorMovInv = True
End If
End If
End If
Dim Fecha As Date = TxtFecha.Text.ToDate
'Paqueterias Guias
If RbEntregaInterna.Checked AndAlso Not ErrorMovInv Then
Dim CveEstatus As Integer = 0 ' DdlEstatus.SelectedValue.ToEntero()
Dim Fecha As String = Now.ToString() 'TxtFechaPaqInterna.Text
Dim CveEstatus As Integer = 0 ' DdlEstatus.SelectedValue.ToEntero()
Dim FechaEstimada As String = "-1" 'If(TxtFechaEstimada.Text = "", "-1", TxtFechaEstimada.Text)
Dim NoCajas As Integer = 0 'TxtNoCajas.Text.ToEntero()
Dim Observaciones As String = "" 'TxtObservacionesPaqInterna.Text
Dim CvePaqueteria As Integer = GlobalDTPaqueterias(UsuarioActual.CveEmpresa, 0).FiltroPrimeroValor("CvePaqueteria", "").ToEntero()
Dim CvePaqueteriaGuia As Integer = ObjGeneral.AddPaqueteriasGuias(CvePaqueteria, 9, CveEstatus, CveSubProyecto, Fecha, "-1", "-1", NoCajas, 0.00, "-1", FechaEstimada, Observaciones, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, EsEntregaInterna:=True)
Dim CvePaqueteriaGuia As Integer = ObjGeneral.AddPaqueteriasGuias(CvePaqueteria, 9, CveEstatus, CveSubProyecto, Fecha.ToShortDateString, "-1", "-1", NoCajas, 0.00, "-1", FechaEstimada, Observaciones, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, EsEntregaInterna:=True)
If CvePaqueteriaGuia > 0 Then
If CveVentaSurtir > 0 OrElse CveSubProyecto > 0 Then
@@ -3286,8 +3288,26 @@ Partial Class Inventarios_EntregaAlmacen
ErrorMovInv = True
Alert("Error en el paqueteria guia", TipoMensaje.MsgError)
End If
End If
'AGREGAMOS PREPOLIZAS TRASPASO DIRECTO:
Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/GT", 53, 0, 0, 1, Fecha, "Traspaso", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CvePrePolizaTraspaso > 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then
ErrorMovInv = True
End If
If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then
ErrorMovInv = True
End If
Else
ErrorMovInv = True
End If
If Not ErrorMovInv Then
ObjInventario.Commit()
ObjGeneral.Dispose()

View File

@@ -1937,16 +1937,16 @@ Partial Class Inventarios_TraspasoAlmacen
RealizarMovimientoVirtual = True
End If
'AGREGAMOS LA SALIDA
CveMovimientoSalidaTransitorio = ObjInventario.AddMovimiento(CveAlmacenSalida, 8, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, Modulo:="TA/G11")
'AGREGAMOS LA ENTRADA
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenEntrada, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G1")
Folio = ObjInventario.Folio
'AGREGAMOS LA SALIDA
CveMovimientoSalidaTransitorio = ObjInventario.AddMovimiento(CveAlmacenSalida, 8, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoEntrada, Modulo:="TA/G11")
If CveMovimientoSalidaTransitorio <= 0 Then
TextoError = "No se pudo generar el movimiento de salida correctamente"
ErrorMovInv = True
@@ -1992,7 +1992,7 @@ Partial Class Inventarios_TraspasoAlmacen
End If
'MOV, Alm, Transito
If gvr.DataKey("CveMovimientoDetalleTransitorio").ToString.ToEntero > 0 Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaTransitorio, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, PrecioEntrada, CveAF:=gvr.DataKey("CveAF").ToString.ToEntero, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, Serie:=gvr.DataKey("Serie").ToString, Lote:=tLote, FechaCaducidad:=tFechaCaducidad, CveMovimientoDetalleEntrada:=gvr.DataKey("CveMovimientoDetalleTransitorio").ToString.ToEntero) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaTransitorio, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, PrecioEntrada, CveAF:=gvr.DataKey("CveAF").ToString.ToEntero, CveSeccionAlmacen:=-3, Serie:=gvr.DataKey("Serie").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate, CveMovimientoDetalleEntrada:=gvr.DataKey("CveMovimientoDetalleTransitorio").ToString.ToEntero) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
@@ -2013,14 +2013,13 @@ Partial Class Inventarios_TraspasoAlmacen
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then
Dim resultado As DataTable = ObjInventario.DtResultados
Dim importe As Decimal = resultado.SUMD("Total").RoundAD
Dim importe As Decimal = ObjInventario.DtResultados.SUMD("Total").RoundSQL
Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero
Dim tCveConcepto As Integer = 68
If CveMovimientoSalidaTransitorio = 0 Then
tCveConcepto = 289
End If
'If CveMovimientoSalidaTransitorio = 0 Then
' tCveConcepto = 289
'End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, tCveConcepto, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalidaTransitorio, ImporteMX:=importe, Contabilizable:=False) Then
ErrorMovInv = True
End If

View File

@@ -11,8 +11,7 @@
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
<asp:UpdatePanel runat="server" id="UPAcciones" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Generar PDF</asp:LinkButton>
</li>
@@ -22,6 +21,8 @@
<li>
<asp:LinkButton ID="LnkImpresionMasiva" OnClick="LnkImpresionMasiva_Click" runat="server"> <i class="fa fa-download" style="font-weight:bold;"></i> Descargar PDFs</asp:LinkButton>
</li>
<asp:UpdatePanel runat="server" id="UPAcciones" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkCambiarFecha" OnClick="LnkCambiarFecha_Click" runat="server"> <i class="fa fa-calendar" style="font-weight:bold;"></i> Cambiar Fechas</asp:LinkButton>
</li>
@@ -121,7 +122,7 @@
</div>
<asp:GridView ID="GvSolicitudes" runat="server" GridLines="None" DataKeyNames="CveOrdenCompra,Folio, RazonSocial, ImporteSol, FolioMov, Importe, Nombre, CveEvento"
CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-sort="true" data-footer="0" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False"
EmptyDataText="No se encontraron registros" OnRowDataBound="GvSolicitudes_RowDataBound">
EmptyDataText="No se encontraron registros">
<Columns>
<asp:TemplateField Visible="false">
<HeaderTemplate>

View File

@@ -162,7 +162,6 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas
LnkGuardar.Visible = true;
LnkCambiarFecha.Visible = false;
GvSolicitudes.HeaderRow.FCCheckBox("ChkAll").Attributes.Add("onclick", "SeleccionarTodos(this);");
UPAcciones.Update();
UPDatos.Update();
}
else
@@ -182,7 +181,6 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas
GvSolicitudes.Columns[0].Visible = false;
LnkGuardar.Visible = false;
LnkCambiarFecha.Visible = true;
UPAcciones.Update();
UPDatos.Update();
}
private void ActualizarFechas()
@@ -295,13 +293,4 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas
}
protected void GvSolicitudes_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.FCCheckBox("ChkOrdenCompra").Attributes.Add("Class", "ChkOrdenCompra");
}
}
}

View File

@@ -5522,7 +5522,7 @@
<asp:Label ID="LblTituloGrafica" runat="server" ClientIDMode="Static" Text="Análisis de Crédito"></asp:Label>
</h4>
</div>
<div class="modal-body">
<div class="modal-body ADScroller-body">
<div class="row" align="center">
<div class="col-md-4">
<div class="row">

View File

@@ -6020,6 +6020,8 @@ Partial Class Clientes
params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion))
params.Add(New ReportParameter("TelefonoEmpresa", UsuarioActual.Empresa.Telefono))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
params.Add(New ReportParameter("Cliente", LtlCliente.Text))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
@@ -6063,6 +6065,8 @@ Partial Class Clientes
params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion))
params.Add(New ReportParameter("TelefonoEmpresa", UsuarioActual.Empresa.Telefono))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
params.Add(New ReportParameter("Cliente", LtlCliente.Text))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else