1968 lines
132 KiB
VB.net
1968 lines
132 KiB
VB.net
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class Compras_ReembolsosComprobaciones
|
|
Inherits ClsPaginas
|
|
|
|
#Region "Propiedades"
|
|
Private ReadOnly Property CveCajaChica As Integer
|
|
Get
|
|
Return ViewState("CveCajaChica").ToString.ToEntero
|
|
End Get
|
|
End Property
|
|
Private ReadOnly Property CvePersonal As Integer
|
|
Get
|
|
Return ViewState("CvePersonal").ToString.ToEntero
|
|
End Get
|
|
End Property
|
|
Private Property CveMoneda As Integer
|
|
Get
|
|
Return ViewState("CveMoneda").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveMoneda") = value
|
|
End Set
|
|
End Property
|
|
Private Property IdCuentaBancaria As Integer
|
|
Get
|
|
Return ViewState("IdCuentaBancaria").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("IdCuentaBancaria") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveCuentaBancaria As Integer
|
|
Get
|
|
Return ViewState("CveCuentaBancaria").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCuentaBancaria") = value
|
|
End Set
|
|
End Property
|
|
Private Property NumeroReembolso As String
|
|
Get
|
|
NumeroReembolso = ViewState("NumeroReembolso").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("NumeroReembolso") = value
|
|
End Set
|
|
End Property
|
|
Private Property DtDatos As DataTable
|
|
Get
|
|
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
|
|
End Get
|
|
|
|
Set(ByVal value As DataTable)
|
|
ViewState("DtDatos") = value
|
|
End Set
|
|
End Property
|
|
Private Property DtCheques As DataTable
|
|
Get
|
|
Return CType(ViewState("DtCheques"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtCheques") = value
|
|
End Set
|
|
End Property
|
|
Private Property Folio As String
|
|
Get
|
|
Folio = ViewState("Folio").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("Folio") = 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
|
|
TxtImporte.Attributes.Add("disabled", "disabled")
|
|
TxtAboneA.Enabled = False
|
|
CveCuentaBancaria = -1
|
|
ViewState("CveMoneda") = 1
|
|
Folio = ""
|
|
|
|
'Cargar Filtros
|
|
Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario)
|
|
dt = dt.FiltraParametros(String.Format("CveTipoCuenta = 1")) 'caja chica = 1
|
|
DdlCajaChica.DataSource = dt
|
|
DdlCajaChica.DataBind()
|
|
|
|
Dim ObjPersonal As New ClsRH
|
|
ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa)
|
|
DdlPersonal.DataSource = ObjPersonal.DtResultados.FiltraParametros("CveEstatusPersonal = 1")
|
|
ObjPersonal.Dispose()
|
|
DdlPersonal.DataBind()
|
|
|
|
CargaTipoTransaccion()
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(506) = "1" Then
|
|
CbPermitirExcedente.Visible = True
|
|
Else
|
|
CbPermitirExcedente.Visible = False
|
|
End If
|
|
|
|
If UsuarioActual.CveEmpresa.Contiene(1, 4, 7, 11, 12, 72, 80, 119) Then
|
|
rowComisiones.Visible = True
|
|
End If
|
|
|
|
If UsuarioActual.CveEmpresa = 119 Then
|
|
ChkReembolsarSinBancos.Visible = True
|
|
End If
|
|
|
|
TxtFechaPrePoliza.Text = Date.Now.ToShortDateString
|
|
|
|
'CargaCuentasDiferencia()
|
|
|
|
'TableDiferencia.Visible = False
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#Region " FILTROS "
|
|
Protected Sub DdlTipoPago_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
|
|
PnlCheques.Visible = False
|
|
PnlChequeInfo.Visible = False
|
|
TableExpedirCheque.Visible = False
|
|
|
|
ViewState("CveCajaChica") = -2
|
|
ViewState("CvePersonal") = -2
|
|
|
|
LtTituloPago.Text = ""
|
|
|
|
If DdlTipoPago.SelectedValue = "1" Then
|
|
DdlPersonal.Visible = True
|
|
DdlPersonal.SelectedValue = "-2"
|
|
If UsuarioActual.CveRol = 1 Then ChkAplicaViatico.Visible = True
|
|
LtTituloPago.Text = "Viaticos - Personal:"
|
|
|
|
'Valida Proceso 120 para ROL Administrador de obra - para FyE solo puede ver los del UsuarioActual
|
|
If UsuarioActual.TienePermisoProceso(120) Then
|
|
If UsuarioActual.CvePersonal > 0 Then
|
|
DdlPersonal.SelectedValue = UsuarioActual.CvePersonal.ToString
|
|
ViewState("CvePersonal") = UsuarioActual.CvePersonal
|
|
End If
|
|
DdlPersonal.Enabled = False
|
|
End If
|
|
Else
|
|
DdlPersonal.Visible = False
|
|
DdlPersonal.SelectedValue = "-2"
|
|
ChkAplicaViatico.Visible = False
|
|
DdlPersonal.Enabled = True
|
|
End If
|
|
|
|
If DdlTipoPago.SelectedValue = "2" Then
|
|
DdlCajaChica.Visible = True
|
|
DdlCajaChica.SelectedValue = "-2"
|
|
LtTituloPago.Text = "Caja Chica:"
|
|
Else
|
|
DdlCajaChica.Visible = False
|
|
DdlCajaChica.SelectedValue = "-2"
|
|
End If
|
|
|
|
LimpiaDatos()
|
|
|
|
GvChequesFYE.Visible = False
|
|
UpChequesFYE.Update()
|
|
|
|
GvCxP.Visible = False
|
|
UPCompras.Update()
|
|
|
|
'CargaCxP()
|
|
|
|
End Sub
|
|
|
|
Protected Sub DdlPersonal_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPersonal.SelectedIndexChanged
|
|
ViewState("CvePersonal") = DdlPersonal.SelectedValue
|
|
End Sub
|
|
|
|
Protected Sub DdlCajaChica_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCajaChica.SelectedIndexChanged
|
|
ViewState("CveCajaChica") = DdlCajaChica.SelectedValue
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region " CARGA DATOS "
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
LimpiaDatos()
|
|
CargaCxP()
|
|
|
|
If UsuarioActual.TienePermisoProceso(113) Then CargaReporteChequesFYE()
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaDatos(tCveIE As Integer)
|
|
Dim ObjIE As New ClsBancos()
|
|
|
|
If ObjIE.GetBancosIE(tCveIE, UsuarioActual.CveEmpresa) Then
|
|
If ObjIE.DtResultados.Rows.Count > 0 Then
|
|
|
|
LtChequeFecha.Text = ObjIE.FechaDocumento.ToShortDateString
|
|
TxtFechaPrePoliza.Text = ObjIE.FechaDocumento.ToShortDateString
|
|
|
|
HlCheque.Text = ObjIE.Folio
|
|
HlCheque.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", tCveIE)
|
|
|
|
HdnCheque.Value = tCveIE.ToString
|
|
LtChequeImporte.Text = ObjIE.Importe.FormatoNumero
|
|
|
|
Dim IndexCheque = If(UsuarioActual.TienePermisoProceso(113), DDlCheques.SelectedIndex - 1, DDlCheques.SelectedIndex)
|
|
|
|
TxtChequeSaldo.Text = DtCheques.Rows(DDlCheques.SelectedIndex - 1)("Saldo").ToString.FormatoNumero
|
|
|
|
|
|
Else
|
|
Alert("El Documento solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ObjIE.Dispose()
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaTipoTransaccion()
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs'") 'Ing
|
|
DdlTipoTransaccion.DataBind()
|
|
DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1"))
|
|
|
|
'DdlTipoTransaccionDiferencia.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs'") 'Ing
|
|
'DdlTipoTransaccionDiferencia.DataBind()
|
|
'DdlTipoTransaccionDiferencia.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1"))
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaCuentas()
|
|
DdlCuenta.Items.Clear()
|
|
DdlCuenta.SelectedIndex = -1
|
|
Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario)
|
|
|
|
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1))
|
|
DdlCuenta.DataSource = dt
|
|
DdlCuenta.DataBind()
|
|
DdlCuenta.Items.Insert(0, New ListItem("Seleccione cuenta", "-1"))
|
|
End Sub
|
|
|
|
Protected Sub ChkAjusteOI_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ChkAjusteOI.CheckedChanged
|
|
|
|
If ChkAjusteOI.Checked Then
|
|
TxtOtrosImportes.Visible = True
|
|
TxtTotal.Visible = True
|
|
GvCxP.Columns(15).Visible = True
|
|
Else
|
|
TxtOtrosImportes.Visible = False
|
|
TxtTotal.Visible = False
|
|
GvCxP.Columns(15).Visible = False
|
|
TxtOtrosImportes.Text = ""
|
|
TxtTotal.Text = ""
|
|
RegistraScript("$get('TxtImporte').value = FormatoNumero(SumaValores(), 2);")
|
|
End If
|
|
|
|
UpDatos.Update()
|
|
UPCompras.Update()
|
|
End Sub
|
|
|
|
Protected Sub ChkOtrosIngresosCheque_CheckedChanged(sender As Object, e As EventArgs)
|
|
|
|
If ChkOtrosIngresosCheque.Checked Then
|
|
TxtOtrosImportes.Visible = True
|
|
TxtTotal.Visible = True
|
|
GvCxP.Columns(15).Visible = True
|
|
Else
|
|
TxtOtrosImportes.Visible = False
|
|
TxtTotal.Visible = False
|
|
GvCxP.Columns(15).Visible = False
|
|
TxtOtrosImportes.Text = ""
|
|
TxtTotal.Text = ""
|
|
RegistraScript("$get('TxtImporte').value = FormatoNumero(SumaValores(), 2);")
|
|
End If
|
|
|
|
UpDatos.Update()
|
|
UPCompras.Update()
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region " SELECTED INDEX CHANGED "
|
|
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).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue)
|
|
|
|
If dr IsNot Nothing Then
|
|
CveMoneda = dr("CveMoneda").ToString.ToEntero
|
|
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG Then CveCuentaBancaria = dr("IdCtaContableSIG").ToString.ToEntero
|
|
End If
|
|
|
|
If HdnTipoTransaccion.Value = "Egs" 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
|
|
End Sub
|
|
|
|
Protected Sub DdlTipoTransaccion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoTransaccion.SelectedIndexChanged
|
|
Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue))
|
|
If dr IsNot Nothing Then
|
|
HdnTipoTransaccion.Value = dr("Tipo").ToString
|
|
End If
|
|
CargaCuentas()
|
|
End Sub
|
|
|
|
Protected Sub DDlCheques_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DDlCheques.SelectedIndexChanged
|
|
|
|
If DDlCheques.SelectedValue.ToEntero > 0 Then
|
|
|
|
PnlChequeInfo.Visible = True
|
|
|
|
ChkOtrosIngresosCheque.Visible = True
|
|
|
|
If UsuarioActual.TienePermisoProceso(113) Then TrChequeExcedente.Visible = True
|
|
|
|
CargaDatos(DDlCheques.SelectedValue.ToEntero)
|
|
|
|
LimpiaDatos()
|
|
TableExpedirCheque.Visible = False
|
|
|
|
Else
|
|
|
|
HlCheque.Text = ""
|
|
HlCheque.NavigateUrl = ""
|
|
|
|
HdnCheque.Value = "-1"
|
|
|
|
ChkOtrosIngresosCheque.Visible = False
|
|
|
|
If UsuarioActual.TienePermisoProceso(113) Then TableExpedirCheque.Visible = True
|
|
|
|
LimpiaDatos()
|
|
|
|
ChkChequeExcedente.Checked = False
|
|
PnlChequeInfo.Visible = False
|
|
|
|
'DdlTipoTransaccion.Enabled = True
|
|
'DdlCuenta.Enabled = True
|
|
'TxtChequeSaldo.Text = ""
|
|
'LimpiaDatos()
|
|
End If
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " BTN GUARDAR "
|
|
Protected Sub BtnIEGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click
|
|
|
|
If HdnCheque.Value.ToEntero > 0 And ChkChequeExcedente.Checked And TxtImporte.Text.ToDecimal = 0 Then
|
|
Alert("El importe del cheque excedente debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
If TxtImporte.Text.ToDecimal + TxtImporteVinculado.Text.ToDecimal <= 0 Then
|
|
Alert("El Importe debe de ser mayor a $0.00", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim ObjIE As New ClsBancos()
|
|
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
|
|
Dim MsgError As String = ""
|
|
|
|
Dim CveIEExcedente As Integer = -1
|
|
Dim CvePrePolizaExcedente As Integer = 0
|
|
|
|
Dim CveIERegistrado As Integer = 0
|
|
Dim CveIECajaChica As Integer = 0
|
|
Dim CvePrePolizaIERegistrado As Integer = 0
|
|
Dim IdPoliza As Integer = 0
|
|
|
|
Dim CveIEPago As Integer = 0
|
|
Dim CvePrePolizaPago As Integer = 0
|
|
Dim CvePrePolizaPagoOriginal As Integer = 0
|
|
Dim IdCtaPersonal As Integer = -1
|
|
|
|
Dim CvePersonal As Integer = If(DdlPersonal.Visible AndAlso DdlPersonal.SelectedValue.ToEntero > 0, DdlPersonal.SelectedValue.ToEntero, 0)
|
|
If CvePersonal > 0 Then
|
|
IdCtaPersonal = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContPersonal", String.Format("CvePersonal = {0}", CvePersonal)).ToEntero
|
|
End If
|
|
|
|
Dim tipoCambio As Decimal = 1
|
|
Dim drp As DataRow = DtCheques.FiltroPrimero($"CveIE = {DDlCheques.SelectedValue.ToEntero}")
|
|
|
|
'AGARRA CONFIGURACIONES
|
|
If CveMoneda = 2 Then
|
|
tipoCambio = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToString.ToDecimal
|
|
Else
|
|
tipoCambio = 1
|
|
End If
|
|
|
|
Dim UsaSimplificacionCajaChica As Boolean = False
|
|
If UsuarioActual.CveEmpresa = 119 Then UsaSimplificacionCajaChica = True
|
|
|
|
|
|
|
|
Dim concepto As String = "Compras: "
|
|
|
|
For Each Gvr As GridViewRow In GvCxP.Rows
|
|
|
|
Dim chkPago As CheckBox = Gvr.FCCheckBox("Chk")
|
|
|
|
If chkPago.Checked Then
|
|
concepto = concepto & $" {Gvr.DataKey("SerieFolio").ToString }"
|
|
End If
|
|
|
|
Next
|
|
|
|
|
|
If HdnCheque.Value.ToEntero > 0 AndAlso Not ChkReembolsarSinBancos.Checked Then
|
|
CveIERegistrado = DDlCheques.SelectedValue.ToEntero
|
|
|
|
|
|
If UsuarioActual.CveEmpresa.Contiene(119) Then
|
|
CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporteVinculado.Text.ToDecimal, TxtImporteVinculado.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
If CveCajaChica > 0 Then
|
|
If ObjMov.GetRetCuenta(30, CveCajaChica) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG Then CveCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
Dim FolioIENew = ObjIE.GetNextFolio(If(CveCajaChica > 0, CveCajaChica, CvePersonal), 8).ToString
|
|
CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 8, TxtFechaDocumento.Text.Trim.ToDate, FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporteVinculado.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
|
|
'AGREGO PREPOLIZA IE BANCOS
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporteVinculado.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporteVinculado.Text.ToDecimal), ImporteMX:=TxtImporteVinculado.Text.ToDecimal * tipoCambio) Then
|
|
MsgError = "Error al registrar detalle de concepto bancario"
|
|
End If
|
|
Else
|
|
'AGREGO PREPOLIZA FyE
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporteVinculado.Text.ToDecimal, TxtObservaciones.Text, 29, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCtaPersonal, -1, CvePersonal:=CvePersonal, CveIE:=CveIERegistrado, ImporteME:=If(tipoCambio = 1, 0, TxtImporteVinculado.Text.ToDecimal), ImporteMX:=TxtImporteVinculado.Text.ToDecimal * tipoCambio) Then
|
|
MsgError = "Error al registrar detalle de concepto bancario"
|
|
End If
|
|
End If
|
|
Else
|
|
If drp IsNot Nothing Then
|
|
If drp("IdPoliza").ToString.ToEntero > 0 Then
|
|
CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporteVinculado.Text.ToDecimal, TxtImporteVinculado.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
IdPoliza = drp("IdPoliza").ToString.ToEntero
|
|
Else
|
|
CvePrePolizaIERegistrado = drp("CvePrePoliza").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue)
|
|
If dr IsNot Nothing Then
|
|
CveMoneda = dr("CveMoneda").ToString.ToEntero
|
|
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG Then CveCuentaBancaria = dr("IdCtaContableSIG").ToString.ToEntero
|
|
End If
|
|
|
|
If ChkChequeExcedente.Checked Then
|
|
CvePrePolizaExcedente = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
CveIEExcedente = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaExcedente, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False))
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, If(CveCajaChica > 0, 30, 29), TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEExcedente, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then
|
|
MsgError = "Error al registrar detalle de concepto bancario"
|
|
End If
|
|
End If
|
|
ElseIf Not ChkReembolsarSinBancos.Checked Then
|
|
CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
CveIERegistrado = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False))
|
|
|
|
'AGREGO PREPOLIZA IE BANCOS
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then
|
|
MsgError = "Error al registrar detalle de concepto bancario"
|
|
End If
|
|
|
|
'SI ES CAJA CHICA REGISTRO IE CAJA CHICA
|
|
If CveCajaChica > 0 Then
|
|
If ObjMov.GetRetCuenta(30, CveCajaChica) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG Then CveCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
Dim FolioIENew = ObjIE.GetNextFolio(If(CveCajaChica > 0, CveCajaChica, CvePersonal), 8).ToString
|
|
CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 8, TxtFechaDocumento.Text.Trim.ToDate, FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporte.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
|
|
|
|
'AGREGO PREPOLIZA IE BANCOS
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, False, TxtImporte.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio, Contabilizable:=Not UsaSimplificacionCajaChica) Then
|
|
MsgError = "Error al registrar detalle de concepto bancario"
|
|
End If
|
|
Else
|
|
Dim Importe28 As Decimal = TxtImporte.Text.ToDecimal
|
|
If chkajusteoi.checked Then
|
|
Importe28 = txttotal.text.todecimal
|
|
End If
|
|
'AGREGO PREPOLIZA FyE
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, False, Importe28, TxtObservaciones.Text, 28, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCtaPersonal, -1, CvePersonal:=CvePersonal, CveIE:=CveIERegistrado, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=Importe28 * tipoCambio, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then
|
|
MsgError = "Error al registrar detalle de concepto bancario"
|
|
End If
|
|
End If
|
|
|
|
Else
|
|
CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
'SI ES CAJA CHICA REGISTRO IE CAJA CHICA
|
|
If CveCajaChica > 0 Then
|
|
If ObjMov.GetRetCuenta(30, CveCajaChica) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG Then CveCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
Dim FolioIENew = ObjIE.GetNextFolio(If(CveCajaChica > 0, CveCajaChica, CvePersonal), 8).ToString
|
|
CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 8, TxtFechaDocumento.Text.Trim.ToDate, FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporte.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
|
|
'AGREGO PREPOLIZA IE BANCOS
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporte.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then
|
|
MsgError = "Error al registrar detalle de concepto bancario"
|
|
End If
|
|
Else
|
|
'AGREGO PREPOLIZA FyE
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 29, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCtaPersonal, -1, CvePersonal:=CvePersonal, CveIE:=CveIERegistrado, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then
|
|
MsgError = "Error al registrar detalle de concepto bancario"
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
If CveIERegistrado > 0 Or CveIEExcedente > 0 Or ChkReembolsarSinBancos.Checked Then
|
|
'inserto los movimientos de la conta para abonar al saldo
|
|
If ((TxtImporte.Text.ToDecimal > 0 Or ChkReembolsarSinBancos.Checked) And CvePrePolizaIERegistrado > 0) Or ((TxtImporteVinculado.Text.ToDecimal > 0 And HdnCheque.Value.ToEntero > 0) Or ChkReembolsarSinBancos.Checked) Then
|
|
Dim SaldoCheque = If(HdnCheque.Value.ToEntero > 0, TxtChequeSaldo.Text.ToDecimal, TxtImporte.Text.ToDecimal)
|
|
Dim ImportePagar = 0.0
|
|
Dim ImporteOriginal = 0.0
|
|
Dim ImporteMovto = 0.0
|
|
Dim PorcentajePago As Decimal = 1
|
|
|
|
Dim FechaMovimiento As Date = TxtFechaDocumento.Text.ToDate
|
|
Dim ConceptoMovimiento As String = ""
|
|
Dim Referencia As String = ""
|
|
Dim IdCtaProveedor As Integer = 0
|
|
Dim IdCtaIVAxAcreditar As Integer = 0
|
|
Dim IdCtaIVAAcreditable As Integer = 0
|
|
Dim IdCtaRetIVA As Integer = 0
|
|
Dim IdCtaRetISR As Integer = 0
|
|
Dim IdCtaOtrosProductos As Integer = 0
|
|
Dim CvePrePolizaUnificar As Integer = 0
|
|
|
|
'Conta SIG
|
|
Dim CveCuentaProveedor As Integer = 0
|
|
Dim CveCuentaPersonal As Integer = 0
|
|
Dim CveCuentaIVAxAcreditar As Integer = 0
|
|
Dim CveCuentaIVAAcreditable As Integer = 0
|
|
Dim CveCuentaRetIVA As Integer = 0
|
|
Dim CveCuentaRetISR As Integer = 0
|
|
Dim CveCuentaOtrosProductos As Integer = 0
|
|
Dim SeUnifico = False
|
|
|
|
'Obtenemos la cuenta del Personal o Caja Chica
|
|
If CveCajaChica > 0 Then
|
|
If ObjMov.GetRetCuenta(30, CveCajaChica) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG Then CveCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
Else
|
|
If ObjMov.GetRetCuenta(29, CvePersonal) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaPersonal = ObjMov.DtResultados.Rows(0)("IdCtaContPersonal").ToString.ToEntero
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG Then CveCuentaPersonal = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
'Obtenemos la cuenta del IVAxAcreditar
|
|
If ObjMov.GetRetCuenta(14, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaIVAxAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
|
|
CveCuentaIVAxAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
|
|
'Obtenemos la cuenta del IVAAcreditable
|
|
If ObjMov.GetRetCuenta(19, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero
|
|
CveCuentaIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
|
|
'Obtenemos la cuenta del RetIVA
|
|
If ObjMov.GetRetCuenta(15, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaRetIVA = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
CveCuentaRetIVA = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
|
|
'Obtenemos la cuenta del RetISR
|
|
If ObjMov.GetRetCuenta(16, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaRetISR = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
CveCuentaRetISR = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
|
|
'Obtenemos la cuenta del IdCtaOtrosProductos
|
|
If ObjMov.GetRetCuenta(132, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaOtrosProductos = ObjMov.DtResultados.Rows(0)("IdCtaOtrosProductos").ToString.ToEntero
|
|
CveCuentaOtrosProductos = ObjMov.DtResultados.Rows(0)("IdCtaOtrosProductosSIG").ToString.ToEntero
|
|
End If
|
|
End If
|
|
|
|
'inserto las compras que voy a pagar
|
|
For Each gvr As GridViewRow In GvCxP.Rows
|
|
If gvr.FCCheckBox("Chk").Checked Then
|
|
ConceptoMovimiento = $"{gvr.DataKey("Proveedor")} F:{gvr.DataKey("SerieFolio")} {If(DdlPersonal.Visible, DdlPersonal.SelectedItem.Text, DdlCajaChica.SelectedItem.Text)}"
|
|
Referencia = gvr.DataKey("SerieFolio").ToString
|
|
IdCtaProveedor = gvr.DataKey("IdCtaContProveedores").ToEntero
|
|
CveCuentaProveedor = gvr.DataKey("IdCtaContProveedoresSIG").ToEntero
|
|
|
|
ImportePagar = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
|
ImporteOriginal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
|
|
|
If SaldoCheque > 0 Then
|
|
ImporteMovto = If(ImportePagar > SaldoCheque, SaldoCheque, ImportePagar)
|
|
CvePrePolizaPago = CvePrePolizaIERegistrado
|
|
|
|
'SE USARA PARA PODER ELIMINAR UNA COMPROBACION
|
|
CvePrePolizaPagoOriginal = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, ImporteMovto, ImporteMovto, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", $"Compra: { gvr.DataKey("SerieFolio").ToString }", TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
|
'registramos el nuevo IE
|
|
If CveCajaChica > 0 Then
|
|
CveIEPago = 0
|
|
Dim FolioIENew = ObjIE.GetNextFolio(CveCajaChica, 6).ToString
|
|
CveIEPago = ObjIE.AddBancos_IE(CveCajaChica, 6, If(ChkReembolsarSinBancos.Checked, TxtFechaPrePoliza.Text.ToDate, TxtFechaDocumento.Text.ToDate), FolioIENew, gvr.DataKey("Proveedor"), ImporteMovto, CveMoneda, 0.0, $"{gvr.DataKey("Proveedor")} F:{gvr.DataKey("SerieFolio")} {If(DdlPersonal.Visible, DdlPersonal.SelectedItem.Text, DdlCajaChica.SelectedItem.Text)}", "", False, True, -1, CvePrePolizaPago, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
|
|
Else
|
|
CveIEPago = CveIERegistrado
|
|
End If
|
|
|
|
'Otros Ingresos
|
|
If (ChkAjusteOI.Checked Or ChkOtrosIngresosCheque.Checked) AndAlso gvr.FCTextBox("TxtComision").Text.ToDecimal > 0 Then
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, 211, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio, CveCuenta:=CveCuentaProveedor) Then
|
|
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
|
|
End If
|
|
If CveCajaChica > 0 AndAlso Not HdnCheque.Value.ToEntero > 0 Then
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, 211, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio, CveCuenta:=CveCuentaProveedor, Contabilizable:=False) Then
|
|
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
If gvr.DataKey("Original").ToDecimal > 0 Then PorcentajePago = (ImporteMovto / gvr.DataKey("Original").ToDecimal) Else PorcentajePago = 1
|
|
|
|
If Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119)) Then
|
|
'Si es caja chica metemos el concepto 30, si es funcionario metemos 29
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovto, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, DDlCheques.SelectedValue.ToEntero, -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CveCuenta:=CveCuentaPersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
End If
|
|
|
|
'Pago Proveedores
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteMovto, Referencia, 17, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
|
|
If MsgError = "" AndAlso gvr.DataKey("IVA").ToDecimal > 0 Then
|
|
Dim PorcentajeIVA As Decimal = gvr.DataKey("IVAPorcentaje").ToDecimal
|
|
Dim IdCtaContIVAXAcreditar As Integer = 0
|
|
Dim IdCtaContIVAAcreditable As Integer = 0
|
|
Dim IdCtaContIVANoAcreditable As Integer = 0
|
|
|
|
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows.Count > 0 Then
|
|
IdCtaContIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
|
IdCtaContIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
|
IdCtaContIVANoAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVANoAcreditable").ToString.ToEntero
|
|
End If
|
|
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
|
If ImporteMovto = gvr.FCLiteral("LtlSaldo").Text.ToDouble Then
|
|
'Agrego el IVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("IVA").ToDecimal, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal), ImporteMX:=(gvr.DataKey("IVA").ToDecimal) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
|
|
'Agrego el IVA
|
|
If gvr.DataKey("IVADeducible").ToDecimal > 0 Then
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("IVADeducible").ToDecimal, Referencia, 19, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAAcreditable > 0, IdCtaContIVAAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVADeducible").ToDecimal), ImporteMX:=(gvr.DataKey("IVADeducible").ToDecimal) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
End If
|
|
End If
|
|
Else
|
|
'Agrego el IVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
'Agrego el IVA
|
|
If gvr.DataKey("IVADeducible").ToDecimal > 0 Then
|
|
Dim ImporteIVA As Decimal = gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteIVA, Referencia, 19, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAAcreditable > 0, IdCtaContIVAAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteIVA), ImporteMX:=(ImporteIVA) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
If gvr.DataKey("IVANoDeducible").ToDecimal > 0 Then
|
|
|
|
Dim ImporteNOIVA As Decimal = gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteNOIVA, Referencia, 280, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVANoAcreditable > 0, IdCtaContIVANoAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
If MsgError = "" AndAlso gvr.DataKey("RetIVA").ToDecimal > 0 Then
|
|
Dim ConceptoContableRetIVAXAcreditar = 0, ConceptoContableRetIVAAcreditable = 0, IdCtaContableRetIVAXAcreditar = 0, IdCtaContableRetIVAAcreditable = 0
|
|
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
|
|
Case 1
|
|
ConceptoContableRetIVAXAcreditar = 15
|
|
ConceptoContableRetIVAAcreditable = 22
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(307).ToEntero > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(307).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(308).ToEntero > 0 Then
|
|
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(308).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
Case 2
|
|
ConceptoContableRetIVAXAcreditar = 183
|
|
ConceptoContableRetIVAAcreditable = 184
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(309).ToEntero > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(309).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(310).ToEntero > 0 Then
|
|
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(310).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
Case 3
|
|
ConceptoContableRetIVAXAcreditar = 185
|
|
ConceptoContableRetIVAAcreditable = 186
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(311).ToEntero > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(311).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(312).ToEntero > 0 Then
|
|
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(312).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
Case 4
|
|
ConceptoContableRetIVAXAcreditar = 248
|
|
ConceptoContableRetIVAAcreditable = 249
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(313).ToEntero > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(313).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(314).ToEntero > 0 Then
|
|
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(314).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
End Select
|
|
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
|
If ImporteMovto = gvr.FCLiteral("LtlSaldo").Text.ToDouble Then
|
|
'Agrego el RetIVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("RetIVA").ToDecimal, Referencia, ConceptoContableRetIVAXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAXAcreditar, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
|
|
'Agrego el RetIVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("RetIVA").ToDecimal, Referencia, ConceptoContableRetIVAAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAAcreditable, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
End If
|
|
Else
|
|
'Agrego el RetIVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAXAcreditar, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
|
|
'Agrego el RetIVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAAcreditable, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
'If MsgError = "" AndAlso gvr.DataKey("RetISR").ToDecimal > 0 Then
|
|
' Dim ConceptoContableRetISRXAcreditar = 0, ConceptoContableRetISRAcreditable = 0, IdCtaContableRetISRXAcreditar = 0, IdCtaContableRetISRAcreditable = 0
|
|
' Select Case gvr.DataKey("CveRetISRConcepto").ToEntero
|
|
' Case 1
|
|
' ConceptoContableRetISRXAcreditar = 16
|
|
' ConceptoContableRetISRAcreditable = 23
|
|
' If IdCtaRetISR > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = IdCtaRetISR
|
|
' ElseIf UsuarioActual.Empresa.Funcionalidad(315).ToEntero > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = UsuarioActual.Empresa.Funcionalidad(315).ToEntero
|
|
' Else
|
|
' If ObjMov.GetRetCuenta(ConceptoContableRetISRXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
' If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
' End If
|
|
' End If
|
|
' End If
|
|
' If IdCtaRetISR > 0 Then
|
|
' IdCtaContableRetISRAcreditable = IdCtaRetISR
|
|
' ElseIf UsuarioActual.Empresa.Funcionalidad(316).ToEntero > 0 Then
|
|
' IdCtaContableRetISRAcreditable = UsuarioActual.Empresa.Funcionalidad(308).ToEntero
|
|
' Else
|
|
' If ObjMov.GetRetCuenta(ConceptoContableRetISRAcreditable, UsuarioActual.CveEmpresa) Then
|
|
' If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
' IdCtaContableRetISRAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
' End If
|
|
' End If
|
|
' End If
|
|
' Case 2
|
|
' ConceptoContableRetISRXAcreditar = 243
|
|
' ConceptoContableRetISRAcreditable = 244
|
|
' If IdCtaRetISR > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = IdCtaRetISR
|
|
' ElseIf UsuarioActual.Empresa.Funcionalidad(317).ToEntero > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = UsuarioActual.Empresa.Funcionalidad(317).ToEntero
|
|
' Else
|
|
' If ObjMov.GetRetCuenta(ConceptoContableRetISRXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
' If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
' End If
|
|
' End If
|
|
' End If
|
|
' If IdCtaRetISR > 0 Then
|
|
' IdCtaContableRetISRAcreditable = IdCtaRetISR
|
|
' ElseIf UsuarioActual.Empresa.Funcionalidad(318).ToEntero > 0 Then
|
|
' IdCtaContableRetISRAcreditable = UsuarioActual.Empresa.Funcionalidad(318).ToEntero
|
|
' Else
|
|
' If ObjMov.GetRetCuenta(ConceptoContableRetISRAcreditable, UsuarioActual.CveEmpresa) Then
|
|
' If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
' IdCtaContableRetISRAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
' End If
|
|
' End If
|
|
' End If
|
|
' End Select
|
|
' If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
|
' If ImporteMovto = gvr.FCLiteral("LtlSaldo").Text.ToDouble Then
|
|
' 'Agrego el RetISR
|
|
' If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("RetISR").ToDecimal, Referencia, ConceptoContableRetISRXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRXAcreditar, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
|
|
' MsgError = "Detalle"
|
|
' End If
|
|
|
|
' 'Agrego el RetISR
|
|
' If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("RetISR").ToDecimal, Referencia, ConceptoContableRetISRAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRAcreditable, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
|
|
' MsgError = "Detalle"
|
|
' End If
|
|
' End If
|
|
' Else
|
|
' 'Agrego el RetISR
|
|
' If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRXAcreditar, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
|
|
' MsgError = "Detalle"
|
|
' End If
|
|
|
|
' 'Agrego el RetISR
|
|
' If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRAcreditable, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
|
|
' MsgError = "Detalle"
|
|
' End If
|
|
' End If
|
|
'End If
|
|
|
|
Dim SaldoExcedente As Double = gvr.FCTextBox("TxtSaldoExcedente").Text.ToDecimal
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(506) = "1" And CbPermitirExcedente.Checked = True And SaldoExcedente > 0 Then
|
|
If DDlPermitirExcedente.SelectedValue = "1" Then
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, 17, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=(SaldoExcedente) * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
|
|
MsgError = "Detalle Reembolso Personal"
|
|
End If
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 132, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaOtrosProductos, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaOtrosProductos, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
|
|
MsgError = "Detalle Reembolso Personal"
|
|
End If
|
|
|
|
ElseIf DDlPermitirExcedente.SelectedValue = "2" Then
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, 17, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
|
|
MsgError = "Detalle Reembolso Personal Excedente"
|
|
End If
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 29, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaPersonal, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaPersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
|
|
MsgError = "Detalle Reembolso Personal Excedente"
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
'Unificamos el cheque y la caja chica con los pagos y facturas
|
|
If Not IdPoliza > 0 AndAlso Not gvr.DataKey("IdPoliza").ToEntero > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(219) = "1" Then
|
|
If MsgError = "" Then
|
|
'CvePrePolizaUnificar = CvePrePolizaPago
|
|
''codigo temoral, RMF. falta criterio de unificacion, en una póliza nueva de diario
|
|
'If UsuarioActual.CveEmpresa = 119 Then
|
|
' CvePrePolizaUnificar = ObjMov.AddPrePolizas("Compras/ComprobacionesU", 9, ImporteMovto, ImporteMovto, CveMoneda, TxtFechaPrePoliza.Text.ToDate, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=TxtFolio.Text.Trim.ToEntero)
|
|
' 'CvePrePolizaUnificar = -1 ' unificar en una de diario
|
|
'End If
|
|
|
|
If Not ObjMov.PrePolizaUnificacion(CvePrePolizaPago, gvr.DataKey("CvePrePoliza").ToEntero) Then
|
|
MsgError = "No se pudo unificar la prepoliza"
|
|
Alert("No se pudo unificar la prepoliza", TipoMensaje.MsgError)
|
|
Else
|
|
SeUnifico = True
|
|
End If
|
|
End If
|
|
End If
|
|
ImportePagar = ImportePagar - ImporteMovto
|
|
SaldoCheque = SaldoCheque - ImporteMovto
|
|
End If
|
|
|
|
'CHEQUE EXCEDENTE - NUEVO
|
|
If ChkChequeExcedente.Checked And ImportePagar > 0 Then
|
|
ImporteMovto = ImportePagar
|
|
|
|
If ImportePagar = ImporteOriginal Then
|
|
CvePrePolizaPago = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, ImporteMovto, ImporteMovto, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", $"Compra: { gvr.DataKey("SerieFolio").ToString }", TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
'registramos el nuevo IE
|
|
If CveCajaChica > 0 Then
|
|
CveIEPago = 0
|
|
Dim FolioIENew = ObjIE.GetNextFolio(CveCajaChica, 6).ToString
|
|
CveIEPago = ObjIE.AddBancos_IE(CveCajaChica, 6, Now, FolioIENew, gvr.DataKey("Proveedor"), ImporteMovto, CveMoneda, 0.0, $"{gvr.DataKey("Proveedor")} F:{gvr.DataKey("SerieFolio")} {If(DdlPersonal.Visible, DdlPersonal.SelectedItem.Text, DdlCajaChica.SelectedItem.Text)}", "", False, True, -1, CvePrePolizaPago, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
|
|
End If
|
|
End If
|
|
|
|
If gvr.DataKey("Original").ToDecimal > 0 Then PorcentajePago = (ImporteMovto / gvr.DataKey("Original").ToDecimal).RoundSQL Else PorcentajePago = 1
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, 17, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=(ImporteMovto * tipoCambio), CveCuenta:=CveCuentaProveedor) Then
|
|
MsgError = "Detalle"
|
|
Exit For
|
|
Else
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, 30, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CveCuenta:=CveCuentaBancaria) Then
|
|
MsgError = "no se pudo insertar el detalle de la poliza"
|
|
End If
|
|
|
|
'Otros Ingresos
|
|
If ChkAjusteOI.Checked Then
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, 78, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio, CveCuenta:=CveCuentaProveedor) Then
|
|
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
|
|
End If
|
|
End If
|
|
|
|
'*********IVA. siempre se registra aunque sea cero PREGUNTAR POR EL CONCEPTO DE IVA EN Conta_Conceptos
|
|
If MsgError = "" AndAlso gvr.DataKey("IVA").ToDecimal > 0 Then
|
|
Dim PorcentajeIVA As Decimal = gvr.DataKey("IVAPorcentaje").ToDecimal
|
|
Dim IdCtaContIVAXAcreditar As Integer = 0
|
|
Dim IdCtaContIVAAcreditable As Integer = 0
|
|
|
|
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows.Count > 0 Then
|
|
IdCtaContIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
|
IdCtaContIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
|
End If
|
|
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
|
If gvr.FCTextBox("TxtAbonar").Text.ToDecimal = gvr.FCLiteral("LtlSaldo").Text.ToDouble Then
|
|
'Agrego el IVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("IVA").ToDecimal, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal), ImporteMX:=(gvr.DataKey("IVA").ToDecimal) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
|
|
'Agrego el IVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("IVA").ToDecimal, Referencia, 19, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAAcreditable > 0, IdCtaContIVAAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal), ImporteMX:=(gvr.DataKey("IVA").ToDecimal) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
End If
|
|
Else
|
|
'Agrego el IVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
|
|
'Agrego el IVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("IVA").ToDecimal * PorcentajePago, Referencia, 19, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAAcreditable > 0, IdCtaContIVAAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
If MsgError = "" AndAlso gvr.DataKey("RetIVA").ToDecimal > 0 Then
|
|
Dim ConceptoContableRetIVAXAcreditar = 0, ConceptoContableRetIVAAcreditable = 0, IdCtaContableRetIVAXAcreditar = 0, IdCtaContableRetIVAAcreditable = 0
|
|
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
|
|
Case 1
|
|
ConceptoContableRetIVAXAcreditar = 15
|
|
ConceptoContableRetIVAAcreditable = 22
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(307).ToEntero > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(307).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(308).ToEntero > 0 Then
|
|
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(308).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
Case 2
|
|
ConceptoContableRetIVAXAcreditar = 183
|
|
ConceptoContableRetIVAAcreditable = 184
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(309).ToEntero > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(309).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(310).ToEntero > 0 Then
|
|
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(310).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
Case 3
|
|
ConceptoContableRetIVAXAcreditar = 185
|
|
ConceptoContableRetIVAAcreditable = 186
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(311).ToEntero > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(311).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(312).ToEntero > 0 Then
|
|
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(312).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
Case 4
|
|
ConceptoContableRetIVAXAcreditar = 248
|
|
ConceptoContableRetIVAAcreditable = 249
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(313).ToEntero > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(313).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
If IdCtaRetIVA > 0 Then
|
|
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
|
|
ElseIf UsuarioActual.Empresa.Funcionalidad(314).ToEntero > 0 Then
|
|
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(314).ToEntero
|
|
Else
|
|
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
End If
|
|
End If
|
|
End If
|
|
End Select
|
|
|
|
'Agrego el RetIVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAXAcreditar, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
|
|
'Agrego el RetIVA
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAAcreditable, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
|
|
MsgError = "Detalle"
|
|
End If
|
|
End If
|
|
|
|
'If MsgError = "" AndAlso gvr.DataKey("RetISR").ToDecimal > 0 Then
|
|
' Dim ConceptoContableRetISRXAcreditar = 0, ConceptoContableRetISRAcreditable = 0, IdCtaContableRetISRXAcreditar = 0, IdCtaContableRetISRAcreditable = 0
|
|
' Select Case gvr.DataKey("CveRetISRConcepto").ToEntero
|
|
' Case 1
|
|
' ConceptoContableRetISRXAcreditar = 16
|
|
' ConceptoContableRetISRAcreditable = 23
|
|
' If IdCtaRetISR > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = IdCtaRetISR
|
|
' ElseIf UsuarioActual.Empresa.Funcionalidad(315).ToEntero > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = UsuarioActual.Empresa.Funcionalidad(315).ToEntero
|
|
' Else
|
|
' If ObjMov.GetRetCuenta(ConceptoContableRetISRXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
' If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
' End If
|
|
' End If
|
|
' End If
|
|
' If IdCtaRetISR > 0 Then
|
|
' IdCtaContableRetISRAcreditable = IdCtaRetISR
|
|
' ElseIf UsuarioActual.Empresa.Funcionalidad(316).ToEntero > 0 Then
|
|
' IdCtaContableRetISRAcreditable = UsuarioActual.Empresa.Funcionalidad(308).ToEntero
|
|
' Else
|
|
' If ObjMov.GetRetCuenta(ConceptoContableRetISRAcreditable, UsuarioActual.CveEmpresa) Then
|
|
' If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
' IdCtaContableRetISRAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
' End If
|
|
' End If
|
|
' End If
|
|
' Case 2
|
|
' ConceptoContableRetISRXAcreditar = 243
|
|
' ConceptoContableRetISRAcreditable = 244
|
|
' If IdCtaRetISR > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = IdCtaRetISR
|
|
' ElseIf UsuarioActual.Empresa.Funcionalidad(317).ToEntero > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = UsuarioActual.Empresa.Funcionalidad(317).ToEntero
|
|
' Else
|
|
' If ObjMov.GetRetCuenta(ConceptoContableRetISRXAcreditar, UsuarioActual.CveEmpresa) Then
|
|
' If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
' IdCtaContableRetISRXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
' End If
|
|
' End If
|
|
' End If
|
|
' If IdCtaRetISR > 0 Then
|
|
' IdCtaContableRetISRAcreditable = IdCtaRetISR
|
|
' ElseIf UsuarioActual.Empresa.Funcionalidad(318).ToEntero > 0 Then
|
|
' IdCtaContableRetISRAcreditable = UsuarioActual.Empresa.Funcionalidad(318).ToEntero
|
|
' Else
|
|
' If ObjMov.GetRetCuenta(ConceptoContableRetISRAcreditable, UsuarioActual.CveEmpresa) Then
|
|
' If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
' IdCtaContableRetISRAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
' End If
|
|
' End If
|
|
' End If
|
|
' End Select
|
|
|
|
' 'Agrego el RetISR
|
|
' If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRXAcreditar, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAxAcreditar, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
|
|
' MsgError = "Detalle"
|
|
' End If
|
|
|
|
' 'Agrego el RetISR
|
|
' If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRAcreditable, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CveCuenta:=CveCuentaIVAAcreditable, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
|
|
' MsgError = "Detalle"
|
|
' End If
|
|
'End If
|
|
|
|
End If
|
|
|
|
If ImportePagar = ImporteOriginal Then
|
|
'Unificamos el cheque y la caja chica con los pagos y facturas
|
|
If gvr.DataKey("IdPoliza").ToEntero = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(219) = "1" Then
|
|
If Not ObjMov.PrePolizaUnificacion(CvePrePolizaExcedente, CvePrePolizaPago) Then
|
|
MsgError = "No se pudo unificar la prepoliza"
|
|
Alert("No se pudo unificar la prepoliza", TipoMensaje.MsgError)
|
|
Else
|
|
SeUnifico = True
|
|
End If
|
|
|
|
If MsgError = "" Then
|
|
If Not ObjMov.PrePolizaUnificacion(CvePrePolizaExcedente, gvr.DataKey("CvePrePoliza").ToEntero) Then
|
|
MsgError = "No se pudo unificar la prepoliza"
|
|
Alert("No se pudo unificar la prepoliza", TipoMensaje.MsgError)
|
|
Else
|
|
SeUnifico = True
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
If MsgError = "" And UsuarioActual.Empresa.Funcionalidad(220) <> "" Then
|
|
If Not ObjMov.PrePolizaSimplificacion(CvePrePolizaPago, UsuarioActual.CveEmpresa) Then
|
|
MsgError = "No se pudo simplificar los movimientos"
|
|
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
|
|
End If
|
|
If Not ObjMov.PrePolizaSimplificacion(CvePrePolizaExcedente, UsuarioActual.CveEmpresa) Then
|
|
MsgError = "No se pudo simplificar los movimientos"
|
|
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
|
|
End If
|
|
End If
|
|
|
|
|
|
If ObjMov.ValidacionPrePolizaCuadre(CvePrePolizaPago, 1) Then
|
|
If ObjMov.ValorPolizaDescuadre > 0 Then
|
|
GuardaLogAD($"Compras/ReembolsosComprobaciones | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePolizaPago}", "LogPrePolizas")
|
|
MsgError = ObjMov.MensajePolizaDescuadre
|
|
End If
|
|
End If
|
|
|
|
If ObjMov.ValidacionPrePolizaCuadre(CvePrePolizaExcedente, 1) Then
|
|
If ObjMov.ValorPolizaDescuadre > 0 Then
|
|
GuardaLogAD($"Compras/ReembolsosComprobaciones | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePolizaExcedente}", "LogPrePolizas")
|
|
MsgError = ObjMov.MensajePolizaDescuadre
|
|
End If
|
|
End If
|
|
|
|
If MsgError.Trim = "" Then
|
|
'Conta SIG AUTOMATICA
|
|
|
|
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
|
|
If UsuarioActual.CveEmpresa = 119 Then
|
|
AutoConta = False
|
|
End If
|
|
|
|
If AutoConta And MsgError.Trim = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then
|
|
If CvePrePolizaIERegistrado > 0 Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaPersonal > 0 Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaProveedor > 0 Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaIVAxAcreditar > 0 Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaIVAAcreditable > 0 Then
|
|
If ObjMov.ContabilizarPrePolizaSIG(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
|
|
Else
|
|
MsgError = "Ocurrio un Error al contabilizar en SIG, pongase en contacto con Soporte Técnico"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable SIG IVA Acreditable"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable SIG IVA x Acreditar"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable SIG de proveedor"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable SIG de personal"
|
|
End If
|
|
End If
|
|
|
|
If ChkChequeExcedente.Checked Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaBancaria > 0 Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaProveedor > 0 Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaIVAxAcreditar > 0 Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaIVAAcreditable > 0 Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaRetIVA > 0 Then
|
|
If UsuarioActual.Empresa.UsaContabilidadSIG AndAlso CveCuentaRetISR > 0 Then
|
|
If ObjMov.ContabilizarPrePolizaSIG(CvePrePolizaExcedente, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
|
|
Else
|
|
MsgError = "Ocurrio un Error al contabilizar en SIG, pongase en contacto con Soporte Técnico"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable SIG Ret ISR"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable SIG Ret IVA"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable SIG IVA Acreditable"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable SIG IVA x Acreditar"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable SIG de proveedor"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene Cuenta contable SIG Bancaria"
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
'Conta ContPAQ AUTOMATICA
|
|
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError.Trim = "" Then
|
|
If CvePrePolizaIERegistrado > 0 Then
|
|
If IdCtaPersonal > 0 Or DdlCajaChica.Visible Then
|
|
If IdCtaProveedor > 0 Then
|
|
If IdCtaIVAxAcreditar > 0 Then
|
|
If IdCtaIVAAcreditable > 0 Then
|
|
If ObjMov.ContabilizarPrePoliza(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
|
|
Else
|
|
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable IVA Acreditable"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable IVA x Acreditar"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable de proveedor"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable de personal"
|
|
End If
|
|
End If
|
|
|
|
If ChkChequeExcedente.Checked Then
|
|
If IdCuentaBancaria > 0 Then
|
|
If IdCtaProveedor > 0 Then
|
|
If IdCtaIVAxAcreditar > 0 Then
|
|
If IdCtaIVAAcreditable > 0 Then
|
|
If IdCtaRetIVA > 0 Then
|
|
If IdCtaRetISR > 0 Then
|
|
If ObjMov.ContabilizarPrePoliza(CvePrePolizaExcedente, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
|
|
Else
|
|
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable Ret ISR"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable Ret IVA"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable IVA Acreditable"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable IVA x Acreditar"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene cuenta contable de proveedor"
|
|
End If
|
|
Else
|
|
MsgError = "No tiene Cuenta contable Bancaria"
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
Else
|
|
MsgError = "No se pudo insertar el encabezado"
|
|
End If
|
|
Else
|
|
MsgError = "No se pudo insertar la póliza"
|
|
End If
|
|
|
|
If MsgError.Trim = "" Then
|
|
ObjIE.Commit()
|
|
UPCompras.Update()
|
|
|
|
Dim Mensaje As New StringBuilder
|
|
|
|
If CvePrePolizaExcedente > 0 Then
|
|
Mensaje.AppendFormat("Abono Registrado Correctamente. <br/><br/> Cheque: <a target='_blank' href=/Bancos/IE.aspx?CveIE={0}>{1}</a> <br/><br/> <a target='_blank' href=""/Bancos/Reportes.aspx?Opcion=ImprimeMov&CveIE={0}"">Imprimir</a>", CveIEExcedente, TxtFolio.Text)
|
|
Mensaje.AppendFormat("</br> <br/>Póliza: <b> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' class='Texto' target='_blank'>{1}</a><br/>", ObjMov.ContaIdPoliza, ObjMov.ContaFolio)
|
|
Alert(Mensaje.ToString, TipoMensaje.MsgInformacion)
|
|
Else
|
|
Mensaje.AppendFormat("Abono Registrado Correctamente. <br/><br/> <a class=""Texto"" target='_blank' href=""/Bancos/Reportes.aspx?Opcion=ImprimeMov&CveIE={0}"">Imprimir</a>", CveIERegistrado)
|
|
If CvePrePolizaIERegistrado > 0 Then
|
|
Mensaje.AppendFormat("</br> <br/>Póliza: <b> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' class='Texto' target='_blank'>{1}</a><br/>", ObjMov.ContaIdPoliza, ObjMov.ContaFolio)
|
|
End If
|
|
Alert(Mensaje.ToString, TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
LimpiaDatos()
|
|
CargaCxP()
|
|
PnlChequeInfo.Visible = False
|
|
Else
|
|
Alert($"Ocurrió un error al guardar el movimiento {MsgError.Trim}", TipoMensaje.MsgError)
|
|
ObjIE.RollBack()
|
|
End If
|
|
|
|
ObjIE.Dispose()
|
|
ObjMov.Dispose()
|
|
End Sub
|
|
|
|
Protected Function UnificacionSimplificacionPrepolizas(ObjMov As ClsContabilidad, CvePrePolizaNueva As Integer, CvePrePolizaVieja As Integer) As String
|
|
Dim Retorno As String = ""
|
|
|
|
'Unificacion de PrePolizas
|
|
If UsuarioActual.Empresa.Funcionalidad(219) = "1" Then
|
|
If Not ObjMov.PrePolizaUnificacion(CvePrePolizaNueva, CvePrePolizaVieja) Then
|
|
Retorno = "No se pudo unificar la prepoliza"
|
|
Alert("No se pudo unificar la prepoliza", TipoMensaje.MsgError)
|
|
End If
|
|
End If
|
|
|
|
'Simplificacion de PrePolizas
|
|
If UsuarioActual.Empresa.Funcionalidad(220) <> "" Then
|
|
If Not ObjMov.PrePolizaSimplificacion(CvePrePolizaNueva, UsuarioActual.CveEmpresa) Then
|
|
Retorno = "No se pudo simplificar los movimientos"
|
|
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
|
|
End If
|
|
End If
|
|
|
|
Return Retorno
|
|
End Function
|
|
|
|
Protected Sub LimpiaDatos()
|
|
TxtFolio.Text = ""
|
|
TxtObservaciones.Text = ""
|
|
TxtImporte.Text = ""
|
|
TxtImporteVinculado.Text = ""
|
|
TxtFechaDocumento.Text = Date.Now.ToShortDateString
|
|
'DdlCuenta.SelectedValue = "-1"
|
|
DdlTipoTransaccion.SelectedValue = "-1"
|
|
DdlTipoTransaccionDiferencia_SelectedIndexChanged(DdlTipoTransaccion, EventArgs.Empty)
|
|
ChkReembolsarSinBancos.Checked = False
|
|
|
|
UpDatos.Update()
|
|
|
|
For Each gvr As GridViewRow In GvCxP.Rows
|
|
gvr.FCCheckBox("Chk").Checked = False
|
|
gvr.FCTextBox("TxtAbonar").Text = ""
|
|
gvr.FCTextBox("TxtSaldoExcedente").Text = ""
|
|
Next
|
|
UPCompras.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " REPORTE CHEQUES FYE "
|
|
Private Sub CargaReporteChequesFYE()
|
|
|
|
If DdlPersonal.SelectedIndex > 0 Then
|
|
GvChequesFYE.Visible = True
|
|
|
|
Dim ObjMovtos As New ClsMovimientos
|
|
Dim DtChequesFYE As DataTable = Nothing
|
|
|
|
If ObjMovtos.GetChequesFYE(UsuarioActual.CveEmpresa) Then
|
|
DtChequesFYE = ObjMovtos.DtResultados
|
|
Else
|
|
Alert("Ocurrió un error al cargar el reporte de cheques de Funcionarios/Empleados. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
|
DtChequesFYE = New DataTable
|
|
End If
|
|
ObjMovtos.Dispose()
|
|
|
|
|
|
If DtChequesFYE.Rows.Count > 0 Then
|
|
GvChequesFYE.DataSource = DtChequesFYE
|
|
GvChequesFYE.DataBind()
|
|
UpChequesFYE.Update()
|
|
End If
|
|
|
|
Else
|
|
|
|
GvChequesFYE.Visible = False
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Protected Sub GvChequesFYE_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
e.Row.FCHyperLink("HLFYE").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal"))
|
|
'e.Row.FCHyperLink("HLCheque").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
|
|
|
|
End If
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
#Region " TABLA CxP "
|
|
Protected Sub CargaCxP()
|
|
Dim ObjMovtos As New ClsMovimientos
|
|
|
|
GvCxP.Visible = True
|
|
|
|
ObjMovtos.GetCxPPersonalCajaChica(UsuarioActual.CveEmpresa, CvePersonal, CveCajaChica, If(TxtNumeroReembolso.Text.Trim = "", "-1", TxtNumeroReembolso.Text.Trim))
|
|
DtDatos = ObjMovtos.DtResultados.FiltraParametros("Saldo > 0")
|
|
GvCxP.DataSource = DtDatos
|
|
|
|
'Limpia Ddl Chequesventas
|
|
DDlCheques.Items.Clear()
|
|
|
|
'cargo si tiene cheques pendientes sin amortizar
|
|
|
|
|
|
If CvePersonal > 0 Then
|
|
ObjMovtos.GetEgresosSinComprobarPersonalDetalle(CvePersonal, UsuarioActual.CveEmpresa)
|
|
CargaCuentas()
|
|
|
|
PnlCheques.Visible = True
|
|
If UsuarioActual.TienePermisoProceso(113) Then TableExpedirCheque.Visible = True
|
|
End If
|
|
|
|
If CveCajaChica > 0 Then
|
|
ObjMovtos.GetCajaChicaDetalle(CveCajaChica, UsuarioActual.CveEmpresa)
|
|
PnlCheques.Visible = True
|
|
If UsuarioActual.TienePermisoProceso(113) Then TableExpedirCheque.Visible = True
|
|
DdlCuenta.Items.Clear()
|
|
DdlCuenta.Items.Add(New ListItem(DdlCajaChica.SelectedItem.Text, DdlCajaChica.SelectedValue))
|
|
End If
|
|
|
|
DtCheques = ObjMovtos.DtResultados.FiltraParametros("CveIE > 0", "FechaDocumento, FolioFecha")
|
|
|
|
If DtCheques.Rows.Count > 0 Then
|
|
DDlCheques.DataSource = DtCheques
|
|
End If
|
|
|
|
ObjMovtos.Dispose()
|
|
GvCxP.DataBind()
|
|
|
|
LnkImprimir.Visible = True
|
|
NumeroReembolso = TxtNumeroReembolso.Text
|
|
UpAcciones.Update()
|
|
|
|
DDlCheques.DataBind()
|
|
|
|
If UsuarioActual.TienePermisoProceso(113) Then
|
|
DDlCheques.Items.Insert(0, New ListItem("Expedir Cheque", "-1"))
|
|
Else
|
|
DDlCheques.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
End If
|
|
|
|
DDlCheques_SelectedIndexChanged(DDlCheques, EventArgs.Empty)
|
|
|
|
If GvCxP.Rows.Count > 0 Then
|
|
TxtFechaDocumento.Text = Now.ToShortDateString
|
|
|
|
'Valida Proceso 120 para ROL Administrador de obra - Si tiene el proceso no puede guardar
|
|
If Not UsuarioActual.TienePermisoProceso(120) Then
|
|
BtnIEGuardar.Enabled = True
|
|
End If
|
|
|
|
If Not DdlPersonal.SelectedValue = "-2" Then
|
|
TxtAboneA.Text = DdlPersonal.SelectedItem.ToString
|
|
End If
|
|
If Not DdlCajaChica.SelectedValue = "-2" Then
|
|
TxtAboneA.Text = DdlCajaChica.SelectedItem.ToString
|
|
End If
|
|
|
|
Else
|
|
TxtAboneA.Text = ""
|
|
BtnIEGuardar.Enabled = False
|
|
End If
|
|
|
|
UpDatos.Update()
|
|
UpGuardar.Update()
|
|
UPCompras.Update()
|
|
UPPChq.Update()
|
|
End Sub
|
|
|
|
Protected Sub GvCxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxP.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.RowIndex = 0 Then
|
|
e.Row.BackColor = Drawing.Color.LightGray
|
|
e.Row.FCTextBox("TxtAbonar").Visible = False
|
|
e.Row.FCCheckBox("Chk").Visible = False
|
|
e.Row.FCTextBox("TxtSaldoExcedente").Visible = False
|
|
e.Row.FCTextBox("TxtComision").Visible = False
|
|
End If
|
|
If e.Row.RowIndex = 1 Then
|
|
e.Row.Cells(0).Width = Unit.Pixel(20)
|
|
e.Row.Cells(1).Width = Unit.Pixel(70)
|
|
e.Row.Cells(2).Width = Unit.Pixel(250)
|
|
e.Row.Cells(3).Width = Unit.Pixel(70)
|
|
e.Row.Cells(4).Width = Unit.Pixel(80)
|
|
e.Row.Cells(5).Width = Unit.Pixel(40)
|
|
e.Row.Cells(6).Width = Unit.Pixel(80)
|
|
e.Row.Cells(7).Width = Unit.Pixel(70)
|
|
e.Row.Cells(8).Width = Unit.Pixel(70)
|
|
e.Row.Cells(9).Width = Unit.Pixel(80)
|
|
e.Row.Cells(15).Width = Unit.Pixel(80)
|
|
End If
|
|
|
|
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(8).HorizontalAlign = HorizontalAlign.Right
|
|
|
|
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 = "GvCxP" Then e.Row.Cells(5).ForeColor = Drawing.Color.Red
|
|
If e.Row.DBCampo("Original").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 TxtNumeroReembolso.Text = "" Then e.Row.FCCheckBox("Chk").Enabled = False
|
|
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo")))
|
|
e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1); FnSumaExcedente({2},{3},{1});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCTextBox("TxtSaldoExcedente").ClientID, e.Row.FCTextBox("TxtAbonar").ClientID))
|
|
e.Row.FCTextBox("TxtSaldoExcedente").Attributes.Add("onblur", String.Format("FnSumaExcedente({0},{1},{2});", e.Row.FCTextBox("TxtSaldoExcedente").ClientID, e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo")))
|
|
|
|
e.Row.FCTextBox("TxtComision").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},2);", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo")))
|
|
e.Row.FCRangeValidator("RVComision").MinimumValue = 0.00
|
|
e.Row.FCRangeValidator("RVComision").MaximumValue = e.Row.DBCampo("Saldo")
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " APLICA DIFERENCIA "
|
|
Protected Sub ChkChequeExcedente_CheckedChanged(sender As Object, e As EventArgs)
|
|
If ChkChequeExcedente.Checked Then
|
|
If UsuarioActual.TienePermisoProceso(113) Then TableExpedirCheque.Visible = True
|
|
Else
|
|
LimpiaDatos()
|
|
TxtImporteVinculado.Text = ""
|
|
TableExpedirCheque.Visible = False
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub BtnDiferencia_Click(sender As Object, e As EventArgs)
|
|
TxtImporteVinculado.Text = HdnSaldo.Value
|
|
If HdnSaldoDiferencia.Value.ToDouble > 0 AndAlso ChkChequeExcedente.Checked Then
|
|
TxtImporte.Text = HdnSaldoDiferencia.Value
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub DdlCuentaDiferencia_SelectedIndexChanged(sender As Object, e As EventArgs) 'Handles DdlCuentaDiferencia.SelectedIndexChanged
|
|
'recargo la moneda con la que se va a pagar
|
|
'Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltroPrimero("CveCuenta = " & DdlCuentaDiferencia.SelectedValue)
|
|
|
|
'If dr IsNot Nothing Then
|
|
' CveMoneda = dr("CveMoneda").ToString.ToEntero
|
|
' IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
|
|
'End If
|
|
|
|
'If HdnTipoTransaccion.Value = "Egs" Then
|
|
' Dim Folio As Long
|
|
' Dim Banco As New ClsBancos
|
|
' Folio = Banco.GetNextFolio(DdlCuentaDiferencia.SelectedValue.ToEntero, DdlTipoTransaccionDiferencia.SelectedValue.ToEntero)
|
|
' Banco.Dispose()
|
|
' TxtFolioDiferencia.Text = Folio.ToString
|
|
'Else
|
|
' TxtFolioDiferencia.Text = ""
|
|
'End If
|
|
End Sub
|
|
|
|
Protected Sub DdlTipoTransaccionDiferencia_SelectedIndexChanged(sender As Object, e As EventArgs) 'Handles DdlTipoTransaccionDiferencia.SelectedIndexChanged
|
|
'Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccionDiferencia.SelectedValue))
|
|
'If dr IsNot Nothing Then
|
|
' HdnTipoTransaccionDiferencia.Value = dr("Tipo").ToString
|
|
'End If
|
|
'CargaCuentasDiferencia()
|
|
End Sub
|
|
|
|
Private Sub CargaCuentasDiferencia()
|
|
'DdlCuentaDiferencia.Items.Clear()
|
|
'Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario)
|
|
|
|
'dt = dt.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = {1}", 1, DdlTipoTransaccion.SelectedValue))
|
|
'DdlCuentaDiferencia.DataSource = dt
|
|
'DdlCuentaDiferencia.DataBind()
|
|
'DdlCuentaDiferencia.Items.Insert(0, New ListItem("Seleccione cuenta", "-1"))
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " EXPORTAR - PDF - EXCEL "
|
|
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
|
'GvCxP.Columns(0).Visible = False
|
|
'GvCxP.Columns(9).Visible = False
|
|
|
|
'GvCxP.ExportToExcel("Reembolsos - Comprobaciones ")
|
|
|
|
'GvCxP.Columns(0).Visible = True
|
|
'GvCxP.Columns(9).Visible = True
|
|
Imprimir("EXCEL")
|
|
End Sub
|
|
#End Region
|
|
|
|
Protected Sub LnkImprimir_Click(sender As Object, e As EventArgs) Handles LnkImprimir.Click
|
|
Imprimir("PDF")
|
|
End Sub
|
|
|
|
Private Sub Imprimir(Formato As String)
|
|
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\Reembolso.rdlc", UsuarioActual.Empresa.Ruta))
|
|
Dim Imagen As New System.IO.FileInfo(String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta))
|
|
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
|
|
If Archivo.Exists Then
|
|
|
|
If UsuarioActual.CveEmpresa = 72 Then
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToString))
|
|
params.Add(New ReportParameter("CveCajaChica", CveCajaChica.ToString))
|
|
params.Add(New ReportParameter("CveFyE", CvePersonal.ToString))
|
|
params.Add(New ReportParameter("CajaChica", If(DdlCajaChica.SelectedValue.ToEntero > 0, "Caja chica: " & DdlCajaChica.SelectedItem.Text, "Funcionario/Empleado: " & DdlPersonal.SelectedItem.Text)))
|
|
|
|
ImprimirPDF(String.Format("{0}Formatos\Reembolso.rdlc", UsuarioActual.Empresa.Ruta), DtDatos, params, "RepRembolsosComprobaciones", Formato:=Formato)
|
|
Else
|
|
params.Add(New ReportParameter("Numero", NumeroReembolso))
|
|
params.Add(New ReportParameter("Anio", DtDatos.FiltraParametros("CveCompra > 0").MAX("Fecha").ToDate.Year.ToString))
|
|
params.Add(New ReportParameter("Nombre", DtDatos.MAX("SubProyecto")))
|
|
params.Add(New ReportParameter("Fecha", Now.Date.ToString))
|
|
params.Add(New ReportParameter("Elaboro", ""))
|
|
params.Add(New ReportParameter("Autorizo", ""))
|
|
params.Add(New ReportParameter("ElaboroPuesto", ""))
|
|
params.Add(New ReportParameter("AutorizoPuesto", ""))
|
|
ImprimirPDF(String.Format("{0}Formatos\Reembolso.rdlc", UsuarioActual.Empresa.Ruta), DtDatos.FiltraParametros("CveCompra > 0"), params, "Reembolso", RDSName:="DsCompras")
|
|
End If
|
|
Else
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToString))
|
|
|
|
params.Add(New ReportParameter("CajaChica", If(DdlCajaChica.SelectedValue.ToEntero > 0, "Caja chica: " & DdlCajaChica.SelectedItem.Text, "Funcionario/Empleado: " & DdlPersonal.SelectedItem.Text)))
|
|
|
|
If Imagen.Exists Then
|
|
params.Add(New ReportParameter("LogoPath", logouri))
|
|
Else
|
|
params.Add(New ReportParameter("LogoPath", ""))
|
|
End If
|
|
|
|
ImprimirPDF("Empresas/Grales/Formatos/RepRembolsosComprobaciones.rdlc", DtDatos, params, "RepRembolsosComprobaciones", Formato:=Formato)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CbPermitirExcedente_CheckedChanged(sender As Object, e As EventArgs) Handles CbPermitirExcedente.CheckedChanged
|
|
If CbPermitirExcedente.Checked = True Then
|
|
HdnExcedente.Value = "1"
|
|
DDlPermitirExcedente.Visible = True
|
|
GvCxP.Columns(10).Visible = True
|
|
Else
|
|
HdnExcedente.Value = "0"
|
|
GvCxP.Columns(10).Visible = False
|
|
DDlPermitirExcedente.Visible = False
|
|
End If
|
|
UPCompras.Update()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
|
|
#Region "VIATICOS"
|
|
|
|
Protected Sub ChkAplicaViatico_CheckedChanged(sender As Object, e As EventArgs)
|
|
If ChkAplicaViatico.Checked Then
|
|
Dim Retorno = TimbrarNomina12(DdlPersonal.SelectedValue.ToEntero)
|
|
If Retorno <> "" Then
|
|
Alert(Retorno, TipoMensaje.MsgError)
|
|
Else
|
|
Dim SerieFolio = $"VIA-{Folio}"
|
|
Dim Msg As New StringBuilder
|
|
Msg.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=DesXmlVIA&SERIEFOLIO={0}&TIPO={1}", SerieFolio, "Viaticos Comprobados")))
|
|
Alert(Msg.ToString)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Function TimbrarNomina12(CvePersonal As Integer) As String
|
|
Dim Retorno As String = ""
|
|
UsuarioActual.Empresa.CvePAC = 2
|
|
Dim sw As New Diagnostics.Stopwatch
|
|
sw.Start()
|
|
Select Case UsuarioActual.Empresa.CvePAC
|
|
Case 1
|
|
'Retorno = TimbrarBIInformNomina12(CveNomina, CvePersonal, CvePeriodo)
|
|
Case 2, 4
|
|
Dim cfdi As CFDITimbre = PreTimbrar(CvePersonal)
|
|
If cfdi Is Nothing Then
|
|
sw.Stop()
|
|
Return "No tiene asignado un folio de viaticos"
|
|
End If
|
|
If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then
|
|
Dim ObjTimbrado As New Timbrado
|
|
Dim ObjFactura As New Modelos.Factura
|
|
ObjFactura.TipoDocto = "Viaticos Comprobados"
|
|
ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero
|
|
ObjFactura.Serie = cfdi.Comprobante.Serie
|
|
ObjFactura.Timbre = cfdi
|
|
If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then
|
|
Retorno = ObjTimbrado.MensajeErrorCFDI
|
|
End If
|
|
|
|
'Retorno = TimbrarFacturaRealVirtual(cfdi, UsuarioActual)
|
|
If Retorno <> "" Then
|
|
Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}"
|
|
Else
|
|
'Genero la addenda Ford
|
|
' GeneraPDFNuevo(String.Format("{0}XML\Nomina\{1}.xml", Ruta, NominaFolio), CvePersonal, CvePeriodo)
|
|
End If
|
|
Else
|
|
Retorno = $"No se pudo generar el pretimbre: <br/> {cfdi.Mensaje}"
|
|
End If
|
|
End Select
|
|
sw.Stop()
|
|
GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC, "Nomina")
|
|
|
|
Return Retorno
|
|
|
|
End Function
|
|
|
|
Private Function PreTimbrar(CvePersonal As Integer) As CFDITimbre
|
|
Dim cfdi As New CFDITimbre
|
|
Dim ObjFolio As New ClsGralFolios
|
|
If ObjFolio.GetFolios("VIA", UsuarioActual.CveEmpresa) Then
|
|
If ObjFolio.DtResultados.Rows.Count > 0 Then
|
|
Folio = ObjFolio.DtResultados.Rows(0)("FActual").ToString
|
|
Else
|
|
ObjFolio.Dispose()
|
|
Return Nothing
|
|
End If
|
|
End If
|
|
ObjFolio.Dispose()
|
|
|
|
|
|
Dim objPersonal As New ClsRH
|
|
objPersonal.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa)
|
|
|
|
Dim AntiguedadSemanas As Integer = DateDiff(DateInterval.Weekday, objPersonal.FechaIngreso, Now).ToEntero
|
|
|
|
cfdi.Nomina = New CFDINomina
|
|
cfdi.Nomina.Version = "1.2"
|
|
cfdi.Nomina.TipoNomina = "E"
|
|
cfdi.Nomina.FechaPago = LtChequeFecha.Text.ToDate
|
|
cfdi.Nomina.FechaInicio = LtChequeFecha.Text
|
|
cfdi.Nomina.FechaFin = LtChequeFecha.Text
|
|
cfdi.Nomina.NumDiasPagados = 1
|
|
cfdi.Emisor.Nombre = UsuarioActual.Empresa.Empresa
|
|
cfdi.Emisor.RFC = UsuarioActual.Empresa.RFC
|
|
cfdi.Emisor.RegistroPatronal = UsuarioActual.Empresa.RegistroPatronal
|
|
cfdi.Emisor.RegimenFiscal = UsuarioActual.Empresa.CodigoRegimenFiscal
|
|
|
|
'aplica persona fisica debe de tener CURP
|
|
If cfdi.Emisor.RegimenFiscal.Contiene("605", "606", "608", "611", "612", "614", "616", "621", "622", "629", "630", "615") Then
|
|
cfdi.Emisor.CURP = UsuarioActual.Empresa.CURP
|
|
End If
|
|
|
|
|
|
cfdi.Receptor.UsoCFDI = "P01"
|
|
cfdi.Receptor.RFC = objPersonal.RFC
|
|
cfdi.Receptor.Nombre = objPersonal.NombreCompleto
|
|
|
|
Dim ObjDeducciones As New List(Of CFDINominaDeducciones)
|
|
ObjDeducciones.Add(New CFDINominaDeducciones With {.TipoDeduccion = "081",
|
|
.Clave = "081",
|
|
.Concepto = "Ajuste de viáticos entregados al trabajador",
|
|
.Importe = TxtChequeSaldo.Text.ToDecimal}
|
|
)
|
|
If ObjDeducciones IsNot Nothing AndAlso ObjDeducciones.Count > 0 Then cfdi.Nomina.Deducciones = ObjDeducciones
|
|
|
|
Dim ObjPercepcion As New List(Of CFDINominaPercepciones)
|
|
ObjPercepcion.Add(New CFDINominaPercepciones With {.TipoPercepcion = "050",
|
|
.Clave = "050",
|
|
.Concepto = "Viáticos",
|
|
.ImporteExento = TxtChequeSaldo.Text.ToDecimal,
|
|
.ImporteGravado = 0}
|
|
)
|
|
If ObjPercepcion IsNot Nothing AndAlso ObjPercepcion.Count > 0 Then cfdi.Nomina.Percepciones = ObjPercepcion
|
|
|
|
cfdi.Comprobante.Version = "3.3"
|
|
cfdi.Comprobante.Serie = "VIA"
|
|
cfdi.Comprobante.Folio = Folio
|
|
cfdi.Comprobante.Fecha = Now
|
|
cfdi.Comprobante.Subtotal = TxtChequeSaldo.Text.ToDecimal
|
|
cfdi.Comprobante.Descuentos = cfdi.Nomina.TotalDeducciones.ToDecimal
|
|
cfdi.Comprobante.Total = TxtChequeSaldo.Text.ToDecimal - cfdi.Nomina.TotalDeducciones.ToDecimal
|
|
cfdi.Comprobante.MotivoDescuento = ""
|
|
cfdi.Comprobante.Moneda = "MXN"
|
|
cfdi.Comprobante.TipoComprobante = "N"
|
|
cfdi.Comprobante.TipoDocto = "Egs"
|
|
cfdi.Comprobante.MetodoPago = "PUE"
|
|
cfdi.Comprobante.CondicionesdePago = ""
|
|
cfdi.Comprobante.FormadePago = "99"
|
|
cfdi.Comprobante.LugarExpedicion = UsuarioActual.Empresa.CP.ToString
|
|
cfdi.Comprobante.NumCuentaPago = ""
|
|
|
|
|
|
cfdi.Nomina.Receptor.CURP = objPersonal.CURP
|
|
cfdi.Nomina.Receptor.NSS = objPersonal.NumeroSS
|
|
cfdi.Nomina.Receptor.FechaInicioContrato = objPersonal.FechaInicioContrato.ToShortDateString
|
|
cfdi.Nomina.Receptor.Antiguedad = $"P{AntiguedadSemanas}W"
|
|
cfdi.Nomina.Receptor.TipoContrato = objPersonal.CodigoTipoContrato
|
|
cfdi.Nomina.Receptor.CodigoTipoJornada = objPersonal.ClaveTipoJornada
|
|
cfdi.Nomina.Receptor.CodigoRegimenContratacion = If(objPersonal.CveRegimenContratacion = "", "99", objPersonal.CveRegimenContratacion)
|
|
cfdi.Nomina.Receptor.CodigoEmpleado = objPersonal.Codigo
|
|
cfdi.Nomina.Receptor.Departamento = objPersonal.Departamento
|
|
cfdi.Nomina.Receptor.Puesto = objPersonal.Puesto
|
|
cfdi.Nomina.Receptor.CodigoRiesgoPuesto = If(objPersonal.CveSATRiesgoPuesto.ToString = "0", "99", objPersonal.CveSATRiesgoPuesto.ToString)
|
|
cfdi.Nomina.Receptor.TipoPeriodo = objPersonal.TipoPeriodoPago
|
|
cfdi.Nomina.Receptor.CodigoBanco = objPersonal.ClaveBanco
|
|
cfdi.Nomina.Receptor.NumeroCuenta = objPersonal.BancoNumCuenta
|
|
cfdi.Nomina.Receptor.SDI = objPersonal.SDI
|
|
cfdi.Nomina.Receptor.SBC = objPersonal.SDI
|
|
cfdi.Nomina.Receptor.Sindicalizado = ""
|
|
cfdi.Nomina.Receptor.CodigoEntidadFederativa = objPersonal.ClaveEstado
|
|
|
|
|
|
cfdi.Conceptos.Add(New CFDIConceptos With {.Cantidad = 1, .ClaveUnidad = "ACT", .ClaveProdServ = "84111505", .Descripcion = "Pago de nómina", .ValorUnitario = cfdi.Nomina.TotalPercepciones + cfdi.Nomina.TotalOtrosPagos, .Importe = cfdi.Nomina.TotalPercepciones + cfdi.Nomina.TotalOtrosPagos, .Descuento = cfdi.Nomina.TotalDeducciones.ToDecimal})
|
|
|
|
objPersonal.Dispose()
|
|
Return cfdi
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
#Region "REEMBOLSAR SIN BANCOS"
|
|
|
|
Protected Sub ChkReembolsarSinBancos_CheckedChanged(sender As Object, e As EventArgs)
|
|
If ChkReembolsarSinBancos.Checked Then
|
|
DDlCheques.Enabled = False
|
|
TableExpedirCheque.Visible = False
|
|
Else
|
|
DDlCheques.Enabled = True
|
|
TableExpedirCheque.Visible = True
|
|
End If
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
End Class
|