1655 lines
83 KiB
VB.net
1655 lines
83 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
Partial Class Bancos_ProveedoresAbonar
|
|
Inherits ClsPaginas
|
|
|
|
#Region "Propiedades"
|
|
'Configuración
|
|
Private Property CveProveedor As Integer
|
|
Get
|
|
Return ViewState("CveProveedor").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProveedor") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property FechaI As String
|
|
Get
|
|
Return ViewState("FechaI").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("FechaI") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property FechaF As String
|
|
Get
|
|
Return ViewState("FechaF").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("FechaF") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveUsuarioProgramo As Integer
|
|
Get
|
|
Return IfNull(ViewState("CveUsuarioProgramo"), "-1").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveUsuarioProgramo") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property TipoPago As Integer
|
|
Get
|
|
Return ViewState("TipoPago").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("TipoPago") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveUsuarioRegistro As Integer
|
|
Get
|
|
Return ViewState("CveUsuarioRegistro").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveUsuarioRegistro") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveUsuarioResponsable As Integer
|
|
Get
|
|
Return ViewState("CveUsuarioResponsable").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveUsuarioResponsable") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveClasificacionProveedor As Integer
|
|
Get
|
|
Return ViewState("CveClasificacionProveedor").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveClasificacionProveedor") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveAplicaNC As Integer
|
|
Get
|
|
Return ViewState("CveAplicaNC").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveAplicaNC") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveMoneda As Integer
|
|
Get
|
|
Return If(IsNothing(ViewState("CveMoneda")), -1, ViewState("CveMoneda").ToString.ToEntero)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveMoneda") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveMonedaFiltro As Integer
|
|
Get
|
|
Return ViewState("CveMonedaFiltro").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveMonedaFiltro") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveEstatus As Integer
|
|
Get
|
|
Return ViewState("CveEstatus").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveEstatus") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property Serie As String
|
|
Get
|
|
Return ViewState("Serie").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("Serie") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveProveedorSucursal As Integer
|
|
Get
|
|
Return ViewState("CveProveedorSucursal").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProveedorSucursal") = value
|
|
End Set
|
|
End Property
|
|
Private Property PermiteModificarImporte As Boolean
|
|
Get
|
|
Return CType(ViewState("PermiteModificarImporte").ToString, Boolean)
|
|
End Get
|
|
Set(value As Boolean)
|
|
ViewState("PermiteModificarImporte") = value
|
|
End Set
|
|
End Property
|
|
Private Property ComprobanteIE As String
|
|
Get
|
|
Return ViewState("ComprobanteIE").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("ComprobanteIE") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CodigoProgramacion As String
|
|
Get
|
|
Return ViewState("CodigoProgramacion").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("CodigoProgramacion") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Property CveSubProyectoFiltro As Integer
|
|
Get
|
|
If ViewState("CveSubProyectoFiltro") Is Nothing Then
|
|
ViewState("CveSubProyectoFiltro") = -1
|
|
End If
|
|
Return ViewState("CveSubProyectoFiltro").ToString.ToEntero
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveSubProyectoFiltro") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Property DtDatos As DataTable
|
|
Get
|
|
Return DirectCast(ViewState("DtDatos"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtDatos") = value
|
|
End Set
|
|
End Property
|
|
Private Property OriReferenciaCIE As String
|
|
Get
|
|
If ViewState("OriReferenciaCIE") Is Nothing Then
|
|
Return ""
|
|
Else
|
|
Return ViewState("OriReferenciaCIE").ToString
|
|
End If
|
|
|
|
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("OriReferenciaCIE") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property OriConceptoCIE As String
|
|
Get
|
|
If ViewState("OriConceptoCIE") Is Nothing Then
|
|
Return ""
|
|
Else
|
|
Return ViewState("OriConceptoCIE").ToString
|
|
End If
|
|
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("OriConceptoCIE") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
#End Region
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
|
|
'temporal
|
|
If UsuarioActual.CveUsuario.Contiene(1803, 100) Then
|
|
ChkNoValidaSAT.Visible = True
|
|
End If
|
|
|
|
PermiteModificarImporte = True
|
|
TxtFechaIncobrable.Text = NowADS().ToShortDateString
|
|
|
|
If Request("CveProveedor") IsNot Nothing AndAlso Request("CveProveedor").ToString.ToEntero > 0 Then
|
|
|
|
CveProveedor = IfNull(Request("CveProveedor"), "-1").ToString.ToEntero
|
|
FechaI = IfNull(Request("FechaI"), "-1").ToString
|
|
FechaF = IfNull(Request("FechaF"), "-1").ToString
|
|
CveUsuarioProgramo = IfNull(Request("CveUsuarioProgramo"), "-1").ToString.ToEntero
|
|
TipoPago = IfNull(Request("TipoPago"), "-1").ToString.ToEntero
|
|
CveUsuarioRegistro = IfNull(Request("CveUsuarioRegistro"), "-1").ToString.ToEntero
|
|
CveUsuarioResponsable = IfNull(Request("CveUsuarioResponsable"), "-1").ToString.ToEntero
|
|
CveClasificacionProveedor = IfNull(Request("CveClasificacion"), "-1").ToString.ToEntero
|
|
CveMoneda = IfNull(Request("CveMoneda"), "-1").ToString.ToEntero
|
|
CveMonedaFiltro = IfNull(Request("CveMoneda"), "-1").ToString.ToEntero
|
|
CveEstatus = IfNull(Request("CveEstatus"), "-1").ToString.ToEntero
|
|
Serie = IfNull(Request("Serie"), "").ToString
|
|
CveAplicaNC = IfNull(Request("CveAplicaNC"), "-1").ToString.ToEntero
|
|
CveProveedorSucursal = IfNull(Request("CveProveedorSucursal"), "-1").ToString.ToEntero
|
|
CodigoProgramacion = IfNull(Request("CodigoProgramacion"), "-1").ToString
|
|
CveSubProyectoFiltro = IfNull(Request("CveSubProyecto"), -1).ToString.ToEntero
|
|
|
|
|
|
TxtOtrosImportes.Attributes.Add("onKeyUp", String.Format("FnSuma(this,{0},{1});", "TxtTotal", 0))
|
|
|
|
'proceso para que solo pague lo que este programada
|
|
If UsuarioActual.TienePermisoProceso(98) Then
|
|
PermiteModificarImporte = False
|
|
End If
|
|
Calendario.StartDate = NowADS().AddMonths(-18)
|
|
'proceso que restringue solo el pago de apartir del dia de hoy y como limite fin de mes
|
|
If UsuarioActual.TienePermisoProceso(105) Then
|
|
Calendario.StartDate = NowADS()
|
|
Calendario.EndDate = NowADS().LastDayOfMonth
|
|
MEVCalendario.MinimumValue = NowADS().ToShortDateString
|
|
MEVCalendario.MaximumValue = NowADS().LastDayOfMonth.ToShortDateString
|
|
MEVCalendario.Enabled = True
|
|
End If
|
|
|
|
CargaProveedor(Request("CveProveedor").ToString.ToEntero)
|
|
End If
|
|
|
|
' If UsuarioActual.Empresa.Funcionalidad(142) = "1" Then
|
|
trNotificar.Visible = True
|
|
UpDatos.Visible = True
|
|
'End If
|
|
|
|
If UsuarioActual.Empresa.UsaAC Then
|
|
PnlAC.Visible = True
|
|
' Dim AC As New ClsAC
|
|
' If AC.GetPresupuestoEgresos(-1, True, usuarioactual.Empresa.EjercicioActual, UsuarioActual.CveEmpresa) Then
|
|
' 'DdlProgramaOperativo.DataSource = AC.DtResultados
|
|
' 'DdlProgramaOperativo.DataBind()
|
|
' GvAC.DataSource = AC.DtResultados
|
|
' GvAC.DataBind()
|
|
' End If
|
|
' AC.Dispose()
|
|
End If
|
|
|
|
'BANDERA DE SURTIDO
|
|
If UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 Or UsuarioActual.Empresa.Funcionalidad(134).ToEntero > 0 Then
|
|
GvCxP.Columns(3).Visible = True
|
|
End If
|
|
|
|
If CveMoneda > 0 Then
|
|
LbTipoMoneda.Text = String.Format("Pago en {0}", GlobalDTMonedas.FiltraParametros(String.Format("CveMoneda = {0}", CveMoneda)).Rows(0)("Moneda"))
|
|
End If
|
|
|
|
If CveMoneda = 2 Then
|
|
ChkPagarPesos.Visible = True
|
|
TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
|
|
TxtTCDolaresDolares.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
|
|
DivDolaresDolares.Visible = True
|
|
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
|
|
Else
|
|
ChkPagarDolares.Visible = True
|
|
TxtTCDolares.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
|
|
End If
|
|
|
|
RegistraScript($"TipoCambioActual = {GlobalTipoCambio(NowADS()).FormatoNumero(4)}")
|
|
UpDatos.Update()
|
|
|
|
If UsuarioActual.TienePermisoProceso(215) Or UsuarioActual.TienePermisoProceso(204) Then
|
|
HlSaldarCuentasSinPagar.Visible = True
|
|
End If
|
|
|
|
If UsuarioActual.CveEmpresa.Contiene(119, 158) And CveUsuarioProgramo <> -1 Then
|
|
LnkPDFSolicitud.Visible = True
|
|
LnkExcelSolicitud.Visible = True
|
|
End If
|
|
|
|
If UsuarioActual.TienePermisoProceso(361) Then
|
|
'GvCxP.Columns(11).Visible = True
|
|
chkaplicaDescuento.Visible = True
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Protected Sub BtnCambiaTipoMoneda_Click(sender As Object, e As EventArgs)
|
|
CambiaTipoMoneda()
|
|
End Sub
|
|
Private Sub CambiaTipoMoneda()
|
|
|
|
If DivTC.Visible Then
|
|
TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
|
|
RegistraScript("CambiaPesosDolares();")
|
|
End If
|
|
|
|
If DivTCDolares.Visible Then
|
|
TxtTCDolares.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
|
|
RegistraScript("CambiaDolaresPesos();")
|
|
End If
|
|
|
|
If DivDolaresDolares.Visible Then
|
|
TxtTCDolaresDolares.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
|
|
End If
|
|
|
|
UpDatos.Update()
|
|
End Sub
|
|
#Region " CARGA DATOS "
|
|
Private Sub CargaDatos(Optional tCveMoneda As Integer = -1) 'pCveProveedor As Integer, tCveMoneda As Integer, FechaVencimientoInicio As String, FechaVencimientoFin As String, CveUsuarioRegistro As Integer, CveUsuarioPrograma As Integer, Serie As String)
|
|
If tCveMoneda = -1 Then tCveMoneda = CveMoneda
|
|
|
|
Dim Mov As New ClsMovimientos
|
|
TxtObservaciones.Text = ""
|
|
TxtImporte.Text = ""
|
|
TxtTotal.Text = ""
|
|
|
|
If Mov.GetCxPProveedor(CveProveedor, FechaI, FechaF, CveUsuarioProgramo, CveUsuarioRegistro, CveUsuarioResponsable, CveClasificacionProveedor, tCveMoneda, CveEstatus, CveProveedorSucursal, CveAplicaNC, "-1", "-1", CodigoProgramacion, CveSubProyecto:=CveSubProyectoFiltro) Then
|
|
DtDatos = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio")
|
|
GvCxP.DataSource = DtDatos
|
|
DtDatos.Columns.Add("Movimiento")
|
|
If DtDatos.Rows.Count > 0 Then
|
|
DVBusqueda.Visible = True
|
|
DtDatos.Rows(0)("Movimiento") = "FACTURA DE ACREEDOR"
|
|
End If
|
|
|
|
End If
|
|
|
|
Mov.Dispose()
|
|
GvCxP.DataBind()
|
|
UPCompras.Update()
|
|
UpBusqueda.Update()
|
|
End Sub
|
|
Private Sub CargaProveedor(tCveProveedor As Integer)
|
|
Dim ObjProveedor As New ClsCompProveedores()
|
|
If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, tCveProveedor, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
|
If ObjProveedor.DtResultados.Rows.Count > 0 Then
|
|
'Campos para Modificación
|
|
|
|
'GeneralesLblEncabezado
|
|
|
|
CargaTipoTransaccion()
|
|
CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
|
|
TxtFechaDocumento.Text = NowADS().ToShortDateString
|
|
|
|
TxtPagueseA.Enabled = False
|
|
|
|
HplProveedor.Text = ObjProveedor.RazonSocial
|
|
HplProveedor.NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", tCveProveedor)
|
|
TxtPagueseA.Text = ObjProveedor.RazonSocial
|
|
TxtImporte.Attributes.Add("disabled", "disabled")
|
|
If DdlTipoTransaccion.SelectedValue = "1" Then RFVFolio.Enabled = True Else RFVFolio.Enabled = False
|
|
TxtNotificarA.Text = $"{ObjProveedor.NotificarA.Trim}"
|
|
If ObjProveedor.CorreoCobranza.Trim <> "" Then TxtNotificarA.Text = $"{TxtNotificarA.Text};{ObjProveedor.CorreoCobranza.Trim}"
|
|
|
|
'Sección de pago a proveedor
|
|
LtlNombreProveedor.Text = ObjProveedor.RazonSocial
|
|
LtlRFCProveedor.Text = ObjProveedor.RFC
|
|
If Serie <> "" AndAlso Serie <> "-1" Then
|
|
Dim dr As DataRow = GlobalDTProveedorSucursales(CveProveedor, UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("Serie = '{0}'", Serie))
|
|
If dr IsNot Nothing Then
|
|
TxtObservaciones.Text = String.Format("Suc. {0}", dr("ProveedorSucursal"))
|
|
HdnObs.Value = TxtObservaciones.Text
|
|
End If
|
|
End If
|
|
|
|
CargaDatos() '(tCveProveedor, CveMoneda, FechaI, FechaF, CveUsuarioRegistro, CveUsuarioProgramo, Serie)
|
|
CargaCuentasDepositos()
|
|
|
|
'CUANDO VIENE PROGRAMADO LLENA EL TEXTO OBSERVACIONES
|
|
If CveUsuarioProgramo <> -1 Then RegistraScript("SumaValores();")
|
|
|
|
Else
|
|
Alert("El Proveedor Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
|
|
|
|
End If
|
|
End If
|
|
ObjProveedor.Dispose()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region " GV CXP "
|
|
Protected Sub GvCxP_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCxP.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(8).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(9).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(10).HorizontalAlign = HorizontalAlign.Right
|
|
|
|
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo")))
|
|
|
|
If e.Row.RowIndex = 0 Then
|
|
e.Row.FCHyperLink("HplF").Text = (CType(GvCxP.DataSource, DataTable).Rows.Count - 1).ToString
|
|
e.Row.BackColor = Drawing.Color.LightGray
|
|
End If
|
|
|
|
If e.Row.DBCampo("CveCompra") = "" Then
|
|
e.Row.FCTextBox("TxtAbonar").Visible = False
|
|
e.Row.FCCheckBox("Chk").Visible = False
|
|
e.Row.FCTextBox("TxtComision").Visible = False
|
|
Else
|
|
e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1,'{2}',1);", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo"))
|
|
e.Row.FCTextBox("TxtComision").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},2,'{2}',2);", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo"))
|
|
End If
|
|
|
|
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(7).ForeColor = Drawing.Color.Red
|
|
If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxC" Then e.Row.Cells(4).ForeColor = Drawing.Color.Red
|
|
If e.Row.DBCampo("TotalOriginal").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = ""
|
|
If e.Row.DBCampo("Abonado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAbonado"), Literal).Text = ""
|
|
If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldo"), Literal).Text = ""
|
|
|
|
If e.Row.DBCampo("Folio") = "N/D" Then
|
|
e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("Folio")
|
|
End If
|
|
|
|
If e.Row.DBCampo("CveCompra").ToEntero > 0 Then
|
|
|
|
Dim FiltroInv As String = ""
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(134).ToEntero > 0 Then ' valores 1 - permite pago proporcional, valor 2. paga solo si se recibio el 100%
|
|
'se bloquean las opciones
|
|
e.Row.FCCheckBox("Chk").Enabled = False
|
|
e.Row.FCTextBox("TxtAbonar").Enabled = False
|
|
|
|
Dim Str As New StringBuilder
|
|
Str.AppendFormat("Importe Almacen: ${0} ({1}%) <br/>", e.Row.DBCampo("ImporteAlmacen").FormatoNumero, e.Row.DBCampo("ImporteAlmacenPorcentaje"))
|
|
If e.Row.DBCampo("ImporteServicios").ToDouble > 0 Then Str.AppendFormat("Importe Servicios: ${0} ({1}%) <br/>", e.Row.DBCampo("ImporteServicios").FormatoNumero, e.Row.DBCampo("ImporteServiciosPorcentaje"))
|
|
If e.Row.DBCampo("ImporteDevolucion").ToDouble > 0 Then Str.AppendFormat("Importe Devuelto: ${0} ({1}%) <br/>", e.Row.DBCampo("ImporteDevolucion").FormatoNumero, e.Row.DBCampo("ImporteDevolucionPorcentaje"))
|
|
Str.AppendFormat(" <i> Importes <b> SIN</b> IVA</i>")
|
|
e.Row.FCLabel("LbEstatusInv").Attributes.Add("title", Str.ToString)
|
|
|
|
Dim PorcentajeAlmacen As Decimal = e.Row.DBCampo("ImporteAlmacenPorcentaje").ToString.ToDecimal + e.Row.DBCampo("ImporteServiciosPorcentaje").ToString.ToDecimal + e.Row.DBCampo("ImporteDevolucionPorcentaje").ToString.ToDecimal
|
|
Dim SaldoInv As Decimal = (e.Row.DBCampo("Saldo").ToString.ToDecimal * (PorcentajeAlmacen / 100))
|
|
If UsuarioActual.Empresa.Funcionalidad(134) = "1" Then 'cuando es proporcional
|
|
FiltroInv = $"FnCambia({e.Row.FCCheckBox("Chk").ClientID},this,{SaldoInv},1,'{"El importe no debe exceder lo recibido en almacén"}',1);"
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(134) = "2" Then
|
|
FiltroInv = "" 'queno considera lo proporcional
|
|
End If
|
|
|
|
If PorcentajeAlmacen = 0 Then ' sin recibir
|
|
e.Row.FCLabel("LbEstatusInv").Text = "<i Class='fa fa-flag-o' aria-hidden='true'></i>"
|
|
e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Red
|
|
|
|
ElseIf PorcentajeAlmacen > 99.0 OrElse e.Row.DBCampo("ImporteAlmacen").ToDecimal >= e.Row.DBCampo("Saldo").ToString.ToDecimal Then 'recibido completo ' si tiene un porcentaje mayor ingresado, que este halla sido por OC, debe de permitirlo
|
|
' NOTA. si la factura tiene devoluciones, debera comparar el saldo de la factura con lo recibido en el almacen
|
|
e.Row.FCLabel("LbEstatusInv").Text = "<i Class='fa fa-flag' aria-hidden='true'></i>"
|
|
e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Green
|
|
e.Row.FCCheckBox("Chk").Enabled = True
|
|
e.Row.FCTextBox("TxtAbonar").Enabled = True
|
|
Else ' parcial
|
|
|
|
e.Row.FCLabel("LbEstatusInv").Text = "<i Class='fa fa-flag-checkered' aria-hidden='true'></i>"
|
|
e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.DarkOrange
|
|
If UsuarioActual.Empresa.Funcionalidad(134).ToEntero = 1 Then ' si es la opcion ,de pagar lo proporcional
|
|
e.Row.FCCheckBox("Chk").Enabled = True
|
|
e.Row.FCTextBox("TxtAbonar").Enabled = True
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
e.Row.FCLiteral("LtlAux").Text = String.Format("<a Class=""Texto thickbox"" href=""/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxPProveedor&CveProveedor={0}&CveCompra={1}&TB_iframe=true&height=370&width=900"" />Ir</a>", e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveCompra"))
|
|
e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1,'{2}',1);{3}", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo", FiltroInv))
|
|
|
|
|
|
|
|
If Not PermiteModificarImporte Then e.Row.FCTextBox("TxtAbonar").Enabled = False
|
|
If e.Row.DBCampo("CveCompraNC").ToEntero > 0 Then
|
|
e.Row.FCHyperLink("HplNC").Visible = True
|
|
e.Row.FCHyperLink("HplNC").ImageUrl = "/Imagenes/flag_green.png"
|
|
e.Row.FCHyperLink("HplNC").ToolTip = "Notas de Crédito Aplicadas"
|
|
End If
|
|
If e.Row.DBCampo("ImporteProgramo").ToDouble > 0 Then
|
|
e.Row.FCCheckBox("chk").Checked = True
|
|
|
|
e.Row.FCTextBox("TxtAbonar").Text = e.Row.DBCampo("ImporteProgramo").ToDouble.FormatoNumero()
|
|
' N O T A: si el importe programado es mayor al Saldo de la factura, se pone el saldo
|
|
If e.Row.DBCampo("ImporteProgramo").ToDouble > e.Row.DBCampo("Saldo").ToDouble Then
|
|
e.Row.FCTextBox("TxtAbonar").ToolTip = "El importe programado es mayor al saldo. El Importe visible es el saldo "
|
|
'e.Row.FCTextBox("TxtAbonar").BackColor = Drawing.Color.OrangeRed
|
|
e.Row.FCTextBox("TxtAbonar").CssClass = "bg-yellow-gold"
|
|
e.Row.FCTextBox("TxtAbonar").Text = e.Row.DBCampo("Saldo").FormatoNumero()
|
|
'se va acumulando el importe de cada renglon para sacar el pago del IE
|
|
TxtImporte.Text = (TxtImporte.Text.ToDouble + e.Row.DBCampo("Saldo").ToDouble).FormatoNumero()
|
|
Else
|
|
'se va acumulando el importe de cada renglon para sacar el pago del IE
|
|
TxtImporte.Text = (TxtImporte.Text.ToDouble + e.Row.DBCampo("ImporteProgramo").ToDouble).FormatoNumero()
|
|
End If
|
|
End If
|
|
|
|
'si está bloqueada y es refacturación, debe de permitirlo, sin importar lo que se halla ingresado
|
|
If e.Row.DBCampo("CveCompraRefacturacion").ToEntero > 0 AndAlso Not e.Row.FCCheckBox("Chk").Enabled Then
|
|
e.Row.FCCheckBox("Chk").Enabled = True
|
|
e.Row.FCTextBox("TxtAbonar").Enabled = True
|
|
End If
|
|
If UsuarioActual.Empresa.Funcionalidad(306) = "1" And e.Row.DBCampo("AplicaNotaCredito").ToString = "True" Then
|
|
e.Row.FCCheckBox("Chk").Enabled = False
|
|
End If
|
|
|
|
e.Row.FCTextBox("TxtDescuento").Attributes.Add("onkeyup", $"calculaDescuentoEscalonado({e.Row.DBCampo("Saldo")},{e.Row.FCTextBox("TxtDescuento").ClientID},{e.Row.FCTextBox("TxtAbonar").ClientID},{e.Row.FCCheckBox("Chk").ClientID},'El Importe no debe de exceder el saldo',1)")
|
|
Else
|
|
e.Row.FCTextBox("TxtDescuento").Visible = False
|
|
|
|
End If
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " GUARDAR "
|
|
|
|
Protected Sub BtnIEGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click
|
|
|
|
|
|
Dim ValFechaDocumento As Boolean = False
|
|
Dim FoliosFechasValFechaDocumento As New StringBuilder
|
|
|
|
FoliosFechasValFechaDocumento.AppendLine("Se seleccionaron facturas con fecha de mes superior al mes del pago: <br/>")
|
|
|
|
For Each gvRowVal As GridViewRow In GvCxP.Rows
|
|
|
|
If gvRowVal.FCCheckBox("Chk").Checked Then
|
|
|
|
|
|
Dim FechaFactura As Date = gvRowVal.DataKey("Fecha").ToDate
|
|
Dim FechaDocumento As Date = TxtFechaDocumento.Text.ToDate
|
|
|
|
Dim AnioFactura As Integer = FechaFactura.Year
|
|
Dim MesFactura As Integer = FechaFactura.Month
|
|
|
|
Dim AnioDocumento As Integer = FechaDocumento.Year
|
|
Dim MesDocumento As Integer = FechaDocumento.Month
|
|
|
|
If UsuarioActual.Empresa.UsaAC = False Then
|
|
If AnioFactura > AnioDocumento Then
|
|
FoliosFechasValFechaDocumento.AppendLine($"Folio: { gvRowVal.DataKey("SerieFolio") } fecha: {gvRowVal.DataKey("Fecha").ToDate.ToString("dd/MM/yyyy") } <br/>")
|
|
ValFechaDocumento = True
|
|
ElseIf AnioFactura = AnioDocumento And MesFactura > MesDocumento Then
|
|
FoliosFechasValFechaDocumento.AppendLine($"Folio: { gvRowVal.DataKey("SerieFolio") } fecha: {gvRowVal.DataKey("Fecha").ToDate.ToString("dd/MM/yyyy") } <br/>")
|
|
ValFechaDocumento = True
|
|
End If
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
If ValFechaDocumento Then
|
|
Alert(FoliosFechasValFechaDocumento.ToString, TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
If DdlTipoTransaccion.SelectedValue.ToEntero < 0 Then
|
|
Alert("Seleccione un tipo de transacción", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
If DdlCuenta.SelectedValue.ToEntero < 0 Then
|
|
Alert("Seleccione una cuenta bancaria", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
If CveMoneda <= 0 Then
|
|
Alert("Seleccione la Moneda del pago", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim dtc As DataTable = GlobalDTProveedoresCuentas(UsuarioActual.CveEmpresa, CveProveedor:=CveProveedor)
|
|
If dtc IsNot Nothing Then
|
|
Dim Row As DataRow = dtc.FiltroPrimero(String.Format("CveCuentaDeposito = {0}", DdlCuentaDeposito.SelectedValue.ToEntero))
|
|
If Row IsNot Nothing AndAlso Row("Estatus").ToString = "False" Then
|
|
Alert("La cuenta depósito del proveedor esta inactiva.", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
|
|
'proceso que restringue solo el pago de apartir del dia de hoy y como limite fin de mes
|
|
If UsuarioActual.TienePermisoProceso(105) AndAlso (TxtFechaDocumento.Text.ToDate < NowADS().Date Or TxtFechaDocumento.Text.ToDate > NowADS().LastDayOfMonth) Then
|
|
Alert("Fecha No permitida", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim ImporteSeleccionado As Decimal = 0
|
|
Dim ValidaSAT As Boolean = True
|
|
If UsuarioActual.Empresa.Funcionalidad(529) = "1" OrElse ChkNoValidaSAT.Checked Then ValidaSAT = False
|
|
|
|
If ValidaSAT Then
|
|
Dim Validada As Boolean = False
|
|
Dim MsgValidadas As New StringBuilder
|
|
Dim Valida As New ClsValidaCFDi()
|
|
'verifico ante el SAT las compras que voy a pagar
|
|
For Each gvr As GridViewRow In GvCxP.Rows
|
|
If gvr.FCCheckBox("Chk").Checked Then
|
|
|
|
ImporteSeleccionado += gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
|
If gvr.DataKey("UUID") <> "" Then
|
|
|
|
Valida.Verificar(gvr.DataKey("UUID"), gvr.DataKey("RFC"), UsuarioActual.Empresa.RFC, gvr.DataKey("TotalOriginal").ToDecimal)
|
|
|
|
If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa < 2 Then
|
|
Valida.EsValida = 1
|
|
End If
|
|
|
|
If Valida.EsValida <> 1 Then
|
|
|
|
Validada = False
|
|
If Valida.EsValida = 2 Then 'Cancelada
|
|
'estatus inventario, no surtida
|
|
If gvr.DataKey("EstatusInventario") = "1" Then
|
|
MsgValidadas.AppendFormat("Factura Cancelada: {0} - {1} , relacione su factura nueva para descontar saldo<br>", gvr.DataKey("SerieFolio"), gvr.DataKey("Descripcion"))
|
|
Else
|
|
MsgValidadas.AppendFormat("Factura Cancelada: {0} - {1} con movimientos de almacen, relacione su factura nueva para descontar saldo<br>", gvr.DataKey("SerieFolio"), gvr.DataKey("Descripcion"))
|
|
End If
|
|
Else
|
|
MsgValidadas.AppendFormat("Factura No se pudo Validar: {0} - {1}<br>", gvr.DataKey("SerieFolio"), gvr.DataKey("Descripcion"))
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
Valida.Dispose()
|
|
|
|
'verificacion doble, si no la han cancelado, ya tiene una validaci[on para que llegue aqui
|
|
|
|
If MsgValidadas.Length > 0 Then
|
|
Alert(String.Format("<br>Las Facturas presentan la siguiente situación ante el SAT. <br>{0}", MsgValidadas.ToString), TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
Else
|
|
For Each gvr As GridViewRow In GvCxP.Rows
|
|
If gvr.FCCheckBox("Chk").Checked Then
|
|
ImporteSeleccionado += gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
If ImporteSeleccionado <= 0 Then
|
|
Alert("Seleccione facturas", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim ObjIE As New ClsBancos()
|
|
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
|
|
Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL)
|
|
Dim ObjConta As ClsContPAQi = Nothing
|
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaContabilidad Then
|
|
ObjConta = New ClsContPAQi(UsuarioActual.Empresa)
|
|
ObjConta.IniciaTransacSQL()
|
|
End If
|
|
Dim MsgError As String = ""
|
|
Dim IDPoliza As Integer = 0
|
|
Dim FolioPoliza As Integer = 0
|
|
Dim CveCuentaDeposito As Integer = 0
|
|
Dim CveConceptoCompra As Integer = 6
|
|
Dim CvePrePoliza As Integer = 0
|
|
Dim CveSubProyecto As Integer = -1
|
|
|
|
If DdlCuentaDeposito.Items.Count > 0 Then
|
|
CveCuentaDeposito = DdlCuentaDeposito.SelectedValue.ToEntero
|
|
End If
|
|
|
|
'Saca moneda en que se va a pagar segun metodo de pago
|
|
|
|
If DdlCuenta.SelectedValue.ToEntero > 0 Then
|
|
CveMoneda = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveCuenta = {DdlCuenta.SelectedValue.ToEntero}").ToEntero
|
|
End If
|
|
|
|
If TxtImporte.Text.ToDouble > 0 Then
|
|
If TxtFolio.Text.Trim <> "" Then
|
|
|
|
Dim Fecha As Date = TxtFechaDocumento.Text.ToDate
|
|
Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos
|
|
Dim filemove As String = ""
|
|
Dim Comprobante As String = ""
|
|
ComprobanteIE = ""
|
|
For Each fileItem As Archivo In filesgral
|
|
Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
|
|
filemove = fileItem.filename
|
|
Next
|
|
Dim ConceptoPoliza As String = String.Format("{0} {1}", HplProveedor.Text, TxtObservaciones.Text)
|
|
Dim FolioFijo As Integer = 0
|
|
Dim TipoCambio As Decimal = 0
|
|
|
|
'cheque
|
|
If DdlTipoTransaccion.SelectedValue = "1" AndAlso UsuarioActual.CveEmpresa.Contiene(13, 83) Then FolioFijo = TxtFolio.Text.ToEntero
|
|
|
|
CvePrePoliza = ObjMov.AddPrePolizas("Bancos/ProveedoresAbonar", 2, ImporteSeleccionado, ImporteSeleccionado, 1, TxtFechaDocumento.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, Nothing, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa))
|
|
|
|
If CveMoneda = 2 Then
|
|
If TxtTCDolares.Visible Then
|
|
TipoCambio = TxtTCDolares.Text.ToDecimal
|
|
Else
|
|
TipoCambio = TxtTCDolaresDolares.Text.ToDecimal
|
|
End If
|
|
Else
|
|
If TxtTC.Visible Then
|
|
TipoCambio = TxtTC.Text.ToDecimal
|
|
End If
|
|
End If
|
|
|
|
Dim CveIE As Integer = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, TxtPagueseA.Text.Trim, TxtImporte.Text.ToDecimal, GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", "CveCuenta = " & DdlCuenta.SelectedValue).ToEntero, TipoCambio, TxtObservaciones.Text.Trim, TxtNotificarA.Text.Trim, ChkAbonoCuenta.Checked, True, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1), ConceptoCIE:=TxtConceptoCIE.Text)
|
|
|
|
If CveIE > 0 Then
|
|
ComprobanteIE = $"{CveIE}.{Comprobante}"
|
|
|
|
If DdlCuentaDeposito.SelectedValue.ToEntero > 0 And DdlTipoTransaccion.SelectedValue = "17" Then
|
|
|
|
If TxtReferenciaCIE.Text <> OriReferenciaCIE Or TxtConceptoCIE.Text <> OriConceptoCIE Then
|
|
|
|
Dim ObjGrales As New ClsGenerales(ObjIE.IniciaTransacSQL)
|
|
If Not ObjGrales.UpdateCuentasDepositosEstatusPagoElectronicoGrupos(DdlCuentaDeposito.SelectedValue.ToEntero, -1, -1, "-1", TxtReferenciaCIE.Text.Trim, TxtConceptoCIE.Text.Trim) Then
|
|
MsgError = "Error al actualizar cuenta Referencia y Concepto Deposito."
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
'guardo el archivo
|
|
If filemove <> "" Then
|
|
filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
|
|
End If
|
|
|
|
Anexo.Text = ""
|
|
'inserto los movimientos de la conta para abonar al saldo
|
|
|
|
If CvePrePoliza > 0 Then
|
|
Dim Pago As New CompraPago
|
|
Pago.Fecha = TxtFechaDocumento.Text.ToDate
|
|
Pago.CveIE = CveIE
|
|
Pago.CveMonedaPago = CveMoneda
|
|
|
|
'inserto las compras que voy a pagar
|
|
For Each gvr As GridViewRow In GvCxP.Rows
|
|
If gvr.FCCheckBox("Chk").Checked Then
|
|
|
|
Dim CompraActual As New Compra
|
|
CompraActual.CveCompra = gvr.DataKey("CveCompra").ToEntero
|
|
CompraActual.CveTipoConceptoProveedor = gvr.DataKey("CveTipoConcepto").ToEntero
|
|
CompraActual.CveProveedor = gvr.DataKey("CveProveedor").ToEntero
|
|
CompraActual.CveMoneda = gvr.DataKey("CveMoneda").ToEntero
|
|
CompraActual.Fecha = gvr.DataKey("Fecha").ToDate
|
|
CompraActual.SerieFolio = gvr.DataKey("SerieFolio").ToString
|
|
CompraActual.ProveedorNombre = HplProveedor.Text
|
|
CompraActual.TC = gvr.DataKey("TipoCambioOriginal").ToDecimal
|
|
CompraActual.Total = gvr.DataKey("Total").ToDecimal
|
|
CompraActual.IVA = gvr.DataKey("IVA").ToDecimal
|
|
CompraActual.IVADeducible = gvr.DataKey("IVADeducible").ToDecimal
|
|
CompraActual.IVANoDeducible = gvr.DataKey("IVANoDeducible").ToDecimal
|
|
CompraActual.CompraNoDeducible = gvr.DataKey("NoDeducible").ToEntero
|
|
CompraActual.IEPS = gvr.DataKey("IEPS").ToDecimal
|
|
CompraActual.RetIVA = gvr.DataKey("RetIVA").ToDecimal
|
|
CompraActual.RetISR = gvr.DataKey("RetISR").ToDecimal
|
|
CompraActual.CveConceptoRetISR = gvr.DataKey("CveRetISRConcepto").ToEntero
|
|
CompraActual.CveConceptoRetIVA = gvr.DataKey("CveRetIVAConcepto").ToEntero
|
|
CompraActual.PorcentajeIVA = gvr.DataKey("PorcentajeIVA").ToDecimal
|
|
CompraActual.EsImportacion = gvr.DataKey("EsImportacion") = "1"
|
|
CompraActual.UsuarioActual = UsuarioActual
|
|
CompraActual.CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero
|
|
|
|
'Importe de pago
|
|
Pago.ImportePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
|
'Tipos de cambio
|
|
If Pago.CveMonedaPago = 1 AndAlso CompraActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos
|
|
Pago.TCPago = 1 ' TxtTC.Text.ToDecimal
|
|
Pago.ImportePago = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * TxtTC.Text.ToDecimal).RoundSQL
|
|
ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES
|
|
Pago.TCPago = TxtTCDolaresDolares.Text.ToDecimal
|
|
ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActual.CveMoneda = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
|
|
Pago.TCPago = TxtTCDolares.Text.ToDecimal
|
|
Pago.ImportePago = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal / TxtTCDolares.Text.ToDecimal)
|
|
End If
|
|
If ChkPagarPesos.Checked Then Pago.TCCambioMoneda = 1 / TxtTC.Text.ToDecimal
|
|
If ChkPagarDolares.Checked Then Pago.TCCambioMoneda = TxtTCDolares.Text.ToDecimal
|
|
|
|
If gvr.FCTextBox("TxtComision").Text.ToDecimal <> 0 Then
|
|
Pago.OtroGastoIngreso = gvr.FCTextBox("TxtComision").Text.ToDecimal
|
|
Else
|
|
Pago.OtroGastoIngreso = 0
|
|
End If
|
|
|
|
If AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjMov) Then
|
|
MsgError = "No se pudo insertar la póliza"
|
|
Exit For
|
|
End If
|
|
|
|
'DESPROGRAMA LO PROGRAMADO DESPUES DE HACERLE UN PAGO
|
|
' If DdlTipoTransaccion.SelectedValue <> "9" Then 'SI ES LAYOUT SE DESPROGRAMA EN BANCOS/PAGOELECTRONICO, se comentó, 2018.07.31 peticion marilú.
|
|
If MsgError = "" AndAlso gvr.DataKey("ImporteProgramo").ToDouble > 0 Then
|
|
ObjComp.ProgramarCompra(gvr.DataKey("CveCompra").ToEntero, 0, UsuarioActual.CveUsuario, -1)
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
Dim UsaComplementariaBancos As Boolean = Not UsuarioActual.CveEmpresa.Contiene(7, 11, 122, 145, 13, 83)
|
|
Dim ConceptoMovimiento As String = $"{TxtPagueseA.Text.Trim} - {TxtObservaciones.Text} {If(Pago.TCPago > 1, $" TC:{Pago.TCPago}", "")}"
|
|
Dim Referencia As String = $"{HdnTipoTransaccionAbreviatura.Value}: {TxtFolio.Text.Trim}"
|
|
Dim tImporteMN As Decimal = TxtImporte.Text.ToDecimal
|
|
Pago.ImportePago = tImporteMN
|
|
|
|
Dim ImporteME As Decimal = 0
|
|
If Pago.CveMonedaPago = 2 Then ImporteME = Pago.ImportePago
|
|
If Not UsaComplementariaBancos And Pago.CveMonedaPago = 2 Then
|
|
ImporteME = tImporteMN
|
|
tImporteMN = (tImporteMN * Pago.TCPago).RoundSQL
|
|
End If
|
|
|
|
|
|
|
|
If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, tImporteMN, 30, Referencia, ConceptoMovimiento, CveIE:=CveIE, CveProveedor:=CveProveedor, TipoCambio:=Pago.TCPago, CveSubProyecto:=CveSubProyecto, ImporteME:=ImporteME) Then
|
|
MsgError = "No se pudo insertar la póliza"
|
|
End If
|
|
|
|
If Pago.CveMonedaPago = 2 AndAlso UsaComplementariaBancos Then
|
|
If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, (Pago.ImportePago * Pago.TCPago - Pago.ImportePago).RoundSQL, 204, Referencia, ConceptoMovimiento, CveIE:=CveIE, CveProveedor:=CveProveedor, ImporteME:=Pago.ImportePago, TipoCambio:=Pago.TCPago, CveSubProyecto:=CveSubProyecto) Then
|
|
MsgError = "No se pudo insertar la póliza"
|
|
End If
|
|
End If
|
|
|
|
If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
|
|
If ObjMov.ValorPolizaDescuadre > 0 Then
|
|
MsgError = ObjMov.MensajePolizaDescuadre + " " + ObjMov.ValorDiferencia
|
|
GuardaLogAD($"Bancos/ProveedoresAbonar | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
|
End If
|
|
End If
|
|
|
|
'Conta ContPAQ
|
|
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then
|
|
'If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjConta) Then
|
|
If ObjMov.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, ObjConta:=ObjConta) Then
|
|
IDPoliza = ObjMov.ContaIdPoliza
|
|
Else
|
|
Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError)
|
|
MsgError = "Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico"
|
|
End If
|
|
End If
|
|
Else
|
|
MsgError = "No se pudo insertar la póliza"
|
|
End If
|
|
|
|
Else
|
|
MsgError = "No se insertó el encabezado"
|
|
End If
|
|
|
|
If MsgError = "" Then
|
|
'Alert("El Documento se guardó correctamente.", TipoMensaje.MsgInformacion, "window.close();")
|
|
|
|
Dim TieneError As Boolean = False
|
|
|
|
If UsuarioActual.Empresa.UsaAC Then
|
|
|
|
Dim Total As Double = TxtImporte.Text.ToDouble
|
|
|
|
If ChkACEjercer.Checked Then
|
|
Total = Total * 3
|
|
Else
|
|
Total = Total * 2
|
|
End If
|
|
|
|
Dim TipoChq As String = ""
|
|
If DdlTipoTransaccion.SelectedValue = "1" Then TipoChq = "CHQ"
|
|
'se multiplica por dos, porque se esta juntando el ejercido y el pagado al mismo tiempo
|
|
|
|
IDPoliza = ObjConta.AddPoliza(2, "Pagado " & TxtPagueseA.Text.Trim, Total, Total, UsuarioActual.CveUsuario, Fecha, TxtFolio.Text, TipoChq)
|
|
If IDPoliza > 0 Then
|
|
FolioPoliza = ObjConta.Folio
|
|
Dim ConceptoRenglon, Referencia As String
|
|
ConceptoRenglon = ""
|
|
Referencia = TxtFolio.Text
|
|
|
|
'NECESITO SACAR LAS PARTIDAS DE CADA PRESUPUESTO DE LAS FACTURAS PARA AFECTARLAS CON EL PAGO
|
|
Dim dtAC As New DataTable
|
|
dtAC.Columns.Add("PorcentajePago", Type.GetType("System.Double"))
|
|
Dim PorcentajePago As Double = 1
|
|
'Dim ComprasAC As New ClsCompras
|
|
For Each gvr As GridViewRow In GvCxP.Rows
|
|
If gvr.FCCheckBox("Chk").Checked Then
|
|
'obtengo su poliza para ver que presupuestos afecto
|
|
If gvr.DataKey("TotalOriginal").ToDouble > 0 Then PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDouble / gvr.DataKey("TotalOriginal").ToDouble Else PorcentajePago = 1
|
|
|
|
If ObjComp.GetPresupuestosCompras(gvr.DataKey("CveCompra").ToEntero) Then
|
|
dtAC.Merge(ObjComp.DtResultados)
|
|
|
|
If Not gvr.DataKey("Fecha").ToString.ToDate.Year < Fecha.Year Then ' SI ES EJERCICIO ANTERIOR LA COMPRA QUE EL EJERCICIO DEL PAGO NO AGREGA MOVIMIENTOS PRESUPUESTALES
|
|
For Each dr As DataRow In ObjComp.DtResultados.Rows
|
|
Total = dr("TotalPresupuesto").ToString.ToDouble * PorcentajePago
|
|
|
|
If Total > 0 Then
|
|
|
|
'EJERCIDO
|
|
If ChkACEjercer.Checked Then
|
|
|
|
ConceptoRenglon = String.Format("GE {0} Fact:{1}", TxtPagueseA.Text.Trim, gvr.DataKey("SerieFolio"))
|
|
If ObjConta.AddMovimiento(IDPoliza, dr("IdCuentaEjercido").ToString.ToEntero, False, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then
|
|
'actualizo el idcuenta del presupuesto
|
|
If Not ObjConta.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then
|
|
TieneError = True : Exit For
|
|
End If
|
|
|
|
Else
|
|
TieneError = True : Exit For
|
|
End If
|
|
End If
|
|
|
|
'PAGADO
|
|
ConceptoRenglon = String.Format("GP {0} Fact:{1}", TxtPagueseA.Text.Trim, gvr.DataKey("SerieFolio"))
|
|
If ObjConta.AddMovimiento(IDPoliza, dr("IdCuentaPagado").ToString.ToEntero, False, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then
|
|
'actualizo el idcuenta del presupuesto
|
|
If Not ObjConta.AddMovimiento(IDPoliza, dr("IdCuentaEjercido").ToString.ToEntero, True, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then
|
|
TieneError = True : Exit For
|
|
End If
|
|
Else
|
|
TieneError = True : Exit For
|
|
End If
|
|
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
'AFECTA PROVEEDOR
|
|
Total = gvr.FCTextBox("TxtAbonar").Text.ToDouble
|
|
If Not ObjConta.AddMovimiento(IDPoliza, 0, False, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then
|
|
TieneError = True
|
|
Exit For
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
If Not TieneError Then
|
|
ConceptoRenglon = String.Format("GP {0} {1}", TxtPagueseA.Text.Trim, TxtObservaciones.Text)
|
|
Total = TxtImporte.Text.ToDouble
|
|
If Not ObjConta.AddMovimiento(IDPoliza, 0, True, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then
|
|
TieneError = True
|
|
End If
|
|
End If
|
|
|
|
Else
|
|
TieneError = True
|
|
End If
|
|
End If
|
|
|
|
If Not TieneError AndAlso IDPoliza > 0 Then
|
|
'actualizar la conta del IE
|
|
ObjIE.UpdateIEPrePoliza(Fecha, FolioPoliza.ToString, IDPoliza, CvePrePoliza, CveIE, 0)
|
|
Else
|
|
IDPoliza = 0
|
|
End If
|
|
|
|
If Not TieneError Then
|
|
|
|
ObjIE.Commit()
|
|
If ObjConta IsNot Nothing Then ObjConta.Commit()
|
|
Anexo.Text = "[]"
|
|
|
|
Dim Msg As New StringBuilder
|
|
Msg.AppendFormat(" Folio: <a class=""Texto"" target='_blank' href=""/Bancos/IE.aspx?CveIE={0}"">{1}</a><br/> <br/> ", CveIE, TxtFolio.Text)
|
|
|
|
Msg.AppendFormat(" <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir movimiento</a><br/> ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)))
|
|
|
|
Msg.AppendFormat(" <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Listado</a><br/> ", Encripta(String.Format("OP=ImprimeMov&CveIE={0}", CveIE)))
|
|
If IDPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then Msg.AppendFormat(" <a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Póliza</a><br/> ", IDPoliza)
|
|
|
|
If UsuarioActual.TienePermisoProceso(354) Then 'visualizar la póliza al registros
|
|
Msg.AppendFormat("<a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizaS.aspx?CvePrePoliza={0}"">Ver Póliza</a> ", CvePrePoliza)
|
|
End If
|
|
|
|
Dim Mensaje As String = String.Format("El Documento se generó correctamente.<br /><br /> {0} ", Msg.ToString)
|
|
|
|
'LIMPIA
|
|
TxtFolio.Text = ""
|
|
TxtObservaciones.Text = ""
|
|
TxtImporte.Text = ""
|
|
TxtTotal.Text = ""
|
|
TxtFechaDocumento.Text = NowADS().ToShortDateString
|
|
DdlSelectedValue(DdlCuenta, "-1")
|
|
DdlSelectedValue(DdlTipoTransaccion, "-1")
|
|
Anexo.Text = "[]"
|
|
UpDatos.Update()
|
|
'upanexo.Update()
|
|
CargaDatos()
|
|
|
|
Alert(Mensaje.ToString, TipoMensaje.MsgInformacion, If(ChkSeguirRegistrando.Checked And GvCxP.Rows.Count > 0, "location.href =""#""", "location.href =""RepProveedoresPagos.aspx"""))
|
|
|
|
'Notificación de Pago
|
|
If TxtNotificarA.Text.Trim <> "" AndAlso ChkEnviarCorreo.Checked Then
|
|
'NotificacionPago(CveIE, TxtNotificarA.Text.Trim)
|
|
EnviarCorreoNotificacion(CveIE, TxtNotificarA.Text.Trim, "", UsuarioActual, False)
|
|
End If
|
|
|
|
End If
|
|
|
|
Else
|
|
ObjIE.RollBack()
|
|
If ObjConta IsNot Nothing Then ObjConta.RollBack()
|
|
Alert(MsgError, TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
ObjIE.Dispose()
|
|
ObjMov.Dispose()
|
|
ObjComp.Dispose()
|
|
If ObjConta IsNot Nothing Then ObjConta.Dispose()
|
|
Else
|
|
Alert("Debe de llevar un folio", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
Else
|
|
Alert("Debe de llevar un importe", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub DdlSelectedValue(Ddl As DropDownList, Valor As String)
|
|
If Ddl.Items.FindByValue(Valor) IsNot Nothing Then
|
|
Ddl.SelectedValue = Valor
|
|
Else
|
|
Ddl.SelectedIndex = 0
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region " TIPO TRANSACCION "
|
|
Private Sub CargaTipoTransaccion()
|
|
If TipoPago = 1 Then
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs' AND CveTipoTransaccion IN (1, 2) and Estatus = 1 ")
|
|
DdlTipoTransaccion.DataBind()
|
|
DdlTipoTransaccion.SelectedValue = TipoPago.ToString
|
|
ElseIf TipoPago = 2 Then
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs' AND CveTipoTransaccion IN (1, 2) and Estatus = 1 ")
|
|
DdlTipoTransaccion.DataBind()
|
|
DdlTipoTransaccion.SelectedValue = TipoPago.ToString
|
|
RecargaCuentasDepositos()
|
|
ElseIf TipoPago = 3 Then
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs' AND CveTipoTransaccion IN (1, 2) and Estatus = 1 ")
|
|
DdlTipoTransaccion.DataBind()
|
|
DdlTipoTransaccion.SelectedValue = TipoPago.ToString
|
|
RecargaCuentasDepositos()
|
|
Else
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs' and Estatus = 1")
|
|
DdlTipoTransaccion.DataBind()
|
|
End If
|
|
|
|
If DdlTipoTransaccion.Items.Count > 1 Then DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1"))
|
|
End Sub
|
|
Protected Sub DdlTipoTransaccion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoTransaccion.SelectedIndexChanged
|
|
BtnIEGuardar.Enabled = True
|
|
|
|
'cuando es cheque
|
|
If DdlTipoTransaccion.SelectedValue = "1" Then
|
|
ChkAbonoCuenta.Visible = True
|
|
TxtPagueseA.Enabled = True
|
|
Else
|
|
ChkAbonoCuenta.Visible = False
|
|
TxtPagueseA.Enabled = False
|
|
End If
|
|
|
|
If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(9, 17) Then
|
|
ChkEnviarCorreo.Enabled = False
|
|
ChkEnviarCorreo.Checked = False
|
|
Else
|
|
ChkEnviarCorreo.Enabled = True
|
|
ChkEnviarCorreo.Checked = True
|
|
End If
|
|
|
|
CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
|
|
RecargaCuentasDepositos()
|
|
|
|
UpGuardar.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region " CUENTAS MOVTO "
|
|
Private Sub CargaCuentas(tTipoTransaccion As Integer)
|
|
DdlCuenta.Items.Clear()
|
|
Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa)
|
|
|
|
If ChkPagarPesos.Checked Then
|
|
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1))
|
|
RegistraScript("CambiaPesosDolares();")
|
|
ElseIf ChkPagarDolares.Checked Then
|
|
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 2))
|
|
RegistraScript("CambiaDolaresPesos();")
|
|
Else
|
|
If CveMonedaFiltro > 0 Then
|
|
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", CveMonedaFiltro))
|
|
End If
|
|
End If
|
|
|
|
If TipoPago = 3 Then
|
|
dt = dt.FiltraParametros("CveTipoCuenta = 7")
|
|
End If
|
|
|
|
'cuando es layout
|
|
If tTipoTransaccion = 9 Then
|
|
dt = dt.FiltraParametros("UsaLayout = 1")
|
|
End If
|
|
|
|
If tTipoTransaccion = 17 Then
|
|
dt = dt.FiltraParametros("UsaLayoutGrupos = 1")
|
|
End If
|
|
|
|
DdlCuenta.DataSource = dt
|
|
DdlCuenta.DataBind()
|
|
DdlCuenta.Items.Insert(0, New ListItem("Seleccione cuenta", "-1"))
|
|
End Sub
|
|
|
|
Protected Sub DdlCuenta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuenta.SelectedIndexChanged
|
|
'recargo la moneda con la que se va a pagar
|
|
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta = {0}", DdlCuenta.SelectedValue))
|
|
If dr IsNot Nothing Then
|
|
|
|
|
|
If dr("CveMoneda").ToString.ToEntero >= 2 Then
|
|
DivDolaresDolares.Visible = True
|
|
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
|
|
BtnCambiaTipoMoneda_Click(Nothing, Nothing)
|
|
Else
|
|
DivDolaresDolares.Visible = False
|
|
TxtFechaDocumento.Attributes.Remove("onchange")
|
|
End If
|
|
UpDatos.Update()
|
|
|
|
If ChkPagarPesos.Checked Then
|
|
CveMoneda = 2
|
|
RegistraScript("CambiaPesosDolares();")
|
|
Else
|
|
CveMoneda = dr("CveMoneda").ToString.ToEntero
|
|
RegistraScript("CambiaDolaresPesos();")
|
|
End If
|
|
End If
|
|
|
|
' si no tiene CveMoneda, o es -1, cuando cambia de cuenta filtra las facturas
|
|
If IfNull(Request("CveMoneda"), "-1").ToString.ToEntero = -1 Then CargaDatos(CveMoneda)
|
|
|
|
If HdnTipoTransaccion.Value = "Egs" AndAlso UsuarioActual.Empresa.Funcionalidad(505) <> "1" Then
|
|
Dim Folio As Long
|
|
Dim Banco As New ClsBancos
|
|
Folio = Banco.GetNextFolio(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero)
|
|
Banco.Dispose()
|
|
TxtFolio.Text = Folio.ToString
|
|
Else
|
|
TxtFolio.Text = ""
|
|
End If
|
|
|
|
'Dim dr2 As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue)
|
|
'If dr2 IsNot Nothing Then
|
|
|
|
' If dr("UsaTarjeta").ToString = "True" Then
|
|
' CargaGridTarjetas()
|
|
' Else
|
|
' DivTarjeta.Visible = False
|
|
' End If
|
|
'End If
|
|
End Sub
|
|
|
|
|
|
|
|
'Private Sub CargaGridTarjetas()
|
|
' Dim ObjCreditos As New ClsBancos
|
|
' ObjCreditos.GetTarjetasCreditos(DdlCuenta.SelectedValue.ToEntero)
|
|
' DdlTarjeta.Items.Clear()
|
|
' DdlTarjeta.DataSource = ObjCreditos.DtResultados
|
|
' DdlTarjeta.DataBind()
|
|
' DdlTarjeta.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
' ObjCreditos.Dispose()
|
|
' DivTarjeta.Visible = True
|
|
'End Sub
|
|
#End Region
|
|
|
|
#Region " CUENTAS DEPOSITOS"
|
|
Private Sub CargaCuentasDepositos()
|
|
DdlCuentaDeposito.Items.Clear()
|
|
|
|
trCuentaDeposito.Visible = False
|
|
|
|
Dim dtc As DataTable = GlobalDTProveedoresCuentas(UsuarioActual.CveEmpresa, CveProveedor:=CveProveedor)
|
|
If dtc IsNot Nothing Then
|
|
|
|
If dtc.FiltraParametros("Estatus ='True'").Rows.Count > 0 Then
|
|
|
|
If DdlTipoTransaccion.SelectedValue = "9" Then
|
|
|
|
If dtc.Rows.Count > 0 Then
|
|
DdlCuentaDeposito.DataSource = dtc.FiltraParametros("EstatusPagoElectronico = 'True' AND Estatus ='True'")
|
|
DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1"))
|
|
End If
|
|
|
|
If dtc.FiltraParametros("EstatusPagoElectronico = 'True' AND Estatus ='True'").Rows.Count > 0 Then
|
|
trCuentaDeposito.Visible = True
|
|
DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1"))
|
|
Else
|
|
BtnIEGuardar.Enabled = False
|
|
Alert("El Beneficiario no tiene una cuenta activa en BBVA, dela de alta o seleccione otro método de pago", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
ElseIf DdlTipoTransaccion.SelectedValue = "17" Then
|
|
|
|
If dtc.Rows.Count > 0 Then
|
|
DdlCuentaDeposito.DataSource = dtc.FiltraParametros(" Estatus ='True'")
|
|
DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1"))
|
|
trCuentaDeposito.Visible = True
|
|
BtnIEGuardar.ToolTip = ""
|
|
Else
|
|
BtnIEGuardar.Enabled = False
|
|
BtnIEGuardar.ToolTip = "El proveedor no tiene cuentas deposito"
|
|
Alert("El proveedor no tiene cuentas deposito.", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
UpGuardar.Update()
|
|
Else
|
|
DdlCuentaDeposito.DataSource = dtc.FiltraParametros("Estatus ='True'")
|
|
If dtc.Rows.Count > 0 Then
|
|
trCuentaDeposito.Visible = True
|
|
DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1"))
|
|
End If
|
|
End If
|
|
DdlCuentaDeposito.DataBind()
|
|
Else
|
|
|
|
If DdlTipoTransaccion.SelectedValue.Contiene("9", "17") Then
|
|
BtnIEGuardar.Enabled = False
|
|
BtnIEGuardar.ToolTip = "El proveedor no tiene cuentas deposito"
|
|
Alert("El proveedor no tiene cuentas deposito.", TipoMensaje.MsgAdvertencia)
|
|
Else
|
|
trCuentaDeposito.Visible = True
|
|
BtnIEGuardar.Enabled = True
|
|
BtnIEGuardar.ToolTip = ""
|
|
End If
|
|
UpGuardar.Update()
|
|
End If
|
|
Else
|
|
|
|
If DdlTipoTransaccion.SelectedValue = "17" Then
|
|
BtnIEGuardar.Enabled = False
|
|
BtnIEGuardar.ToolTip = "El proveedor no tiene cuentas deposito"
|
|
Else
|
|
trCuentaDeposito.Visible = True
|
|
BtnIEGuardar.Enabled = True
|
|
BtnIEGuardar.ToolTip = ""
|
|
End If
|
|
|
|
UpGuardar.Update()
|
|
End If
|
|
|
|
'Else
|
|
' trCuentaDeposito.Visible = False
|
|
' DdlCuentaDeposito.Items.Clear()
|
|
'End If
|
|
'RecargaGlobalCuentasBancarias()
|
|
UpnCuentasPago.Update()
|
|
UpCuentaDeposito.Update()
|
|
End Sub
|
|
Private Sub RecargaCuentasDepositos()
|
|
|
|
Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) 'Egs o Ing
|
|
If dr IsNot Nothing Then
|
|
HdnTipoTransaccion.Value = dr("Tipo").ToString
|
|
HdnTipoTransaccionAbreviatura.Value = dr("Abreviatura").ToString
|
|
End If
|
|
'cuando es transferencia bancaria, debe de solicitar a que cuenta se va a depositar
|
|
CargaCuentasDepositos()
|
|
End Sub
|
|
|
|
Protected Sub DdlCuentaDeposito_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
|
|
Dim dtc As DataTable = GlobalDTProveedoresCuentas(UsuarioActual.CveEmpresa, CveProveedor:=CveProveedor, CveCuentaDeposito:=DdlCuentaDeposito.SelectedValue.ToEntero)
|
|
If dtc IsNot Nothing AndAlso dtc.Rows.Count = 1 Then
|
|
|
|
If dtc.Rows.Count > 0 Then
|
|
|
|
If dtc.Rows(0)("TieneCIE").ToString.ToEntero = 1 Then
|
|
|
|
TrReferenciaCIE.Visible = True
|
|
|
|
TxtReferenciaCIE.Text = dtc.Rows(0)("Referencia").ToString
|
|
TxtConceptoCIE.Text = dtc.Rows(0)("ConceptoCIE").ToString
|
|
|
|
OriReferenciaCIE = dtc.Rows(0)("Referencia").ToString
|
|
OriConceptoCIE = dtc.Rows(0)("ConceptoCIE").ToString
|
|
|
|
Else
|
|
TrReferenciaCIE.Visible = False
|
|
End If
|
|
|
|
|
|
If Boolean.Parse(dtc.Rows(0)("EstatusPagoElectronicoGrupos").ToString) = True AndAlso dtc.Rows(0)("CveSATBanco").ToString.ToEntero <= 0 Then
|
|
|
|
Alert("Es necesario establecer el banco de la cuenta deposito", TipoMensaje.MsgAdvertencia)
|
|
BtnIEGuardar.Enabled = False
|
|
|
|
Else
|
|
BtnIEGuardar.Enabled = True
|
|
End If
|
|
|
|
Else
|
|
TrReferenciaCIE.Visible = False
|
|
End If
|
|
|
|
Else
|
|
TrReferenciaCIE.Visible = False
|
|
End If
|
|
|
|
UpCuentaDeposito.Update()
|
|
UpGuardar.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
Protected Sub DdllOtrosPagos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlOtrosPagos.SelectedIndexChanged
|
|
|
|
If DdlOtrosPagos.SelectedValue <> "-1" Then
|
|
DdlProsepago.Visible = False
|
|
TxtOtrosImportes.Visible = True
|
|
TxtTotal.Visible = True
|
|
GvCxP.Columns(13).Visible = True
|
|
Else
|
|
DdlProsepago.Visible = False
|
|
TxtOtrosImportes.Visible = False
|
|
TxtTotal.Visible = False
|
|
GvCxP.Columns(13).Visible = False
|
|
TxtOtrosImportes.Text = ""
|
|
TxtTotal.Text = ""
|
|
RegistraScript("$get('TxtImporte').value = FormatoNumero(SumaValores(), 2);")
|
|
End If
|
|
|
|
UpDatos.Update()
|
|
UPCompras.Update()
|
|
End Sub
|
|
|
|
|
|
#Region " PAGAR CON PESOS "
|
|
Protected Sub ChkPagarPesos_CheckedChanged(sender As Object, e As EventArgs)
|
|
If ChkPagarPesos.Checked Then
|
|
DivTC.Visible = True
|
|
DivDolaresDolares.Visible = False
|
|
CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
|
|
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
|
|
TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
|
|
Else
|
|
DivTC.Visible = False
|
|
DivDolaresDolares.Visible = True
|
|
CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
|
|
TxtFechaDocumento.Attributes.Remove("onchange")
|
|
End If
|
|
UpDatos.Update()
|
|
|
|
RegistraScript("CambiaPesosDolares();")
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "PAGAR CON DOLARES"
|
|
Protected Sub ChkPagarDolares_CheckedChanged(sender As Object, e As EventArgs)
|
|
If ChkPagarDolares.Checked Then
|
|
DivTCDolares.Visible = True
|
|
DivDolaresDolares.Visible = False
|
|
CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
|
|
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
|
|
TxtTCDolares.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
|
|
Else
|
|
DivTCDolares.Visible = False
|
|
DivDolaresDolares.Visible = False
|
|
CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
|
|
TxtFechaDocumento.Attributes.Remove("onchange")
|
|
End If
|
|
UpDatos.Update()
|
|
|
|
RegistraScript("CambiaDolaresPesos();")
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " NOTIFICACION PAGO "
|
|
|
|
|
|
Private Sub EnviarCorreoNotificacion(CveIENotificar As Integer, CorreoNotificarA As String, CopiaPara As String, UsuarioActualNotificar As Usuario, MostarAlert As Boolean)
|
|
|
|
Try
|
|
Dim Hilo As New Threading.Thread(Sub() EnviarCorreoNotifiMandaCorreocacionHilo(CveIENotificar, CorreoNotificarA, CopiaPara, UsuarioActualNotificar))
|
|
'Dim Hilo As New Threading.Thread( EnviarCorreoNotifiMandaCorreocacionHilo(CveIENotificar, CorreoNotificarA, CopiaPara, UsuarioActualNotificar))
|
|
Hilo.Start()
|
|
|
|
If MostarAlert Then
|
|
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
|
|
If MostarAlert Then
|
|
Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub EnviarCorreoNotifiMandaCorreocacionHilo(CveIENotificar As Integer, CorreoNotificarA As String, CopiaPara As String, UsuarioActualNotificar As Usuario)
|
|
|
|
|
|
Try
|
|
Dim ObjBancos As New ClsBancos()
|
|
|
|
If ObjBancos.NotificacionPago(CveIENotificar, CorreoNotificarA, CopiaPara, UsuarioActualNotificar) Then
|
|
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
|
Else
|
|
Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError)
|
|
End If
|
|
|
|
ObjBancos.Dispose()
|
|
Catch ex As Exception
|
|
GuardaLog("Error al enviar notificación de pago ProveedoresAbonar --> " & ex.StackTrace.ToString)
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "SALDAR CUENTAS"
|
|
|
|
|
|
Private Sub BtnSaldarCuentasSinPagar_Click(sender As Object, e As EventArgs) Handles BtnSaldarCuentasSinPagar.Click
|
|
Dim ObjConta As New ClsContabilidad
|
|
ObjConta.IniciaTransacSQL()
|
|
Dim CvePrePoliza As Integer = 0
|
|
Dim MsgError As String = ""
|
|
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
|
|
|
|
Dim EsContabilizable As Boolean = If(UsuarioActual.CveEmpresa.Contiene(13, 83), False, True)
|
|
|
|
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/ProveedoresAbonar/Saldar", 98, 0, 0, 1, TxtFechaIncobrable.Text.ToDate, "Saldado de facturas", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
|
For Each gr As GridViewRow In GvCxP.Rows
|
|
If gr.FCCheckBox("Chk").Checked Then
|
|
Dim Saldo As Decimal = gr.DataKey("Saldo").ToDecimal
|
|
Dim TCCompra As Decimal = gr.DataKey("TipoCambio").ToDecimal
|
|
Dim TCPago As Decimal = GlobalTipoCambio(TxtFechaIncobrable.Text.ToDate).ToDecimal
|
|
Dim CveMoneda As Integer = gr.DataKey("CveMoneda").ToEntero
|
|
Dim FechaCompra As Date = gr.DataKey("Fecha").ToDate
|
|
Dim CveSubProyecto As Integer = gr.DataKey("CveSubProyecto").ToEntero
|
|
Dim UsaComplementariaProveedores As Boolean = If(UsuarioActual.CveEmpresa.Contiene(119, 158), True, False)
|
|
|
|
Dim CveConceptoContablePago As Integer = 17
|
|
If gr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoContablePago = 308 'cuando es acreedor
|
|
If CveMoneda <> 1 Then
|
|
Select Case CveConceptoContablePago
|
|
Case 17
|
|
CveConceptoContablePago = 312
|
|
Case 308
|
|
CveConceptoContablePago = 309
|
|
Case Else
|
|
End Select
|
|
End If
|
|
|
|
Dim CveConceptoContableComplementaria As Integer = 206
|
|
If gr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoContableComplementaria = 310 'cuando es acreedor
|
|
|
|
Dim ConceptoPartida As String = String.Format("Saldar compra {0}", gr.DataKey("SerieFolio").ToString)
|
|
|
|
|
|
If CveMoneda > 1 AndAlso (UsaComplementariaProveedores) Then
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, 0.00D, (Saldo * TCCompra - Saldo).RoundSQL, CveConceptoContableComplementaria, gr.DataKey("SerieFolio").ToString, ConceptoPartida, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteME:=Saldo, TipoCambio:=TCCompra, Contabilizable:=EsContabilizable) Then
|
|
MsgError = "No se pudo insertar la póliza"
|
|
End If
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Saldo, Saldo, CveConceptoContablePago, gr.DataKey("SerieFolio").ToString, ConceptoPartida, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra, ImporteME:=If(CveMoneda > 1, Saldo, 0), Contabilizable:=EsContabilizable) Then
|
|
MsgError = "Ocurrio un error al saldar el movimiento"
|
|
End If
|
|
Else
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Saldo, If(CveMoneda = 1, Saldo, Saldo * TCCompra), CveConceptoContablePago, gr.DataKey("SerieFolio").ToString, ConceptoPartida, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteME:=If(CveMoneda > 1, Saldo, 0), TipoCambio:=TCCompra, Contabilizable:=EsContabilizable) Then
|
|
MsgError = "Ocurrio un error al saldar el movimiento"
|
|
End If
|
|
End If
|
|
Dim PorcentajePago As Decimal = gr.DataKey("Saldo").ToDecimal / gr.DataKey("TotalOriginal").ToDecimal
|
|
|
|
If MsgError = "" AndAlso gr.DataKey("IVA").ToDecimal > 0 Then
|
|
Dim PorcentajeImpuesto As Decimal = gr.DataKey("PorcentajeIVA").ToDecimal
|
|
Dim IVA As Decimal = PorcentajePago * gr.DataKey("IVA").ToDecimal
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, If(CveMoneda = 1, IVA, IVA * If(FuncionalidadFluctuacionImpuestos, TCPago, TCCompra)), 14, gr.DataKey("SerieFolio").ToString, ConceptoPartida, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=EsContabilizable) Then
|
|
MsgError = "Ocurrio un error al saldar el movimiento"
|
|
End If
|
|
Saldo = Saldo - IVA
|
|
End If
|
|
|
|
If MsgError = "" AndAlso gr.DataKey("IEPS").ToDecimal > 0 Then
|
|
|
|
Dim IEPS As Decimal = PorcentajePago * gr.DataKey("IEPS").ToDecimal
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, If(CveMoneda = 1, IEPS, IEPS * If(FuncionalidadFluctuacionImpuestos, TCPago, TCCompra)), 25, gr.DataKey("SerieFolio").ToString, ConceptoPartida, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, Contabilizable:=EsContabilizable) Then
|
|
MsgError = "Ocurrio un error al saldar el movimiento"
|
|
End If
|
|
Saldo = Saldo - IEPS
|
|
End If
|
|
|
|
' se manda al ot ingresos, los impuestos por acreditar
|
|
If MsgError = "" Then
|
|
Dim tcvecon As Integer = 78
|
|
If Saldo < 0 Then
|
|
tcvecon = 211
|
|
End If
|
|
If MsgError = "" AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Saldo, If(CveMoneda = 1, Saldo, Saldo * TCPago), tcvecon, gr.DataKey("SerieFolio").ToString, ConceptoPartida, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto, Contabilizable:=EsContabilizable) Then
|
|
MsgError = "Ocurrio un error al saldar el movimiento"
|
|
End If
|
|
End If
|
|
|
|
'fluctuación.
|
|
If CveMoneda > 1 Then
|
|
Dim ImporteFluctuacion As Decimal = 0
|
|
ImporteFluctuacion = Saldo * (TCPago - TCCompra)
|
|
|
|
If CveSubProyecto <= 0 Then
|
|
MsgError = "No se pudo obtener el sub proyecto o centro de costo"
|
|
End If
|
|
|
|
If TCCompra > TCPago Then
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), Math.Abs(ImporteFluctuacion), 64, gr.DataKey("SerieFolio").ToString, ConceptoPartida, CveSubProyecto:=CveSubProyecto, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra, TipoCambioPago:=TCPago, Contabilizable:=EsContabilizable) Then
|
|
MsgError = "Ocurrio un error al saldar el movimiento"
|
|
End If
|
|
Else
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), Math.Abs(ImporteFluctuacion), 65, gr.DataKey("SerieFolio").ToString, ConceptoPartida, CveSubProyecto:=CveSubProyecto, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra, TipoCambioPago:=TCPago, Contabilizable:=EsContabilizable) Then
|
|
MsgError = "Ocurrio un error al saldar el movimiento"
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
Next
|
|
|
|
If MsgError.Trim.Length = 0 AndAlso CvePrePoliza > 0 Then
|
|
If MsgError = "" AndAlso ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, 5) Then
|
|
If ObjConta.ValorPolizaDescuadre > 0 Then
|
|
MsgError = ObjConta.MensajePolizaDescuadre + " " + ObjConta.ValorDiferencia
|
|
GuardaLogAD($"Bancos/ProveedoresAbonar | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
|
|
If MsgError = "" Then
|
|
ObjConta.Commit()
|
|
CargaDatos(CveMoneda)
|
|
RegistraScript("$('#ModalSaldarCuentaSinPagar').modal('hide')")
|
|
Alert("Los movimientos se saldaron correctamente.")
|
|
Else
|
|
ObjConta.RollBack()
|
|
Alert(MsgError, TipoMensaje.MsgError)
|
|
End If
|
|
|
|
'BtnSaldar.Visible = False
|
|
ObjConta.Dispose()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "GENERAR SOLICITUD"
|
|
Protected Sub LnkPDFSolicitud_Click(sender As Object, e As EventArgs)
|
|
GenerarPDFSolicitud("PDF")
|
|
End Sub
|
|
Protected Sub LnkExcelSolicitud_Click(sender As Object, e As EventArgs)
|
|
GenerarPDFSolicitud("EXCEL")
|
|
End Sub
|
|
Private Sub GenerarPDFSolicitud(Opcion As String)
|
|
If DtDatos.Rows.Count > 0 Then
|
|
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
|
|
|
Dim StrImporte As String = DtDatos.Rows(0)("Saldo").ToString.FormatoNumero
|
|
Dim params As New List(Of ReportParameter)
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToString))
|
|
params.Add(New ReportParameter("Sucursal", DtDatos.Rows(1)("SubProyecto").ToString))
|
|
params.Add(New ReportParameter("Importe", $"${StrImporte}"))
|
|
params.Add(New ReportParameter("RazonSocial", TxtPagueseA.Text))
|
|
params.Add(New ReportParameter("Fecha", TxtFechaDocumento.Text))
|
|
Dim Transferencia As String = "", Banco As String = "", CLABE As String = "", Cuenta As String = "", Correo As String = ""
|
|
If DdlTipoTransaccion.SelectedValue.Contiene("2", "8") Then Transferencia = "Si" Else Transferencia = "No"
|
|
If DdlCuentaDeposito.SelectedValue.ToEntero > 0 Then
|
|
Dim dtt As DataTable = GlobalDTProveedoresCuentas(UsuarioActual.CveEmpresa, CveProveedor, CveCuentaDeposito:=DdlCuentaDeposito.SelectedValue.ToEntero)
|
|
If dtt.Rows.Count > 0 Then
|
|
Banco = dtt.Rows(0)("BancoNombre").ToString
|
|
CLABE = dtt.Rows(0)("CLABE").ToString
|
|
Cuenta = dtt.Rows(0)("Cuenta").ToString
|
|
Correo = dtt.Rows(0)("Correo").ToString
|
|
End If
|
|
End If
|
|
|
|
params.Add(New ReportParameter("Transferencia", Transferencia))
|
|
params.Add(New ReportParameter("Banco", Banco))
|
|
params.Add(New ReportParameter("CLABE", CLABE))
|
|
params.Add(New ReportParameter("Cuenta", Cuenta))
|
|
params.Add(New ReportParameter("Correo", Correo))
|
|
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
|
Dim NombreArchivo As String = "SolicitudPago" ''String.Format("SolicitudPago{0}.pdf", TxtPagueseA.Text).Replace(" ", "")
|
|
ImprimirPDF("Empresas/Grales/Formatos/Solicitud.rdlc", DtDatos, params, NombreArchivo, Opcion)
|
|
Else
|
|
Alert("No se encontraron datos.", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
Private Sub RVTxtFechaDocumento_Init(sender As Object, e As EventArgs) Handles RVTxtFechaDocumento.Init
|
|
RVTxtFechaDocumento.MaximumValue = NowADS().ToShortDateString
|
|
RVTxtFechaDocumentoMenor.MinimumValue = NowADS().AddMonths(-18).ToShortDateString
|
|
RVTxtFechaDocumentoMenor.MaximumValue = NowADS().ToShortDateString
|
|
Calendario.EndDate = NowADS()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub chkaplicaDescuento_CheckedChanged(sender As Object, e As EventArgs)
|
|
|
|
GvCxP.Columns(11).Visible = chkaplicaDescuento.Checked
|
|
UPCompras.Update()
|
|
|
|
End Sub
|
|
End Class
|
|
|