You are on page 1of 44

Dim i, items, tercero

'Boton cerrar
Private Sub btncerrar_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Unload Me
Worksheets("CONCEPTOS").Visible = xlVeryHidden
Worksheets("Formato").Visible = xlVeryHidden
Worksheets("PUC").Visible = xlVeryHidden
Worksheets("C.COSTOS").Visible = xlVeryHidden
Worksheets("TERCEROS").Visible = xlVeryHidden
Worksheets("PlanoHelisa").Visible = xlVeryHidden
End Sub
'boton corregir
Private Sub btnCorregir_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtconcepto.Enabled = True
txtDescripcion.Enabled = True
txtTercero.Enabled = True
txtTarifa.Enabled = True
txtFactura.Enabled = True
txtFechaFact.Enabled = True
txtvalor.Enabled = True
txtiva.Enabled = True
txtConceptoRet.Enabled = True
txtSi.Enabled = True
txtNo.Enabled = True
End Sub

'crear tercero
Private Sub btnCrearT_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
FRMCrearTercero.Show
FRMCrearTercero.txtnit.SetFocus
End Sub
'Eliminar registros del plano y del formulario
Private Sub btneliminar_Click()
Dim fila As Integer
Dim final As Integer
fila = 12
Do While Hoja7.Cells(fila, 1) <> ""
fila = fila + 1
Loop
If MsgBox("Seguro que desea eliminar este registro?", vbQuestion + vbYesNo) Then
For fila = 12 To final
If Hoja7.Cells(fila, 5) = tercero Then
Call desbloquear
Hoja7.Cells(fila, 1).EntireRow.Delete
Exit For
End If
Next
MsgBox "Registro Eliminado", vbInformation + vbOKOnly
Else
Exit Sub
End If
Call bloquear
End Sub
'limpiar el formulario
Private Sub Image2_Click()
Call limpiar_formulario
End Sub
'Ver el formato
Private Sub Image3_Click()
Worksheets("Menu").Visible = True
Worksheets("Formato").Visible = True
Worksheets("Formato").Select
Worksheets("CONCEPTOS").Visible = False
Worksheets("PUC").Visible = False
Worksheets("C.COSTOS").Visible = False
Worksheets("TERCEROS").Visible = False
Worksheets("PlanoHelisa").Visible = False
Unload Me
End Sub
Private Sub Image4_Click()
Unload Me
FRMCaja.Show
End Sub
Private Sub ListBox1_Click()
items = Me.ListBox1.ListCount
For i = 0 To items - 1
If Me.ListBox1.Selected(i) Then
tercero = Me.ListBox1.List(i)
End If
Next i
End Sub
Private Sub txtanticipo_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim celda As String
'tipo de legalizacion
If txtanticipo.Value = True Then
celda = InputBox("Digite el valor del anticipo", "VALOR ANTICIPO")
txtbase = FormatCurrency(celda, 0)
txtSaldoLeg = FormatCurrency((txtbase - txtAcumulado), 0)
txtconcepto.Enabled = True
txtconcepto.BackColor = &HC0FFFF
txtconcepto.SetFocus
lbbase = "ANTICIPO"
txtbase.Enabled = True
txtconsecutivo = "A" + Format(txtfecha, "ddmmyy") + Left(txtempleado, 1)
On Error Resume Next
btnAgregar.Enabled = False
btnTerminar.Enabled = False
End If
End Sub
Private Sub txtbase_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtbase = FormatCurrency(txtbase, 0)
txtconcepto.Enabled = True
txtconcepto.BackColor = &HC0FFFF
End Sub
Private Sub txtcambiarcc_Click()
txtccosto.Enabled = True
End Sub
'asistente cambia color y ubica cursor
Private Sub txtconcepto_AfterUpdate()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim celda As String
txtDescripcion.Enabled = True
txtDescripcion.BackColor = &HC0FFFF
txtDescripcion.SetFocus
'Placa Parqueadero
If txtconcepto = "Parqueadero" Then
celda = InputBox("Digite la placa del vehculo", "PLACA")
If celda <> "" Then
txtobservaciones = celda
txtDescripcion.SetFocus
End If
End If
'Placa vehculo combustible
If txtconcepto = "Gasolina y ACPM" Then
celda = InputBox("Digite la placa del vehculo", "PLACA")
If celda <> "" Then
txtobservaciones = celda
txtDescripcion.SetFocus
End If
End If
'Destino Anticipo viaticos
If txtconcepto = "Anticipos Viaticos" Then
celda = InputBox("Digite destino del Viaje", "CIUDAD/MUNICIPIO DESTINO")
If celda <> "" Then
txtobservaciones = celda
txtDescripcion.SetFocus
End If
End If
'Destino viaje TKT Terrestre
If txtconcepto = "Pasaje Terrestre" Then
celda = InputBox("Digite Origen-Destino Tiquete", "PASAJE EN BUS")
If celda <> "" Then
txtobservaciones.Font = 8
txtobservaciones = celda
txtDescripcion.SetFocus
End If
End If
'Destino viaje TKT sereo
If txtconcepto = "TKT Aereo" Then
celda = InputBox("Digite Origen-Destino Tiquete", "PASAJE AVION")
If celda <> "" Then
txtobservaciones.Font = 8
txtobservaciones = celda
txtDescripcion.SetFocus
End If
End If
'Pago de proveedores
If txtconcepto = "Pago Proveedores" Then
celda = InputBox("Digite el documento fuente (NF o NT)", "PAGO PROVEEDORES")
If celda <> "" Then
txtobservaciones.Font = 8
txtobservaciones = celda
txtDescripcion.SetFocus
End If
End If

End Sub
Private Sub txtconcepto_DropButtonClick()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
btnTerminar.Enabled = True
txtvalor = 0
txtiva = 0
txtneto = 0
txtretfte = 0
txtobservaciones = ""
End Sub
Private Sub txtconcepto_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If txtconcepto = "" Then
MsgBox "Campo no puede quedar vacio"
txtconcepto = "Dotaciones Empleados"
End If
End Sub
Private Sub txtconcepto_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If KeyAscii = 13 Then
txtDescripcion.Enabled = True
txtDescripcion.SetFocus
End If
End Sub

'asistente cambia color y ubica cursor


Private Sub txtDescripcion_AfterUpdate()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtTercero.Enabled = True
txtTercero.BackColor = &HC0FFFF
txtTercero.SetFocus
btnCrearT.Enabled = True
btnBuscarT.Enabled = True
If txtconcepto = "Gastos Personales" Then
txtTercero = 91252859
txtTercero.Enabled = False
txtSi.Enabled = False
txtNo.Enabled = False
End If
End Sub
'Solo mayuscula en descripcion
Private Sub txtDescripcion_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
txtTercero.Enabled = True
txtTercero.SetFocus
End If
End Sub
'Solo mayuscula en factura
Private Sub txtFactura_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
End If
End Sub
'habilita campo de fecha factura y ubica cursor en ella
Private Sub txtFactura_AfterUpdate()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtFechaFact.Enabled = True
txtFechaFact.BackColor = &HC0FFFF
On Error Resume Next
txtFechaFact.SetFocus
End Sub
'habilita campo de valor y ubica cursor en ella
Private Sub txtFechaFact_AfterUpdate()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtvalor.Enabled = True
txtvalor.BackColor = &HC0FFFF
txtvalor.SetFocus
txtvalor.SelStart = 0
If IsDate(txtFechaFact.Text) Then
Else
MsgBox "Fecha incorrecta"
txtFechaFact = ""
Me.txtFechaFact.SetFocus
End If
End Sub
Private Sub txtFechaFact_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If KeyAscii = 13 Then
txtvalor.Enabled = True
txtvalor.SetFocus
End If
End Sub
Private Sub txtimpoconsumo_AfterUpdate()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
btnAgregar.Enabled = True
txtconcepto.Enabled = False
txtDescripcion.Enabled = False
txtTercero.Enabled = False
txtTarifa.Enabled = False
txtFactura.Enabled = False
txtFechaFact.Enabled = False
txtvalor.Enabled = False
txtiva.Enabled = False
txtConceptoRet.Enabled = False
txtSi.Enabled = False
txtNo.Enabled = False
txtimpoconsumo.Enabled = False
End Sub

Private Sub txtimpoconsumo_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)


txtimpoconsumo = FormatCurrency(txtimpoconsumo, 0)
End Sub
Private Sub txtmensual_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'tipo de legalizacion
txtconsecutivo = "M" + Format(txtfecha, "ddmmyy") + Left(txtempleado, 1)
txtFactura.Enabled = False
If txtmensual.Value = True Then
lbbase = "BASE CAJA MENOR"
txtbase.Enabled = False
On Error Resume Next
txtSaldoLeg = FormatCurrency((txtbase - txtAcumulado), 0)
txtconcepto.Enabled = True
txtconcepto.BackColor = &HC0FFFF
txtconcepto.SetFocus
btnAgregar.Enabled = False
btnTerminar.Enabled = True
Else
txtconcepto.BackColor = &H80000005
End If
End Sub

'Opcion NO en iva
Private Sub txtNo_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If txtNo.Value = True Then
txtFactura = ""
txtFactura.Enabled = True
txtFactura.BackColor = &HC0FFFF
txtFactura.SetFocus
txtTarifa.Enabled = False
txtTarifa.Value = 0
txtiva = FormatCurrency("0", 0)
txtiva.Enabled = False
txtiva.BackColor = &H80000005
txtneto = ""
txtConceptoRet = ""
txtConceptoRet.Enabled = False
txtConceptoRet.BackColor = &H80000005
txtretfte = ""
txtvalor = ""
txtvalor.Enabled = False
txtvalor.BackColor = &H80000005
txtFechaFact = ""
txtFechaFact.Enabled = False
txtFechaFact.BackColor = &H80000005
txtTarifa.BackColor = &H80000004
Else
End If
End Sub
'Para gastos personales
Private Sub txtNombreTercero_AfterUpdate()
Dim celda As String
Dim celda2 As String
If txtconcepto = "Gastos Personales" Then
txtSi.Enabled = False
txtNo.Enabled = False
txtTarifa.Enabled = False
txtFactura.Enabled = True
txtFactura.BackColor = &HC0FFFF
End If
If txtconcepto = "Consignacion Bancaria" Then
txtSi.Enabled = False
txtNo.Enabled = False
txtTarifa.Enabled = False
txtFactura = "CONSIGNACION"
txtFactura.Enabled = False
txtFechaFact.Enabled = True
txtFechaFact.BackColor = &HC0FFFF
End If
If txtconcepto = "Pago Proveedores" Then
txtSi.Enabled = False
txtNo.Enabled = False
txtTarifa.Enabled = False
txtTarifa.BackColor = &H80000004
txtFactura.Enabled = True
txtFactura.BackColor = &HC0FFFF
End If
'para gastos no deducibles
If txtconcepto = "Gastos No deducibles" Then
txtSi.Enabled = False
txtNo.Enabled = False
txtTarifa.Enabled = False
txtFactura.Enabled = True
txtFactura.BackColor = &H80000004
txtFactura = "RC"
txtFactura.Enabled = False
txtFechaFact.Enabled = True
txtFechaFact.BackColor = &HC0FFFF
End If
''Para anticipos viaticos
'If txtconcepto = "Anticipos Viaticos" Then
'txtSi.Enabled = False
'txtNo.Enabled = False
'txtTarifa.Enabled = False
'txtFactura.Enabled = True
'txtFactura.BackColor = &H80000004
'celda = InputBox("Digite Forma de Pago del Anticipo", "FORMA DE PAGO: Efectivo
- Consignacin - Transferencia")
'txtFactura = celda
'txtFactura.Enabled = False
'txtFechaFact.Enabled = True
'txtFechaFact.BackColor = &HC0FFFF
'End If
'Para anticipos otros
If txtconcepto = "Anticipos Otros" Then
txtSi.Enabled = False
txtNo.Enabled = False
txtTarifa.Enabled = False
txtFactura.Enabled = True
txtFactura.BackColor = &H80000004
celda2 = InputBox("Digite Motivo de Pago del Anticipo", "MOTIVO: Caja - Gerencia
- Prstamo")
txtFactura = celda2
txtFactura.Enabled = False
txtFechaFact.Enabled = True
txtFechaFact.BackColor = &HC0FFFF
End If
End Sub
Private Sub txtobservaciones_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoo
lean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal
X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shif
t As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
End If
End Sub

'Opcion SI en iva
Private Sub txtsi_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If txtSi.Value = True Then
txtTarifa.Enabled = True
txtTarifa.BackColor = &HC0FFFF
On Error Resume Next
txtTarifa.SetFocus
txtFactura = ""
txtFactura.Enabled = False
txtFactura.BackColor = &H80000005
txtFechaFact = ""
txtFechaFact.Enabled = False
txtFechaFact.BackColor = &H80000005
txtvalor = "0"
txtvalor.Enabled = False
txtvalor.BackColor = &H80000005
txtiva = "0"
txtiva.Enabled = False
txtiva.BackColor = &H80000005
txtretfte.Text = ""
txtneto.Text = ""
txtConceptoRet = ""
txtConceptoRet.Enabled = False
txtConceptoRet.BackColor = &H80000005
Else
End If
End Sub
Private Sub txtTarifa_AfterUpdate()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtFactura.Enabled = True
txtFactura.BackColor = &HC0FFFF
txtFactura.SetFocus
End Sub
Private Sub txtTarifa_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If KeyAscii = 13 Then
txtFactura.Enabled = True
txtFactura.SetFocus
End If
End Sub
'Para gastos personales
Private Sub txtTercero_AfterUpdate()
txtSi.Enabled = True
txtNo.Enabled = True
Dim celda As String
Dim celda2 As String
'If txtconcepto = "Gastos Personales" Then
'txtSi.Enabled = False
'txtNo.Enabled = False
'txtTarifa.Enabled = False
'txtFactura.Enabled = True
'txtFactura.BackColor = &HC0FFFF
'End If
'If txtconcepto = "Consignacion Bancaria" Then
'txtSi.Enabled = False
'txtNo.Enabled = False
'txtTarifa.Enabled = False
'txtFactura = "CONSIGNACION"
'txtFactura.Enabled = False
'txtFechaFact.Enabled = True
'txtFechaFact.BackColor = &HC0FFFF
'txtFechaFact.SetFocus
'End If
If txtconcepto = "Pago Proveedores" Then
txtSi.Enabled = False
txtNo.Enabled = False
txtTarifa.Enabled = False
txtTarifa.BackColor = &H80000004
txtFactura.Enabled = True
txtFactura.BackColor = &HC0FFFF
End If

'para gastos no deducibles


'If txtconcepto = "Gastos No deducibles" Then
'txtSi.Enabled = False
'txtNo.Enabled = False
'txtTarifa.Enabled = False
'txtFactura.Enabled = True
'txtFactura.BackColor = &H80000004
'txtFactura = "RC"
'txtFactura.Enabled = False
'txtFechaFact.Enabled = True
'txtFechaFact.BackColor = &HC0FFFF
'End If
'Para anticipos viaticos
If txtconcepto = "Anticipos Viaticos" Then
txtSi.Enabled = True
txtNo.Enabled = True
txtFechaFact.Enabled = True
txtFechaFact.BackColor = &HC0FFFF
End If
'Para anticipos otros
If txtconcepto = "Anticipos Otros" Then
'txtSi.Enabled = False
'txtNo.Enabled = False
'txtTarifa.Enabled = False
txtFactura.Enabled = True
txtFactura.BackColor = &H80000004
celda2 = InputBox("Digite Motivo de Pago del Anticipo", "MOTIVO: Caja - Gerencia
- Prstamo")
txtFactura = celda
txtFactura.Enabled = False
txtFechaFact.Enabled = True
txtFechaFact.BackColor = &HC0FFFF
End If

End Sub
'Arroja el nombre del tercero
Private Sub txttercero_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
txtSi.Enabled = True
txtNo.Enabled = True
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim tercero As String
Dim nombretercero As String
Application.ScreenUpdating = False
On Error Resume Next
tercero = txtTercero.Value
Hoja4.Visible = xlSheetVisible
Hoja4.Select
Range("B8").Select
Range(Selection, Selection.End(xlDown)).Select
If ActiveCell.Value <> "" Then
While ActiveCell.Value <> tercero
ActiveCell.Offset(1, 0).Select
Wend
ActiveCell.Offset(0, 2).Select
nombretercero = ActiveCell.Value
txtNombreTercero = nombretercero
Else
MsgBox "Tercero no existe", vbExclamation
Hoja4.Visible = xlSheetHidden
Exit Sub
End If
Hoja4.Visible = xlSheetHidden
Hoja1.Select
Application.ScreenUpdating = True

End Sub
Private Sub txtTercero_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If KeyAscii = 13 Then
txtSi.Value = True
End If
End Sub
'limitar a solo numeros campo valor
Private Sub txtvalor_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Call solo_numeros
End Sub
'limitar a solo numeros campo iva
Private Sub txtiva_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Call solo_numeros
End Sub
'limitar a solo numeros campo base
Private Sub txtbase_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Call solo_numeros
End Sub
'limitar a solo numeros campo impoconsumo
Private Sub txtimpoconsumo_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Call solo_numeros
End Sub

Private Sub UserForm_Initialize()


Application.ScreenUpdating = False
Application.DisplayAlerts = False
Call limpiar_formulario

'Muestra lista de conceptos de pago (gastos)


Worksheets("Base").Visible = True
Worksheets("Base").Select
Range("E3").Select
Range(Selection, Selection.End(xlDown)).Select
Dim celda As Range
For Each celda In Selection
txtconcepto.AddItem celda.Value
Range("E9").Select
Next celda
'Muestra lista de conceptos de retefuente
Worksheets("Base").Visible = True
Worksheets("Base").Select
Range("G3").Select
Range(Selection, Selection.End(xlDown)).Select
Dim celda2 As Range
For Each celda2 In Selection
txtConceptoRet.AddItem celda2.Value
Range("G3").Select
Next celda2
'Muestra lista de tarifas de iva
Worksheets("Base").Visible = True
Worksheets("Base").Select
Range("P2").Select
Range(Selection, Selection.End(xlDown)).Select
Dim celda3 As Range
For Each celda3 In Selection
txtTarifa.AddItem celda3.Value
Range("P2").Select
Next celda3
txtnit = FRMCaja.txtTercero
'Muestra nit proveedores
Worksheets("Base").Visible = True
Worksheets("Base").Select
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Dim celda4 As Range
For Each celda4 In Selection
txtTercero.AddItem celda4.Value
Range("A2").Select
Next celda4
'Muestra nombre proveedores
Worksheets("Base").Visible = True
Worksheets("Base").Select
Range("B2").Select
Range(Selection, Selection.End(xlDown)).Select
Dim celda5 As Range
For Each celda5 In Selection
txtNombreTercero.AddItem celda5.Value
Range("B2").Select
Next celda5
'muestra fecha actual
txtfecha = Date
End Sub
'Boton buscar tercero
Private Sub btnBuscarT_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtNombreTercero.Enabled = True
txtTercero = ""
End Sub
'Inactiva casilla de nombre de tercero
Private Sub txtNombreTercero_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtNombreTercero.Enabled = False
Dim tercero As String
Dim nombretercero As String
Application.ScreenUpdating = False
On Error Resume Next
nombretercero = txtNombreTercero.Value
Hoja4.Visible = xlSheetVisible
Hoja4.Select
Range("D8").Select
Range(Selection, Selection.End(xlDown)).Select
If ActiveCell.Value <> "" Then
While ActiveCell.Value <> nombretercero
ActiveCell.Offset(1, 0).Select
Wend
ActiveCell.Offset(0, -2).Select
tercero = ActiveCell.Value
txtTercero = tercero
Else
MsgBox "Tercero no existe", vbExclamation
Hoja4.Visible = xlSheetHidden
Exit Sub
End If
Hoja4.Visible = xlSheetHidden
Hoja1.Select
txtSi.Enabled = True
txtNo.Enabled = True
Application.ScreenUpdating = True
End Sub
'Activa casilla de retefuente
Sub txtConceptoRet_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
txtretfte.BackColor = &H80000005
If txtConceptoRet = "Ret. Compras 2.5%" Then
txtretfte = FormatCurrency(txtvalor * 2.5 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Compras 3.5%" Then
txtretfte = FormatCurrency(txtvalor * 3.5 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Hospedaje 3.5%" Then
txtretfte = FormatCurrency(txtvalor * 3.5 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Restaurante 3.5%" Then
txtretfte = FormatCurrency(txtvalor * 3.5 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Servicios 4%" Then
txtretfte = FormatCurrency(txtvalor * 4 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Servicios 6%" Then
txtretfte = FormatCurrency(txtvalor * 6 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Fletes 1%" Then
txtretfte = FormatCurrency(txtvalor * 1 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Combustible 0.1%" Then
txtretfte = FormatCurrency(txtvalor * 0.1 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Alquiler Equipos/Herramientas 4%" Then
txtretfte = FormatCurrency(txtvalor * 4 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Arriendos Inmuebles 3.5%" Then
txtretfte = FormatCurrency(txtvalor * 3.5 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
ElseIf txtConceptoRet = "Ret. Alquiler Equipos Oficina 4%" Then
txtretfte = FormatCurrency(txtvalor * 4 / 100, 0)
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva + txtimpoconsumo, 0)
End If
'Impuesto al consumo
If txtconcepto = "Servicio Comedor" _
And txtTarifa = 0 Then
respuesta = MsgBox("El Servicio de Restaurante es gravado de Impoconsumo, Desea
Aplicar?", vbYesNo, "IMPUESTO AL CONSUMO")
If respuesta = vbYes Then
txtimpoconsumo.Enabled = True
txtimpoconsumo.BackColor = &HC0FFFF
txtimpoconsumo.SetFocus
btnAgregar.Enabled = False
Else
'ElseIf respuesta = vbNo Then
MsgBox ("Nota: Los restaurantes y panaderias estan obligados a cobrar el Impuest
o al consumo, Favor revisar"), vbInformation
txtimpconsumo = "0"
txtimpoconsumo.Enabled = False
btnAgregar.Enabled = True
End If
End If

End Sub
'devuelve inactiva la casilla de retencion
Private Sub txtConceptoRet_DropButtonClick()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtretfte.Enabled = False
txtretfte.BackColor = &H80000004
txtretfte = ""
txtneto = ""
End Sub
'totaliza y solicita retencion si da a lugar
Private Sub txtvalor_AfterUpdate()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If txtTarifa = 0 And txtconcepto <> "Servicio Comedor" Then
btnAgregar.Enabled = True
txtconcepto.Enabled = False
txtDescripcion.Enabled = False
txtTercero.Enabled = False
txtTarifa.Enabled = False
txtFactura.Enabled = False
txtFechaFact.Enabled = False
txtvalor.Enabled = False
txtiva.Enabled = False
txtConceptoRet.Enabled = False
txtSi.Enabled = False
txtNo.Enabled = False
txtimpoconsumo.Enabled = False
End If

btnAgregar.Enabled = True
btnCorregir.Enabled = True
txtvalor = FormatCurrency(txtvalor, 0)
On Error Resume Next
txtneto = FormatCurrency(txtvalor, 0)
txtretfte = FormatCurrency(0, 0)
txtimpoconsumo = FormatCurrency(0, 0)
If txtSi.Value = True And txtTarifa <> 0 Then
txtiva.Enabled = True
txtiva.BackColor = &HC0FFFF
txtiva.SetFocus
End If

If txtSi.Value = True And txtretfte = "" Then


txtretfte = 0
txtiva.Enabled = False
txtiva.SetFocus
End If
If txtConceptoRet = "" And txtNo.Value = True And txtconcepto <> "Servicio Comed
or" = True Then
txtconcepto.Enabled = False
txtDescripcion.Enabled = False
txtTercero.Enabled = False
txtTarifa.Enabled = False
txtFactura.Enabled = False
txtFechaFact.Enabled = False
txtvalor.Enabled = False
txtiva.Enabled = False
txtConceptoRet.Enabled = False
txtSi.Enabled = False
txtNo.Enabled = False
btnAgregar.Enabled = True
End If
End Sub
'limpia campos de retefuente-concepto ret-neto e iva
Private Sub txtvalor_Change()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
txtretfte = ""
txtConceptoRet = ""
txtConceptoRet.Enabled = False
txtretfte.Enabled = False
txtneto = ""
End Sub
'Formato para iva
Private Sub txtiva_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
txtiva = FormatCurrency(txtiva, 0)
End Sub
'suma valor menos retefuente mas iva
Private Sub txtiva_AfterUpdate()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If txtretfte = 0 Then
txtneto = FormatCurrency((txtvalor - txtretfte) + txtiva, 0)
btnAgregar.Enabled = True
txtconcepto.Enabled = False
txtDescripcion.Enabled = False
txtTercero.Enabled = False
txtTarifa.Enabled = False
txtFactura.Enabled = False
txtFechaFact.Enabled = False
txtvalor.Enabled = False
txtiva.Enabled = False
txtConceptoRet.Enabled = False
txtSi.Enabled = False
txtNo.Enabled = False
txtimpoconsumo.Enabled = False
End If
End Sub
'Formato para fecha factura
Private Sub txtFechaFact_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal S
hift As Integer)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Select Case Len(txtFechaFact.Value)
Case 2
txtFechaFact.Value = txtFechaFact.Value & "/"
Case 5
txtFechaFact.Value = txtFechaFact.Value & "/"
End Select
If Len(txtFechaFact) > 10 Then Cancel = True
End Sub
'bloquea el boton de cerrar del formulario
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
End If
End Sub
'Solo mayuscula en obsrvaciones
Private Sub txtobservaciones_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
End If
End Sub
'Agregar Datos al formato
Private Sub btnAgregar_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim respuesta As Variant
Dim respuesta1 As Variant
Dim Respuesta2 As Variant
'Validacion retencion para compras
If txtconcepto = "Dotaciones Empleados" And txtvalor >= 860000 And txtretfte = 0
Or _
txtconcepto = "Elementos de Seguridad Industrial" And txtvalor >= 860000 And txt
retfte = 0 Or _
txtconcepto = "Repuestos Maquinaria" And txtvalor >= 860000 And txtretfte = 0 Or
_
txtconcepto = "Repuestos Vehculos" And txtvalor >= 860000 And txtretfte = 0 Or _
txtconcepto = "Lubricantes" And txtvalor >= 860000 And txtretfte = 0 Or _
txtconcepto = "Beneficios Empleados" And txtvalor >= 860000 And txtretfte = 0 Or
_
txtconcepto = "Repuestos Vehculos" And txtvalor.Value >= 860000 And txtretfte = 0
Or _
txtconcepto = "Materiales Construccin" And txtvalor >= 860000 And txtretfte = 0 O
r _
txtconcepto = "Herramientas Construccin" And txtvalor >= 860000 And txtretfte = 0
Or _
txtconcepto = "Obsequios a Terceros" And txtvalor >= 860000 And txtretfte = 0 Or
_
txtconcepto = "Agua y Hielo" And txtvalor >= 860000 And txtretfte = 0 Or _
txtconcepto = "Elementos de Aseo" And txtvalor >= 860000 And txtretfte = 0 Or _
txtconcepto = "Papeleria y Fotocopias" And txtvalor >= 860000 And txtretfte = 0
Or _
txtconcepto = "Alquiler Equipos/Herramientas" And txtvalor.Value >= 0 And txtret
fte = 0 Or _
txtconcepto = "Alquiler Equipos de Oficina" And txtvalor.Value >= 0 And txtretft
e = 0 Or _
txtconcepto = "Alquiler de Vehculos" And txtvalor.Value >= 0 And txtretfte = 0 Or
_
txtconcepto = "Arriendos Inmuebles" And txtvalor.Value >= 860000 And txtretfte =
0 Or _
txtconcepto = "Servicios de Aseo" And txtvalor.Value >= 127000 And txtretfte = 0
Or _
txtconcepto = "Mantenimiento Maquinaria" And txtvalor.Value >= 127000 And txtret
fte = 0 Or _
txtconcepto = "Mantenimiento Vehculos" And txtvalor.Value >= 127000 And txtretfte
= 0 Or _
txtconcepto = "Mantenimiento Computadores" And txtvalor.Value >= 127000 And txtr
etfte = 0 Or _
txtconcepto = "Parqueadero" And txtvalor.Value >= 127000 And txtretfte = 0 Or _
txtconcepto = "Encomiendas" And txtvalor.Value >= 127000 And txtretfte = 0 Or _
txtconcepto = "Fletes" And txtvalor.Value >= 127000 And txtretfte = 0 Or _
txtconcepto = "Hospedaje" And txtvalor.Value >= 127000 And txtretfte = 0 Then
respuesta = MsgBox("El valor cumple la base de retencin, Desea Aplicar?", vbYesNo
Cancel, "Retencin en la Fuente")
Select Case respuesta
Case vbYes:
txtConceptoRet.Enabled = True
txtConceptoRet.BackColor = &HC0FFFF
txtConceptoRet.SetFocus
txtretfte.Enabled = False
Case vbNo:
MsgBox ("Nota: Tenga en cuenta que le seran cargadas las retenciones
no aplicadas de ser necesario"), vbCritical
txtretfte = "0"
txtConceptoRet.Enabled = False
Call grabar_formulario
End Select
ElseIf txtconcepto = "Servicio de internet" And txtvalor.Value >= 127000 And txt
retfte = 0 Then
respuesta = MsgBox("El valor cumple la base de retencin, Desea Aplicar?", vbYesNo
Cancel, "Retencin en la Fuente")
Select Case respuesta
Case vbYes:
txtConceptoRet.Enabled = True
txtConceptoRet.BackColor = &HC0FFFF
txtConceptoRet.SetFocus
txtretfte.Enabled = False
Case vbNo:
MsgBox ("Nota: Tenga en cuenta que le seran cargadas las retenciones
no aplicadas de ser necesario"), vbCritical
txtretfte = "0"
txtConceptoRet.Enabled = False
Call grabar_formulario
End Select
ElseIf txtconcepto = "Servicio Comedor" And txtvalor.Value >= 127000 And txtretf
te = 0 Then
respuesta1 = MsgBox("El valor cumple la base de retencin, Desea Aplicar?", vbYesN
oCancel, "Retencin en la Fuente")
Select Case respuesta1
Case vbYes:
txtConceptoRet.Enabled = True
txtConceptoRet.BackColor = &HC0FFFF
txtConceptoRet.SetFocus
txtretfte.Enabled = False
Case vbNo:
MsgBox ("Nota: Tenga en cuenta que le seran cargadas las retenciones
no aplicadas de ser necesario"), vbCritical
txtretfte = "0"
txtConceptoRet.Enabled = False
Call grabar_formulario
End Select
ElseIf txtconcepto = "Servicio Comedor" And txtTarifa = 0 And txtimpoconsumo = 0
Then
Respuesta2 = MsgBox("El Servicio de Restaurante es gravado de Impoconsumo, Desea
Aplicar?", vbYesNo, "IMPUESTO AL CONSUMO")
Select Case Respuesta2
Case vbYes:
txtimpoconsumo.Enabled = True
txtimpoconsumo.BackColor = &HC0FFFF
txtimpoconsumo.SetFocus
Case vbNo:
MsgBox ("Nota: Los restaurantes y panaderias estan obligados a cobrar el
Impuesto al consumo, Favor revisar"), vbInformation
txtimpconsumo = "0"
txtimpoconsumo.Enabled = False
Call grabar_formulario
btnAgregar.Enabled = False
btnTerminar.Enabled = True
End Select
Else
Call grabar_formulario
btnAgregar.Enabled = False
btnTerminar.Enabled = True
End If

'muestra informacin el el listbox


Dim fila, a, i As Integer
Dim tot As Long
ListBox1.Clear
ListBox1.AddItem "Codigo"
ListBox1.List(0, 0) = "Concepto"
ListBox1.List(0, 1) = "Descripcin"
ListBox1.List(0, 2) = "Tercero"
ListBox1.List(0, 3) = "Fecha"
ListBox1.List(0, 4) = "Factura"
ListBox1.List(0, 5) = "Valor"
ListBox1.List(0, 6) = "Iva"
ListBox1.List(0, 7) = "Ipoconsumo"
ListBox1.List(0, 8) = "Ret.Fte"
ListBox1.List(0, 9) = "Neto"
ListBox1.TextAlign = fmTextAlignLeft
ListBox1.ColumnCount = 10
ListBox1.ColumnWidths = "110 pt;150 pt; 150 pt;60 pt; 70 pt; 45 pt; 45 pt; 55 pt
; 45 pt; 60 pt"
a = 12
fila = 12
'Bucle mientras la fila no est vacia
While ActiveSheet.Cells(fila, 1) <> Empty

a = ListBox1.ListCount
ListBox1.AddItem
ListBox1.List(a, 0) = ActiveSheet.Cells(fila, 1)
ListBox1.List(a, 1) = ActiveSheet.Cells(fila, 2)
ListBox1.List(a, 2) = ActiveSheet.Cells(fila, 4)
ListBox1.List(a, 3) = ActiveSheet.Cells(fila, 6)
ListBox1.List(a, 4) = ActiveSheet.Cells(fila, 7)
ListBox1.List(a, 5) = FormatCurrency(ActiveSheet.Cells(fila, 8), 0)
ListBox1.List(a, 6) = FormatCurrency(ActiveSheet.Cells(fila, 9), 0)
ListBox1.List(a, 7) = FormatCurrency(ActiveSheet.Cells(fila, 11), 0)
ListBox1.List(a, 8) = FormatCurrency(ActiveSheet.Cells(fila, 12), 0)
ListBox1.List(a, 9) = ActiveSheet.Cells(fila, 14)
tot = 0
For i = 0 To ListBox1.ListCount - 1
tot = tot + Val(ListBox1.List(i, 9))
Next i
txtAcumulado = FormatCurrency(tot, 0)
On Error Resume Next
txtSaldoLeg = FormatCurrency(txtbase - txtAcumulado, 0)
'Aumento la fila para que pase a la siguiente
fila = fila + 1
Wend
'Devuelvo movimientos de la pantalla
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
ActiveSheet.DisplayPageBreaks = True
Application.CutCopyMode = False
End Sub

'boton terminar
Private Sub btnTerminar_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim respuesta As Variant
Dim Respuesta2 As Variant
respuesta = MsgBox("Desea ciere definitivo de la planilla actual?", vbYesNo)
Select Case respuesta
Case vbYes:
Hojas = Sheets.Count
Hoja7.Copy After:=Sheets(Hojas)
ActiveSheet.Name = txtconsecutivo
Call limpiar_plantilla
Call borrar_filas_en_blanco
Call cerrar_plano
Call grabar_hoja_plano
Call limpiar_plano
btnTerminar.Enabled = False
MsgBox ("El Formulario se guard con el nmero: " + txtconsecutivo), vbI
nformation
Me.Hide
Hoja1.Visible = xlSheetVeryHidden
Hoja7.Visible = xlSheetVeryHidden
Hoja11.Visible = xlSheetVeryHidden
Case vbNo:
Exit Sub
Me.Hide
End Select
End Sub

'Funcion para grabar la informacion en el formato


Function grabar_formulario()
Dim f As Single
Dim valor As Double
Dim saldoleg As Double
valor = txtvalor
saldoleg = txtSaldoLeg
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Hoja7.Visible = xlSheetVisible
Hoja7.Select
ActiveSheet.Select
Range("A11").Select
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value <> "" Then
Range("A11").End(xlDown).Select
f = ActiveCell.Row + 1
Else
f = 12
End If
Call desbloquear
If valor > saldoleg Then
MsgBox ("Valor supera saldo disponible"), vbCritical
Else
Range("L4").Value = txtconsecutivo
Range("H8").Value = Format(txtfecha, "LONG DATE")
Range("N10").Value = FormatCurrency(txtbase, 0)
Range("A" & f) = txtconcepto
Range("B" & f) = txtDescripcion
Range("C" & f) = txtobservaciones
Range("D" & f) = txtNombreTercero
Range("E" & f) = txtTercero
Range("F" & f) = txtFechaFact
Range("G" & f) = txtFactura
Range("H" & f) = txtvalor.Value
Range("I" & f) = txtiva.Value
Range("J" & f) = txtTarifa
Range("K" & f) = txtimpoconsumo.Value
Range("L" & f) = txtretfte.Value
If txtConceptoRet = "Ret. Compras 2.5%" Then
Range("M" & f) = 2.5
ElseIf txtConceptoRet = "Ret. Compras 3.5%" Then
Range("M" & f) = 3.5
ElseIf txtConceptoRet = "Ret. Hospedaje 3.5%" Then
Range("M" & f) = 3.5
ElseIf txtConceptoRet = "Ret. Restaurante 3.5%" Then
Range("M" & f) = 3.5
ElseIf txtConceptoRet = "Ret. Servicios 4%" Then
Range("M" & f) = 4
ElseIf txtConceptoRet = "Ret. Servicios 6%" Then
Range("M" & f) = 6
ElseIf txtConceptoRet = "Ret. Fletes 1%" Then
Range("M" & f) = 1
ElseIf txtConceptoRet = "Ret. Combustible 0.1%" Then
Range("M" & f) = 0.1
ElseIf txtConceptoRet = "Ret. Alquiler Equipos/Herramientas 4%" Then
Range("M" & f) = 4
ElseIf txtConceptoRet = "Ret. Arriendos Inmuebles 3.5%" Then
Range("M" & f) = 3.5
ElseIf txtConceptoRet = "Ret. Alquiler Equipos Oficina 4%" Then
Range("M" & f) = 4
End If
Range("N" & f) = txtneto.Value
Call grabar_plano
Call iva
Call ipoconsumo
Call retencion
Call combustible
Hoja5.Visible = xlSheetVeryHidden
Hoja7.Visible = xlSheetVisible
Hoja7.Select
ActiveSheet.Select
Selection.ListObject.ListRows.Add AlwaysInsert:=False
If txtanticipo.Value = True Then
Range("C2").Value = "ANTICIPO"
ElseIf txtmensual.Value = True Then
Range("C2").Value = "CAJA MENOR"
End If
MsgBox ("Datos agregados con xito")
btnAgregar.Enabled = False
btnTerminar.Enabled = True
Call desbloquear
Call limpiar_formulario
End If
'listo para ingresar otro concepto
If txtanticipo.Value = True Then
txtbase.Enabled = False
txtanticipo.Enabled = False
txtconcepto.Enabled = True
txtconcepto = ""
txtconcepto.BackColor = &HC0FFFF
txtconcepto.SetFocus
ElseIf txtmensual.Value = True Then
txtbase.Enabled = False
txtanticipo.Enabled = False
txtconcepto.Enabled = True
txtconcepto = ""
txtconcepto.BackColor = &HC0FFFF
txtconcepto.SetFocus
End If
End Function
'Funcion para limpiar y reiniciar el formulario
Function limpiar_formulario()
If txtanticipo.Value = True Then
txtbase.Enabled = False
txtanticipo.Enabled = False
txtconcepto.Enabled = True
txtconcepto.BackColor = &HC0FFFF
txtconcepto.SetFocus
txtmensual.Value = False
txtDescripcion = ""
txtDescripcion.BackColor = &H80000005
txtDescripcion.Enabled = False
txtTercero = ""
txtTercero.BackColor = &H80000005
txtTercero.Enabled = False
txtTarifa = ""
txtTarifa.BackColor = &H80000004
txtTarifa.Enabled = False
txtFactura = ""
txtFactura.BackColor = &H80000005
txtFactura.Enabled = False
txtFechaFact = ""
txtFechaFact.BackColor = &H80000005
txtFechaFact.Enabled = False
txtvalor = ""
txtvalor.BackColor = &H80000005
txtvalor.Enabled = False
txtiva = ""
txtiva.BackColor = &H80000004
txtiva.Enabled = False
txtimpoconsumo = ""
txtimpoconsumo.BackColor = &H80000004
txtimpoconsumo.Enabled = False
txtConceptoRet = ""
txtConceptoRet.BackColor = &H80000005
txtConceptoRet.Enabled = False
txtretfte = ""
txtretfte.BackColor = &H80000004
txtretfte.Enabled = False
txtneto = ""
txtobservaciones = ""
txtSi.Value = False
txtSi.Enabled = False
txtNo.Value = False
txtNo.Enabled = False
btnCrearT.Enabled = False
btnBuscarT.Enabled = False
ElseIf txtmensual.Value = True Then
txtbase.Enabled = False
txtanticipo.Enabled = False
txtconcepto.Enabled = True
txtconcepto.BackColor = &HC0FFFF
txtconcepto.SetFocus
txtmensual.Value = False
txtDescripcion = ""
txtDescripcion.BackColor = &H80000005
txtDescripcion.Enabled = False
txtTercero = ""
txtTercero.BackColor = &H80000005
txtTercero.Enabled = False
txtTarifa = ""
txtTarifa.BackColor = &H80000004
txtTarifa.Enabled = False
txtFactura = ""
txtFactura.BackColor = &H80000005
txtFactura.Enabled = False
txtFechaFact = ""
txtFechaFact.BackColor = &H80000005
txtFechaFact.Enabled = False
txtvalor = ""
txtvalor.BackColor = &H80000005
txtvalor.Enabled = False
txtiva = ""
txtiva.BackColor = &H80000004
txtiva.Enabled = False
txtimpoconsumo = ""
txtimpoconsumo.BackColor = &H80000004
txtimpoconsumo.Enabled = False
txtConceptoRet = ""
txtConceptoRet.BackColor = &H80000005
txtConceptoRet.Enabled = False
txtretfte = ""
txtretfte.BackColor = &H80000004
txtretfte.Enabled = False
txtneto = ""
txtobservaciones = ""
txtSi.Value = False
txtSi.Enabled = False
txtNo.Value = False
txtNo.Enabled = False
btnCrearT.Enabled = False
btnBuscarT.Enabled = False

Else
txtmensual.Value = False
txtanticipo.Value = False
txtconcepto = ""
txtconcepto.Enabled = False
txtconcepto.BackColor = &H80000005
txtDescripcion = ""
txtDescripcion.BackColor = &H80000005
txtDescripcion.Enabled = False
txtTercero = ""
txtTercero.BackColor = &H80000005
txtTercero.Enabled = False
txtTarifa = ""
txtTarifa.BackColor = &H80000004
txtTarifa.Enabled = False
txtFactura = ""
txtFactura.BackColor = &H80000005
txtFactura.Enabled = False
txtFechaFact = ""
txtFechaFact.BackColor = &H80000005
txtFechaFact.Enabled = False
txtvalor = ""
txtvalor.BackColor = &H80000005
txtvalor.Enabled = False
txtiva = ""
txtiva.BackColor = &H80000004
txtiva.Enabled = False
txtimpoconsumo = ""
txtimpoconsumo.BackColor = &H80000004
txtimpoconsumo.Enabled = False
txtConceptoRet = ""
txtConceptoRet.BackColor = &H80000005
txtConceptoRet.Enabled = False
txtretfte = ""
txtretfte.BackColor = &H80000004
txtretfte.Enabled = False
txtneto = ""
txtobservaciones = ""
txtSi.Value = False
txtSi.Enabled = False
txtNo.Value = False
txtNo.Enabled = False
btnCrearT.Enabled = False
btnBuscarT.Enabled = False
End If
End Function
'Funcion solo numeros
Function solo_numeros()
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
End Function
Function limpiar_plantilla()
Hoja7.Visible = xlSheetVisible
Hoja7.Select
Call desbloquear
Hoja7.Range("A12:N12").Select
Hoja7.Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Hoja7.Range("A12").Select
ActiveSheet.ListObjects("FormatoCajaMenor6").Resize Range("$A$11:$N$13")
Hoja7.Range("FormatoCajaMenor6[Concepto]").Select
End Function
Function grabar_plano()
Dim G As Single
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Hoja5.Visible = xlSheetVisible
Hoja5.Select
ActiveSheet.Select
Range("D1").Select
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value <> "" Then
Range("D1").End(xlDown).Select
G = ActiveCell.Row + 1
Else
G = 2
End If
Call desbloquear
Range("C" & G) = txtconcepto
If txtconcepto = "Agua y Hielo" And txtccosto = "002001" Then
Range("D" & G) = "519560"
ElseIf txtconcepto = "Agua y Hielo" And txtccosto = "001009" Then
Range("D" & G) = "529560"
ElseIf txtconcepto = "Agua y Hielo" Then
Range("D" & G) = "739518"
End If
If txtconcepto = "Alquiler Equipos de Oficina" And txtccosto = "002001" Then
Range("D" & G) = "512020"
ElseIf txtconcepto = "Alquiler Equipos de Oficina" And txtccosto = "001009" Then
Range("D" & G) = "522020"
ElseIf txtconcepto = "Alquiler Equipos de Oficina" Then
Range("D" & G) = "732004"
End If
If txtconcepto = "Alquiler Equipos/Herramientas" And txtccosto = "002001" Then
Range("D" & G) = "512015"
ElseIf txtconcepto = "Alquiler Equipos/Herramientas" And txtccosto = "001009" Th
en
Range("D" & G) = "522015"
ElseIf txtconcepto = "Alquiler Equipos/Herramientas" Then
Range("D" & G) = "732002"
End If
If txtconcepto = "Anticipos Otros" Then
Range("D" & G) = "13309501"
End If
If txtconcepto = "Anticipos Viaticos" Then
Range("D" & G) = "13301501"
End If
If txtconcepto = "Arriendos Inmuebles" And txtccosto = "002001" Then
Range("D" & G) = "512010"
ElseIf txtconcepto = "Arriendos Inmuebles" And txtccosto = "001009" Then
Range("D" & G) = "522010"
ElseIf txtconcepto = "Arriendos Inmuebles" Then
Range("D" & G) = "732001"
End If
If txtconcepto = "Autenticaciones" And txtccosto = "002001" Then
Range("D" & G) = "514005"
ElseIf txtconcepto = "Autenticaciones" And txtccosto = "001009" Then
Range("D" & G) = "524005"
ElseIf txtconcepto = "Autenticaciones" Then
Range("D" & G) = "73350205"
End If
If txtconcepto = "Avisos" And txtccosto = "002001" Then
Range("D" & G) = "51959501"
ElseIf txtconcepto = "Avisos" And txtccosto = "001009" Then
Range("D" & G) = "52959501"
ElseIf txtconcepto = "Avisos" Then
Range("D" & G) = "739508"
End If
If txtconcepto = "Beneficios Empleados" And txtccosto = "002001" Then
Range("D" & G) = "510549"
ElseIf txtconcepto = "Beneficios Empleados" And txtccosto = "001009" Then
Range("D" & G) = "520549"
ElseIf txtconcepto = "Beneficios Empleados" Then
Range("D" & G) = "739510"
End If
If txtconcepto = "Cafeteria" And txtccosto = "002001" Then
Range("D" & G) = "519560"
ElseIf txtconcepto = "Cafeteria" And txtccosto = "001009" Then
Range("D" & G) = "529560"
ElseIf txtconcepto = "Cafeteria" Then
Range("D" & G) = "739501"
End If
If txtconcepto = "Certificados de Cmara Cio." And txtccosto = "002001" Then
Range("D" & G) = "514095"
ElseIf txtconcepto = "Certificados de Cmara Cio." And txtccosto = "001009" Then
Range("D" & G) = "524095"
ElseIf txtconcepto = "Certificados de Cmara Cio." Then
Range("D" & G) = "739502"
End If
If txtconcepto = "Comparendos/Multas" Then
Range("D" & G) = "539520"
End If
If txtconcepto = "Comision Giros/Consignaciones" And txtccosto = "002001" Then
Range("D" & G) = "519505"
ElseIf txtconcepto = "Comision Giros/Consignaciones" And txtccosto = "001009" Th
en
Range("D" & G) = "529505"
ElseIf txtconcepto = "Comision Giros/Consignaciones" Then
Range("D" & G) = "739508"
End If
If txtconcepto = "Derechos RUNT" And txtccosto = "002001" Then
Range("D" & G) = "514095"
ElseIf txtconcepto = "Derechos RUNT" And txtccosto = "001009" Then
Range("D" & G) = "524095"
ElseIf txtconcepto = "Derechos RUNT" Then
Range("D" & G) = "734502"
End If
If txtconcepto = "Dotaciones Empleados" And txtccosto = "002001" Then
Range("D" & G) = "510551"
ElseIf txtconcepto = "Dotaciones Empleados" And txtccosto = "001009" Then
Range("D" & G) = "520551"
ElseIf txtconcepto = "Dotaciones Empleados" Then
Range("D" & G) = "730504"
End If
If txtconcepto = "Elementos de Aseo" And txtccosto = "002001" Then
Range("D" & G) = "519525"
ElseIf txtconcepto = "Elementos de Aseo" And txtccosto = "001009" Then
Range("D" & G) = "529525"
ElseIf txtconcepto = "Elementos de Aseo" Then
Range("D" & G) = "739501"
End If
If txtconcepto = "Elementos de Seguridad Industrial" And txtccosto = "002001" Th
en
Range("D" & G) = "510551"
ElseIf txtconcepto = "Elementos de Seguridad Industrial" And txtccosto = "001009
" Then
Range("D" & G) = "520551"
ElseIf txtconcepto = "Elementos de Seguridad Industrial" Then
Range("D" & G) = "730506"
End If
If txtconcepto = "Encomiendas" And txtccosto = "002001" Then
Range("D" & G) = "513540"
ElseIf txtconcepto = "Encomiendas" And txtccosto = "001009" Then
Range("D" & G) = "523540"
ElseIf txtconcepto = "Encomiendas" Then
Range("D" & G) = "73350202"
End If
If txtconcepto = "Fletes" And txtccosto = "002001" Then
Range("D" & G) = "513550"
ElseIf txtconcepto = "Fletes" And txtccosto = "001009" Then
Range("D" & G) = "523550"
ElseIf txtconcepto = "Fletes" Then
Range("D" & G) = "73350204"
End If
If txtconcepto = "Gasolina y ACPM" And txtccosto = "002001" Then
Range("D" & G) = "519535"
ElseIf txtconcepto = "Gasolina y ACPM" And txtccosto = "001009" Then
Range("D" & G) = "529535"
ElseIf txtconcepto = "Gasolina y ACPM" Then
Range("D" & G) = "739503"
End If
If txtconcepto = "Gastos Legales" And txtccosto = "002001" Then
Range("D" & G) = "514005"
ElseIf txtconcepto = "Gastos Legales" And txtccosto = "001009" Then
Range("D" & G) = "524005"
ElseIf txtconcepto = "Gastos Legales" Then
Range("D" & G) = "739502"
End If
If txtconcepto = "Gastos Medicos y Medicamentos" And txtccosto = "002001" Then
Range("D" & G) = "510584"
ElseIf txtconcepto = "Gastos Legales" And txtccosto = "001009" Then
Range("D" & G) = "520584"
ElseIf txtconcepto = "Gastos Legales" Then
Range("D" & G) = "720503"
End If
If txtconcepto = "Gastos No deducibles" Then
Range("D" & G) = "53959502"
End If
If txtconcepto = "Comision Retiro Cajero" Then
Range("D" & G) = "53959502"
End If
If txtconcepto = "Gastos Personales" Then
Range("D" & G) = "21950501"
End If
If txtconcepto = "Herramientas Construccin" And txtccosto = "002001" Then
Range("D" & G) = "51959507"
ElseIf txtconcepto = "Herramientas Construccin" And txtccosto = "001009" Then
Range("D" & G) = "52959507"
ElseIf txtconcepto = "Herramientas Construccin" Then
Range("D" & G) = "739512"
End If
If txtconcepto = "Hospedaje" And txtccosto = "002001" Then
Range("D" & G) = "515505"
ElseIf txtconcepto = "Hospedaje" And txtccosto = "001009" Then
Range("D" & G) = "525505"
ElseIf txtconcepto = "Hospedaje" Then
Range("D" & G) = "735501"
End If
If txtconcepto = "Impuestos Asumidos" Then
Range("D" & G) = "53152004"
End If
If txtconcepto = "Lubricantes" And txtccosto = "002001" Then
Range("D" & G) = "519535"
ElseIf txtconcepto = "Lubricantes" And txtccosto = "001009" Then
Range("D" & G) = "529535"
ElseIf txtconcepto = "Lubricantes" Then
Range("D" & G) = "739504"
End If
If txtconcepto = "Mantenimiento Maquinaria" And txtccosto = "002001" Then
Range("D" & G) = "514515"
ElseIf txtconcepto = "Mantenimiento Maquinaria" And txtccosto = "001009" Then
Range("D" & G) = "524515"
ElseIf txtconcepto = "Mantenimiento Maquinaria" Then
Range("D" & G) = "734501"
End If
If txtconcepto = "Mantenimiento Vehculos" And txtccosto = "002001" Then
Range("D" & G) = "514540"
ElseIf txtconcepto = "Mantenimiento Vehculos" And txtccosto = "001009" Then
Range("D" & G) = "524540"
ElseIf txtconcepto = "Mantenimiento Vehculos" Then
Range("D" & G) = "734502"
End If
If txtconcepto = "Materiales Construccin" And txtccosto = "002001" Then
Range("D" & G) = "51959507"
ElseIf txtconcepto = "Materiales Construccin" And txtccosto = "001009" Then
Range("D" & G) = "52959507"
ElseIf txtconcepto = "Materiales Construccin" Then
Range("D" & G) = "739511"
End If
If txtconcepto = "Obsequios a Terceros" And txtccosto = "002001" Then
Range("D" & G) = "51959505"
ElseIf txtconcepto = "Obsequios a Terceros" And txtccosto = "001009" Then
Range("D" & G) = "52959505"
ElseIf txtconcepto = "Obsequios a Terceros" Then
Range("D" & G) = "739514"
End If
If txtconcepto = "Otros Gastos-Costos" And txtccosto = "002001" Then
Range("D" & G) = "51959501"
ElseIf txtconcepto = "Otros Gastos-Costos" And txtccosto = "001009" Then
Range("D" & G) = "52959501"
ElseIf txtconcepto = "Otros Gastos-Costos" Then
Range("D" & G) = "739508"
End If
If txtconcepto = "Pago Proveedores" Then
Range("D" & G) = "220502"
End If
If txtconcepto = "Papeleria y Fotocopias" And txtccosto = "002001" Then
Range("D" & G) = "519530"
ElseIf txtconcepto = "Papeleria y Fotocopias" And txtccosto = "001009" Then
Range("D" & G) = "529530"
ElseIf txtconcepto = "Papeleria y Fotocopias" Then
Range("D" & G) = "739502"
End If
If txtconcepto = "Parqueadero" And txtccosto = "002001" Then
Range("D" & G) = "519565"
ElseIf txtconcepto = "Parqueadero" And txtccosto = "001009" Then
Range("D" & G) = "529565"
ElseIf txtconcepto = "Parqueadero" Then
Range("D" & G) = "739507"
End If
If txtconcepto = "Pasaje Terrestre" And txtccosto = "002001" Then
Range("D" & G) = "515520"
ElseIf txtconcepto = "Pasaje Terrestre" And txtccosto = "001009" Then
Range("D" & G) = "525520"
ElseIf txtconcepto = "Pasaje Terrestre" Then
Range("D" & G) = "735503"
End If
If txtconcepto = "Peajes" Then
Range("D" & G) = "735504"
End If
If txtconcepto = "Porte Placa Vehiculos" And txtccosto = "002001" Then
Range("D" & G) = "514540"
ElseIf txtconcepto = "Porte Placa Vehiculos" And txtccosto = "001009" Then
Range("D" & G) = "524540"
ElseIf txtconcepto = "Porte Placa Vehiculos" Then
Range("D" & G) = "734502"
End If
If txtconcepto = "Repuestos Equipos de Oficina" And txtccosto = "002001" Then
Range("D" & G) = "514520"
ElseIf txtconcepto = "Repuestos Equipos de Oficina" And txtccosto = "001009" The
n
Range("D" & G) = "524520"
ElseIf txtconcepto = "Repuestos Equipos de Oficina" Then
Range("D" & G) = "734503"
End If
If txtconcepto = "Repuestos Maquinaria" And txtccosto = "002001" Then
Range("D" & G) = "514515"
ElseIf txtconcepto = "Repuestos Maquinaria" And txtccosto = "001009" Then
Range("D" & G) = "524515"
ElseIf txtconcepto = "Repuestos Maquinaria" Then
Range("D" & G) = "734501"
End If
If txtconcepto = "Repuestos Vehculos" And txtccosto = "002001" Then
Range("D" & G) = "514540"
ElseIf txtconcepto = "Repuestos Vehculos" And txtccosto = "001009" Then
Range("D" & G) = "524540"
ElseIf txtconcepto = "Repuestos Vehculos" Then
Range("D" & G) = "734502"
End If
If txtconcepto = "Servicio Comedor" And txtccosto = "002001" Then
Range("D" & G) = "519560"
ElseIf txtconcepto = "Servicio Comedor" And txtccosto = "001009" Then
Range("D" & G) = "529560"
ElseIf txtconcepto = "Servicio Comedor" Then
Range("D" & G) = "739506"
End If
If txtconcepto = "Servicio de Agua" And txtccosto = "002001" Then
Range("D" & G) = "513525"
ElseIf txtconcepto = "Servicio de Agua" And txtccosto = "001009" Then
Range("D" & G) = "523525"
ElseIf txtconcepto = "Servicio de Agua" Then
Range("D" & G) = "73350208"
End If
If txtconcepto = "Servicio de Gas" And txtccosto = "002001" Then
Range("D" & G) = "513555"
ElseIf txtconcepto = "Servicio de Gas" And txtccosto = "001009" Then
Range("D" & G) = "523555"
ElseIf txtconcepto = "Servicio de Gas" Then
Range("D" & G) = "73350209"
End If
If txtconcepto = "Servicio de Internet" And txtccosto = "002001" Then
Range("D" & G) = "513535"
ElseIf txtconcepto = "Servicio de Internet" And txtccosto = "001009" Then
Range("D" & G) = "523535"
ElseIf txtconcepto = "Servicio de Internet" Then
Range("D" & G) = "73350201"
End If

If txtconcepto = "Servicio de Luz" And txtccosto = "002001" Then


Range("D" & G) = "513530"
ElseIf txtconcepto = "Servicio de Luz" And txtccosto = "001009" Then
Range("D" & G) = "523530"
ElseIf txtconcepto = "Servicio de Luz" Then
Range("D" & G) = "73350206"
End If
If txtconcepto = "Servicio de Mensajeria" And txtccosto = "002001" Then
Range("D" & G) = "51359505"
ElseIf txtconcepto = "Servicio de Mensajeria" And txtccosto = "001009" Then
Range("D" & G) = "52359505"
ElseIf txtconcepto = "Servicio de Mensajeria" Then
Range("D" & G) = "73350204"
End If
If txtconcepto = "Servicio de Telfono" And txtccosto = "002001" Then
Range("D" & G) = "513535"
ElseIf txtconcepto = "Servicio de Telfono" And txtccosto = "001009" Then
Range("D" & G) = "523535"
ElseIf txtconcepto = "Servicio de Telfono" Then
Range("D" & G) = "73350201"
End If
If txtconcepto = "Servicio de TV Cable" And txtccosto = "002001" Then
Range("D" & G) = "51359501"
ElseIf txtconcepto = "Servicio de TV Cable" And txtccosto = "001009" Then
Range("D" & G) = "52359501"
ElseIf txtconcepto = "Servicio de TV Cable" Then
Range("D" & G) = "73350205"
End If

If txtconcepto = "Servicios de Aseo" And txtccosto = "002001" Then


Range("D" & G) = "513505"
ElseIf txtconcepto = "Servicios de Aseo" And txtccosto = "001009" Then
Range("D" & G) = "523505"
ElseIf txtconcepto = "Servicios de Aseo" Then
Range("D" & G) = "73350101"
End If
If txtconcepto = "Taxis y Buses" And txtccosto = "002001" Then
Range("D" & G) = "519545"
ElseIf txtconcepto = "Taxis y Buses" And txtccosto = "001009" Then
Range("D" & G) = "529545"
ElseIf txtconcepto = "Taxis y Buses" Then
Range("D" & G) = "739505"
End If
If txtconcepto = "TKT Aereo" And txtccosto = "002001" Then
Range("D" & G) = "515515"
ElseIf txtconcepto = "TKT Aereo" And txtccosto = "001009" Then
Range("D" & G) = "525515"
ElseIf txtconcepto = "TKT Aereo" Then
Range("D" & G) = "735515"
End If
If txtconcepto = "Consignacion Bancaria" Then
Range("D" & G) = "11100505"
End If

Range("E" & G) = txtDescripcion + " " + txtobservaciones


Range("F" & G) = txtccosto
Range("G" & G) = FormatCurrency(txtvalor, 0)
Range("H" & G) = "D"
Range("I" & G) = txtTercero
Range("O" & G) = txtFactura
End Function

Function retencion()
Dim H As Single
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Hoja5.Visible = xlSheetVisible
Hoja5.Select
ActiveSheet.Select
Range("D1").Select
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value <> "" Then
Range("D1").End(xlDown).Select
H = ActiveCell.Row + 1
Else
H = 2
End If
Call desbloquear
If txtConceptoRet = "Ret. Servicios 4%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23652501"
Range("E" & H) = "4% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
If txtConceptoRet = "Ret. Hospedaje 3.5%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23652507"
Range("E" & H) = "3.5% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
If txtConceptoRet = "Ret. Restaurante 3.5%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23652506"
Range("E" & H) = "3.5% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
If txtConceptoRet = "Ret. Compras 2.5%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23654002"
Range("E" & H) = "2.5% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
If txtConceptoRet = "Ret. Compras 3.5%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23654003"
Range("E" & H) = "3.5% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
If txtConceptoRet = "Ret. Alquiler Equipos Oficina 4%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23653002"
Range("E" & H) = "4% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
If txtConceptoRet = "Ret. Alquiler Equipos/Herramientas 4%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23653002"
Range("E" & H) = "4% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
If txtConceptoRet = "Ret. Arriendos Inmuebles 3.5%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23653001"
Range("E" & H) = "3.5% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
If txtConceptoRet = "Ret. Fletes 1%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23652503"
Range("E" & H) = "1% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
If txtConceptoRet = "Ret. Servicios 6%" Then
Range("C" & H) = txtconcepto
Range("D" & H) = "23652502"
Range("E" & H) = "6% " + txtDescripcion + " " + txtobservaciones
Range("F" & H) = txtccosto
Range("G" & H) = FormatCurrency(txtretfte, 0)
Range("H" & H) = "C"
Range("I" & H) = txtTercero
Range("O" & H) = txtFactura
Range("S" & H) = FormatCurrency(txtvalor, 0)
End If
End Function
Function combustible()
Dim i As Single
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Hoja5.Visible = xlSheetVisible
Hoja5.Select
ActiveSheet.Select
Range("D1").Select
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value <> "" Then
Range("D1").End(xlDown).Select
i = ActiveCell.Row + 1
j = i + 1
Else
i = 2
End If
Call desbloquear

If txtconcepto = "Gasolina y ACPM" Then


Range("C" & i) = txtconcepto
Range("D" & i) = "53152004"
Range("E" & i) = "0.1% " + txtDescripcion + " " + txtobservaciones
Range("F" & i) = txtccosto
Range("G" & i) = FormatCurrency(txtvalor * 0.001, 0)
Range("H" & i) = "D"
Range("I" & i) = txtTercero
Range("O" & i) = txtFactura
Range("C" & j) = txtconcepto
Range("D" & j) = "23654004"
Range("E" & j) = "0.1% " + txtDescripcion + " " + txtobservaciones
Range("F" & j) = txtccosto
Range("G" & j) = FormatCurrency(txtvalor * 0.001, 0)
Range("H" & j) = "C"
Range("I" & j) = txtTercero
Range("O" & j) = txtFactura
Range("S" & j) = FormatCurrency(txtvalor, 0)
End If
End Function
Function iva()
Dim K As Single
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Hoja5.Visible = xlSheetVisible
Hoja5.Select
ActiveSheet.Select
Range("D1").Select
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value <> "" Then
Range("D1").End(xlDown).Select
K = ActiveCell.Row + 1
Else
K = 2
End If
Call desbloquear
If txtconcepto = "Dotaciones Empleados" And txtiva <> 0 And txtccosto = "002001"
Or _
txtconcepto = "Elementos de Seguridad Industrial" And txtiva <> 0 And txtccosto
= "002001" Or _
txtconcepto = "Repuestos Maquinaria" And txtiva <> 0 And txtccosto = "002001" Or
_
txtconcepto = "Repuestos Vehculos" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Lubricantes" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Beneficios Empleados" And txtiva <> 0 And txtccosto = "002001" Or
_
txtconcepto = "Repuestos Vehculos" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Materiales Construccin" And txtiva <> 0 And txtccosto = "002001" O
r _
txtconcepto = "Herramientas Construccin" And txtiva <> 0 And txtccosto = "002001"
Or _
txtconcepto = "Obsequios a Terceros" And txtiva <> 0 And txtccosto = "002001" Or
_
txtconcepto = "Agua y Hielo" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Elementos de Aseo" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Cafeteria" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Papeleria y Fotocopias" And txtiva <> 0 And txtccosto = "002001"
Then
Range("C" & K) = txtconcepto
Range("D" & K) = "24080310"
Range("E" & K) = txtDescripcion + " " + txtobservaciones
Range("F" & K) = txtccosto
Range("G" & K) = FormatCurrency(txtiva, 0)
Range("H" & K) = "D"
Range("I" & K) = txtTercero
Range("O" & K) = txtFactura
ElseIf txtconcepto = "Alquiler Equipos/Herramientas" And txtiva <> 0 And txtccos
to = "002001" Or _
txtconcepto = "Alquiler Equipos de Oficina" And txtiva <> 0 And txtccosto = "002
001" Or _
txtconcepto = "Alquiler de Vehculos" And txtiva <> 0 And txtccosto = "002001" Or
_
txtconcepto = "Arriendos Inmuebles" And txtiva <> 0 And txtccosto = "002001" Or
_
txtconcepto = "Servicios de Aseo" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Servicio de Internet" And txtiva <> 0 And txtccosto = "002001" Or
_
txtconcepto = "Servicio de TV Cable" And txtiva <> 0 And txtccosto = "002001" Or
_
txtconcepto = "Mantenimiento Maquinaria" And txtiva <> 0 And txtccosto = "002001
" Or _
txtconcepto = "Mantenimiento Vehculos" And txtiva <> 0 And txtccosto = "002001" O
r _
txtconcepto = "Mantenimiento Computadores" And txtiva <> 0 And txtccosto = "0020
01" Or _
txtconcepto = "Parqueadero" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Encomiendas" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Servicio Comedor" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Fletes" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Autenticaciones" And txtiva <> 0 And txtccosto = "002001" Or _
txtconcepto = "Hospedaje" And txtiva <> 0 And txtccosto = "002001" Then
Range("C" & K) = txtconcepto
Range("D" & K) = "24080311"
Range("E" & K) = txtDescripcion + " " + txtobservaciones
Range("F" & K) = txtccosto
Range("G" & K) = FormatCurrency(txtiva, 0)
Range("H" & K) = "D"
Range("I" & K) = txtTercero
Range("O" & K) = txtFactura
ElseIf txtconcepto = "Dotaciones Empleados" And txtiva <> 0 And txtccosto = "001
009" Or _
txtconcepto = "Elementos de Seguridad Industrial" And txtiva <> 0 And txtccosto
= "001009" Or _
txtconcepto = "Repuestos Maquinaria" And txtiva <> 0 And txtccosto = "001009" Or
_
txtconcepto = "Repuestos Vehculos" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Lubricantes" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Beneficios Empleados" And txtiva <> 0 And txtccosto = "001009" Or
_
txtconcepto = "Repuestos Vehculos" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Materiales Construccin" And txtiva <> 0 And txtccosto = "001009" O
r _
txtconcepto = "Herramientas Construccin" And txtiva <> 0 And txtccosto = "001009"
Or _
txtconcepto = "Obsequios a Terceros" And txtiva <> 0 And txtccosto = "001009" Or
_
txtconcepto = "Agua y Hielo" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Elementos de Aseo" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Cafeteria" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Papeleria y Fotocopias" And txtiva <> 0 And txtccosto = "001009"
Then
Range("C" & K) = txtconcepto
Range("D" & K) = "521570"
Range("E" & K) = txtDescripcion + " " + txtobservaciones
Range("F" & K) = txtccosto
Range("G" & K) = FormatCurrency(txtiva, 0)
Range("H" & K) = "D"
Range("I" & K) = txtTercero
Range("O" & K) = txtFactura
ElseIf txtconcepto = "Alquiler Equipos/Herramientas" And txtiva <> 0 And txtccos
to = "001009" Or _
txtconcepto = "Alquiler Equipos de Oficina" And txtiva <> 0 And txtccosto = "001
009" Or _
txtconcepto = "Alquiler de Vehculos" And txtiva <> 0 And txtccosto = "001009" Or
_
txtconcepto = "Arriendos Inmuebles" And txtiva <> 0 And txtccosto = "001009" Or
_
txtconcepto = "Servicios de Aseo" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Servicio de Internet" And txtiva <> 0 And txtccosto = "001009" Or
_
txtconcepto = "Servicio de TV Cable" And txtiva <> 0 And txtccosto = "001009" Or
_
txtconcepto = "Mantenimiento Maquinaria" And txtiva <> 0 And txtccosto = "001009
" Or _
txtconcepto = "Mantenimiento Vehculos" And txtiva <> 0 And txtccosto = "001009" O
r _
txtconcepto = "Mantenimiento Computadores" And txtiva <> 0 And txtccosto = "0010
09" Or _
txtconcepto = "Parqueadero" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Encomiendas" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Servicio Comedor" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Fletes" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Autenticaciones" And txtiva <> 0 And txtccosto = "001009" Or _
txtconcepto = "Hospedaje" And txtiva <> 0 And txtccosto = "001009" Then
Range("C" & K) = txtconcepto
Range("D" & K) = "521570"
Range("E" & K) = txtDescripcion + " " + txtobservaciones
Range("F" & K) = txtccosto
Range("G" & K) = FormatCurrency(txtiva, 0)
Range("H" & K) = "D"
Range("I" & K) = txtTercero
Range("O" & K) = txtFactura
ElseIf txtconcepto = "Dotaciones Empleados" And txtiva <> 0 Or _
txtconcepto = "Elementos de Seguridad Industrial" And txtiva <> 0 Or _
txtconcepto = "Repuestos Maquinaria" And txtiva <> 0 Or _
txtconcepto = "Repuestos Vehculos" And txtiva <> 0 Or _
txtconcepto = "Lubricantes" And txtiva <> 0 Or _
txtconcepto = "Beneficios Empleados" And txtiva <> 0 Or _
txtconcepto = "Repuestos Vehculos" And txtiva <> 0 Or _
txtconcepto = "Materiales Construccin" And txtiva <> 0 Or _
txtconcepto = "Herramientas Construccin" And txtiva <> 0 Or _
txtconcepto = "Obsequios a Terceros" And txtiva <> 0 Or _
txtconcepto = "Agua y Hielo" And txtiva <> 0 Or _
txtconcepto = "Elementos de Aseo" And txtiva <> 0 Or _
txtconcepto = "Cafeteria" And txtiva <> 0 Or _
txtconcepto = "Papeleria y Fotocopias" And txtiva <> 0 Then
Range("C" & K) = txtconcepto
Range("D" & K) = "731571"
Range("E" & K) = txtDescripcion + " " + txtobservaciones
Range("F" & K) = txtccosto
Range("G" & K) = FormatCurrency(txtiva, 0)
Range("H" & K) = "D"
Range("I" & K) = txtTercero
Range("O" & K) = txtFactura
ElseIf txtconcepto = "Alquiler Equipos/Herramientas" And txtiva <> 0 Or _
txtconcepto = "Alquiler Equipos de Oficina" And txtiva <> 0 Or _
txtconcepto = "Alquiler de Vehculos" And txtiva <> 0 Or _
txtconcepto = "Arriendos Inmuebles" And txtiva <> 0 Or _
txtconcepto = "Servicios de Aseo" And txtiva <> 0 Or _
txtconcepto = "Servicio de Internet" And txtiva <> 0 Or _
txtconcepto = "Servicio de TV Cable" And txtiva <> 0 Or _
txtconcepto = "Mantenimiento Maquinaria" And txtiva <> 0 Or _
txtconcepto = "Mantenimiento Vehculos" And txtiva <> 0 Or _
txtconcepto = "Mantenimiento Computadores" And txtiva <> 0 Or _
txtconcepto = "Parqueadero" And txtiva <> 0 Or _
txtconcepto = "Encomiendas" And txtiva <> 0 Or _
txtconcepto = "Servicio Comedor" And txtiva <> 0 Or _
txtconcepto = "Fletes" And txtiva <> 0 Or _
txtconcepto = "Autenticaciones" And txtiva <> 0 Or _
txtconcepto = "Hospedaje" And txtiva <> 0 Then
Range("C" & K) = txtconcepto
Range("D" & K) = "731571"
Range("E" & K) = txtDescripcion + " " + txtobservaciones
Range("F" & K) = txtccosto
Range("G" & K) = FormatCurrency(txtiva, 0)
Range("H" & K) = "D"
Range("I" & K) = txtTercero
Range("O" & K) = txtFactura

End If
End Function
Function ipoconsumo()
Dim L As Single
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Hoja5.Visible = xlSheetVisible
Hoja5.Select
ActiveSheet.Select
Range("D1").Select
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value <> "" Then
Range("D1").End(xlDown).Select
L = ActiveCell.Row + 1
Else
L = 2
End If
Call desbloquear
If txtconcepto = "Servicio Comedor" And txtimpoconsumo <> 0 Then
Range("C" & L) = txtconcepto
Range("D" & L) = "511560"
Range("E" & L) = txtDescripcion + " " + txtobservaciones
Range("F" & L) = txtccosto
Range("G" & L) = FormatCurrency(txtimpoconsumo, 0)
Range("H" & L) = "D"
Range("I" & L) = txtTercero
Range("O" & L) = txtFactura
End If
End Function
Sub borrar_filas_en_blanco()
Application.ScreenUpdating = False
On Error Resume Next
Hoja7.Visible = xlSheetVisible
Hoja7.Select
Range("A15:A1000").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Range("A15").Select
Application.ScreenUpdating = True
End Sub
Function cerrar_plano()
Dim M As Single
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Hoja5.Visible = xlSheetVisible
Hoja5.Select
ActiveSheet.Select
Range("D1").Select
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value <> "" Then
Range("D1").End(xlDown).Select
M = ActiveCell.Row + 1
Else
M = 2
End If
Call desbloquear
If txtempleado = "KAROL XIOMARA AVENDAO JIMENEZ" Then
Range("C" & M) = txtconcepto
Range("D" & M) = "233595"
Range("E" & M) = "LEGALIZACION " + txtconsecutivo + "-" + Format(txtfecha, "yymm
dd") + "-" + txtempleado
Range("F" & M) = txtccosto
Range("G" & M) = FormatCurrency(txtAcumulado, 0)
Range("H" & M) = "C"
Range("I" & M) = "37748523"
ElseIf txtempleado = "XIMENA WADIA POSADA REYES" Then
Range("C" & M) = txtconcepto
Range("D" & M) = "13301505"
Range("E" & M) = "LEGALIZACION " + txtconsecutivo + "-" + Format(txtfecha, "yymm
dd") + "-" + txtempleado
Range("F" & M) = txtccosto
Range("G" & M) = FormatCurrency(txtAcumulado, 0)
Range("H" & M) = "C"
Range("I" & M) = "52082965"
ElseIf txtempleado = "HADI RAMOS" Then
Range("C" & M) = txtconcepto
Range("D" & M) = "233595"
Range("E" & M) = "LEGALIZACION " + txtconsecutivo + "-" + Format(txtfecha, "yymm
dd") + "-" + txtempleado
Range("F" & M) = txtccosto
Range("G" & M) = FormatCurrency(txtAcumulado, 0)
Range("H" & M) = "C"
Range("I" & M) = "85487786"
ElseIf txtempleado = "CESAR AUGUSTO ROJAS VELEZ" Then
Range("C" & M) = txtconcepto
Range("D" & M) = "233595"
Range("E" & M) = "LEGALIZACION " + txtconsecutivo + "-" + Format(txtfecha, "yymm
dd") + "-" + txtempleado
Range("F" & M) = txtccosto
Range("G" & M) = FormatCurrency(txtAcumulado, 0)
Range("H" & M) = "C"
Range("I" & M) = "14327187"
ElseIf txtempleado = "ALVARO EDUARDO ESPINEL ABREO" Then
Range("C" & M) = txtconcepto
Range("D" & M) = "233595"
Range("E" & M) = "LEGALIZACION " + txtconsecutivo + "-" + Format(txtfecha, "yymm
dd") + "-" + txtempleado
Range("F" & M) = txtccosto
Range("G" & M) = FormatCurrency(txtAcumulado, 0)
Range("H" & M) = "C"
Range("I" & M) = "91523231"
ElseIf txtempleado = "FRANCISCO SAN MARTIN VILLARROEL" Then
Range("C" & M) = txtconcepto
Range("D" & M) = "13301501"
Range("E" & M) = "LEGALIZACION " + txtconsecutivo + "-" + Format(txtfecha, "yymm
dd") + "-" + txtempleado
Range("F" & M) = txtccosto
Range("G" & M) = FormatCurrency(txtAcumulado, 0)
Range("H" & M) = "C"
Range("I" & M) = "380820"
ElseIf txtempleado = "JESUS MANUEL REMOLINA FERNANDEZ" Then
Range("C" & M) = txtconcepto
Range("D" & M) = "13301501"
Range("E" & M) = "LEGALIZACION " + txtconsecutivo + "-" + Format(txtfecha, "yymm
dd") + "-" + txtempleado
Range("F" & M) = txtccosto
Range("G" & M) = FormatCurrency(txtAcumulado, 0)
Range("H" & M) = "C"
Range("I" & M) = "1095807190"
ElseIf txtempleado.Value = "RAFAEL E. FLOREZ RIVERA" Then
Range("C" & M) = txtconcepto
Range("D" & M) = "13301501"
Range("E" & M) = "LEGALIZACION " + txtconsecutivo + "-" + Format(txtfecha, "yymm
dd") + "-" + txtempleado
Range("F" & M) = txtccosto
Range("G" & M) = FormatCurrency(txtAcumulado, 0)
Range("H" & M) = "C"
Range("I" & M) = "91500391"
End If
End Function
Function limpiar_plano()
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Hoja5.Visible = xlSheetVisible
Hoja5.Select
ActiveSheet.Select
Range("C2:U100").Select
Selection.ClearContents
Range("C2").Select
Hoja5.Visible = xlSheetVeryHidden
End Function
Function grabar_hoja_plano()
Hoja5.Visible = xlSheetVisible
Hojas = Sheets.Count
Hoja5.Copy After:=Sheets(Hojas)
ActiveSheet.Name = "Plano" + "_" + txtconsecutivo
ActiveSheet.Visible = False
Worksheets("Menu").Visible = True
End Function

You might also like