View
228
Download
0
Category
Preview:
Citation preview
8/18/2019 codigo cotizacion
1/40
Public nomenclatura, usuario, gris, blanco, pub_usuario As StringDim h, i, item, item2, item3, item4 As SinglePublic filapublica, finalpublica, numero_cotiza, a, t_importe As Integer ' guardo var pub para usoPublic fecha_actual, hora_actual As Date
Private Sub bt_actividad_Click()If ch_autorizar = True Then Call guardar_autorizacion Exit Sub ElseIf ch_pagada = True Then Call pago_servicio Exit Sub ElseIf ch_modificar = True Then Call mejora Exit Sub ElseIf ch_cancelar = True Then Call mov_cancelar Exit SubEnd IfEnd Sub
'--------------------------------------------------------------------
' pagina bascar boton busqueda ------'--------------------------------------------------------------------Private Sub bt_busqueda_Click()Call contadorFor fila = 2 To finalpublica If Hoja7.Cells(fila, 2) = Val(txa_cotiza) Then filapublica = fila If Hoja1.Cells(fila, 17) = "CR" Then Call desactivar_autorizacion ElseIf Hoja1.Cells(fila, 17) = "CA" Then Call desactivar_autorizacion End If Call llenar2
End If Next fila txt_cotiza.SetFocusEnd Sub
'---------------------------------------------------------------------' boton borrar incidente listbox'---------------------------------------------------------------------Private Sub bt_delteinci_Click()On Error GoTo error Me.lbx_incidente.RemoveItem (Me.lbx_incidente.ListIndex) Me.lbx_incidente.ListIndex = -1 For i = 0 To Me.lbx_incidente.ListCount - 1
Next Exit Sub Me.lba_incidente.SetFocuserror: MsgBox "Selecciona un item, gracias", vbInformationEnd Sub'---------------------------------------------------------------------' boton eliminar numparte listbox'---------------------------------------------------------------------Private Sub bt_eliminar_Click()
8/18/2019 codigo cotizacion
2/40
8/18/2019 codigo cotizacion
3/40
8/18/2019 codigo cotizacion
4/40
item2 = Hoja3.Range("a:b").CurrentRegion.Rows.Count For i = 2 To item2 If Val(Hoja3.Cells(i, 1)) = Val(txa_cotiza) Then lbx_inci.AddItem Hoja3.Cells(i, 2) End If Next i item3 = Hoja4.Range("a:b").CurrentRegion.Rows.Count For i = 2 To item3 If Val(Hoja4.Cells(i, 1)) = Val(txa_cotiza) Then lbx_desc.AddItem Hoja4.Cells(i, 2) End If Next i item4 = Hoja5.Range("a:b").CurrentRegion.Rows.Count For i = 2 To item4 If Val(Hoja5.Cells(i, 1)) = Val(txa_cotiza) Then lbx_obse.AddItem Hoja5.Cells(i, 2) End If Next i
If Hoja1.Cells(fila, 17) = "P" Then lba_estatus = "PENDIENTE" Else If Hoja1.Cells(fila, 17) = "A" Then lba_estatus = "ABIERTA" Else If Hoja1.Cells(fila, 17) = "CR" Then lba_estatus = "CERRADA" Else If Hoja1.Cells(fila, 17) = "CA" Then lba_estatus = "CANCELADA" If Hoja1.Cells(fila, 17)
= "PA" Then lba_estatus = "PAGADA" End If End If End If End If End If End If Next filaEnd Sub'----------------------------------------------' contador de hoja1
'----------------------------------------------Private Sub contador() Dim fila, final As String filapublica = 0 finalpublica = 0 fila = 1 Do While Hoja1.Cells(fila, 1) Empty fila = fila + 1 Loop final = fila - 1
8/18/2019 codigo cotizacion
5/40
filapublica = fila finalpublica = finalEnd SubPrivate Sub bt_salirbuscar_Click()Call salirEnd SubPrivate Sub bt_salircontacto_Click()Call salirEnd SubPrivate Sub bt_salircot_Click()Call salirEnd SubPrivate Sub salir() End Unload UserForm1End Sub'---------------------------------------------------------------------' boton buscar numero de COTIZACION'---------------------------------------------------------------------Private Sub btau_buscar_Click()Call contadorCall datos txa_cotiza.SetFocusEnd Sub
'-------------------------------------------------------------' poner informacion en pagina autorizacion modificar'-------------------------------------------------------------Private Sub datos() For fila = 2 To finalpublica If Hoja1.Cells(fila, 1) = Val(txa_cotiza) Then filapublica = fila If Hoja1.Cells(fila, 17) = "CR" Then Call desactivar_autorizacion ElseIf Hoja1.Cells(fila, 17) = "CA" Then Call desactivar_autorizacion ElseIf Hoja1.Cells(fila, 17) = "A" Then Call desactivar_autorizacion
ElseIf Hoja1.Cells(fila, 17) = "P" Then Call activar_autorizacion End If Call llenar Exit For
End If Next filaEnd Sub
Private Sub btau_numpart_Click()
Dim fila, final As Integer
fila = 1 Do While Hoja7.Cells(fila, 2) Empty fila = fila + 1 Loop final = fila - 1 a = 0 For fila = 1 To final If Hoja7.Cells(fila, 2) = Val(txa_numparte) Then ' busco elnumero de parte
8/18/2019 codigo cotizacion
6/40
If Hoja1.Cells(fila, 17) = "CR" Then Call desactivar_autorizacion ElseIf Hoja1.Cells(fila, 17) = "CA" Then Call desactivar_autorizacion ElseIf Hoja1.Cells(fila, 17) = "A" Then Call desactivar_autorizacion ElseIf Hoja1.Cells(fila, 17) = "P" Then Call activar_autorizacion End If
numero_cotiza = Hoja7.Cells(fila, 1) 'igualando a numcoitza publica a = busqueda.ListBox1.ListCount With busqueda.ListBox1 .ColumnCount = 8 .ColumnWidths = "40 pt;60 pt;60 pt;170 pt;90 pt;60 pt;60 pt;60 pt;60 pt" .ColumnHeads = True End With
busqueda.ListBox1.AddItem busqueda.ListBox1.List(a, 0) = Hoja7.Cells(fila, 1)
busqueda.ListBox1.List(a, 1) = Hoja7.Cells(fila, 2) busqueda.ListBox1.List(a, 2) = Hoja7.Cells(fila, 3) busqueda.ListBox1.List(a, 5) = Format(Hoja1.Cells(fila, 2), "d-mmm-yy") busqueda.ListBox1.List(a, 6) = Format(Hoja1.Cells(fila, 18), "d-mmm-yy")
item = Hoja1.Range("a:h").CurrentRegion.Rows.Count For i = 2 To item If Val(Hoja1.Cells(i, 1)) = Val(numero_cotiza) Then
busqueda.ListBox1.List(a, 3) = Hoja1.Cells(i, 3) If Hoja1.Cells(i, 8) = Empty Then If Hoja1.Cells(i, 9) = "O" Then busqueda.ListBox1.List(a, 4) = "OUTSORCING" ElseIf Hoja1.Cells(i, 9) = "T" Then busqueda.ListBox1.List(a, 4) = "TIEMPO INVERTIDO" End If Else
busqueda.ListBox1.List(a, 4) = Hoja1.Cells(i, 8) End If If Hoja1.Cells(fila, 17)= "P" Then busqueda.ListBox1.List(a, 7) = "PENDIENTE" ElseIf Hoja1.Cells(fila, 17) = "CR" Then busqueda.L
8/18/2019 codigo cotizacion
7/40
istBox1.List(a, 7) = "CERRADA" ElseIf Hoja1.Cells(fila, 17) = "CA" Then busqueda.ListBox1.List(a, 7) = "CANCELADA" End If End If Next i a = a + 1 End If Next fila
busqueda.Show End Sub
'-----------------------------------------------------' boton agrear cliente'-----------------------------------------------------Private Sub btc_agregar_Click()Dim fila, final As Integer fila = 1 Do While Hoja2.Cells(fila, 1) Empty fila = fila + 1
Loop final = fila - 1 Hoja2.Cells(fila, 1) = UCase(cbc_empresa) Hoja2.Cells(fila, 2) = UCase(txc_domicilio) Hoja2.Cells(fila, 3) = txc_telefono Hoja2.Cells(fila, 4) = UCase(txc_atencion) Hoja2.Cells(fila, 5) = txc_correo Hoja2.Cells(fila, 6) = txc_cliente_cobro cbc_empresa = Empty txc_domicilio = Empty txc_telefono = Empty txc_atencion = Empty txc_correo = Empty
End Sub'--------------------------------------------------------' rutina de servicio pagado'--------------------------------------------------------Private Sub pago_servicio() Hoja1.Cells(filapublica, 17) = "CR" Hoja1.Cells(filapublica, 24) = tx_semanal Hoja1.Cells(filapublica, 25) = tx_fpago Hoja1.Cells(filapublica, 26) = tx_numfact Hoja1.Cells(filapublica, 27) = tx_requi Hoja1.Cells(filapublica, 28) = tx_sello Hoja1.Cells(filapublica, 29) = tx_pagara Hoja1.Cells(filapublica, 30) = tx_inspe
Call limpiarEnd Sub'-------------------------------------------------------' guarda movimiento de pagina autorizados, pagadas'-------------------------------------------------------Private Sub mov_cancelar()Dim motivo, respuesta As Variant respuesta = MsgBox("Estas seguro de cancelar este movimiento", vbYesNo + vbCritical, "CANCELAR COTIZACION") ' motivo = InputBox("Escribe el motivo de la cancelación")
8/18/2019 codigo cotizacion
8/40
With chb_cancelar .Visible = True .Value = Empty .Enabled = False End With Hoja1.Cells(filapublica, 17) = "CA" Hoja1.Cells(filapublica, 31) = motivo MsgBox "Movimiento cancelado, no se puede modificar"
End Sub
'---------------------------------------------------------------------' combobox atencion change'---------------------------------------------------------------------Private Sub cb_atencion_Change()Dim fila As IntegerDim final As Integer
If cb_atencion.Value = Empty Then Me.tx_correo = Empty End If
fila = 1 Do While Hoja2.Cells(fila, 4) Empty
fila = fila + 1 Loop final = fila - 1 For fila = 2 To final If cb_atencion = Hoja2.Cells(fila, 4) Then Me.tx_correo = Hoja2.Cells(fila, 5) Exit For End If NextEnd Sub'---------------------------------------------------------------------' combobox descripcion enter'---------------------------------------------------------------------
Private Sub cb_descripcion_Enter() '
Dim fila As Integer 'Dim final As IntegerDim Lista As String
fila = 1
For fila = 1 To cb_descripcion.ListCount cb_descripcion.RemoveItem 0 'Next fila
Do While Hoja1.Cells(fila, 1) Empty
fila = fila + 1Loop final = fila - 1
For fila = 2 To final Lista = Hoja1.Cells(fila, 4) cb_descripcion.AddItem (Lista) Next 'End Sub
8/18/2019 codigo cotizacion
9/40
'---------------------------------------------------------------------' combobox empresa change'---------------------------------------------------------------------Private Sub cb_empresa_Change()
Dim fila As Integer 'Dim final As Integer
If cb_empresa.Value = Empty Then Me.tx_domicilio = Empty Me.tx_telefono = EmptyEnd Iffila = 1
Do While Hoja2.Cells(fila, 1) Empty fila = fila + 1 Loop final = fila - 1
For fila = 2 To final If Me.cb_empresa = Hoja2.Cells(fila, 1) Then Me.tx_domicilio = Hoja2.Cells(fila, 2) Me.tx_telefono = Hoja2.Cells(fila, 3) Me.cb_atencion = Hoja2.Cells(fila, 4)
Me.tx_correo = Hoja2.Cells(fila, 5) Exit For End If Next End Sub
Private Sub ch_autorizar_Click()Call colores If ch_autorizar = True Then Call desctiva_chbox1'-----------------------------------------' pone en blanco y activa
Call activar_autorizacion Call emp_activar Call fil_activa Call activar_periodo Call activar_rate Else'-----------------------------------' pone en en gris y desactiva Call activa_chbox1 Call desactivar_autorizacion Call emp_desactivar Call fil_desactiva Call desactivar_periodo
Call desactivar_rate End If End Sub'-----------------------------------------------' CANCELAR OPCION'-----------------------------------------------Private Sub ch_cancelar_Click() If ch_cancelar = False Then Call activa_chbox4
8/18/2019 codigo cotizacion
10/40
8/18/2019 codigo cotizacion
11/40
'---------------------------------------------------------------------' check box rate'---------------------------------------------------------------------Private Sub ch_rate_Click()Call coloresIf ch_rate = False Then With periodo .Visible = True End With With ch_rate .Value = False End With With tx_rate .Value = Empty .BackColor = gris .Locked = True End WithElse With periodo .Visible = False End With With ch_rate .Value = True End With
With tx_rate .Value = Empty .BackColor = blanco .Locked = False End WithEnd IfEnd Sub
Private Sub CommandButton27_Click() Unload UserForm1 login.ShowEnd Sub
Private Sub bt_saliramp_Click()Call salirEnd Sub
Private Sub bt_nuevo_Click()Application.ScreenUpdating = FalseThisWorkbook.SaveCall salirEnd Sub
Private Sub CommandButton26_Click()Dim fila, final As Integer fila = 1
Do While Hoja1.Cells(fila, 1) Empty fila = fila + 1 Loop final = fila - 1
For fila = 1 To final If Val(txa_cotiza) = Val(Hoja1.Cells(fila, 1)) Then MsgBox txa_cotiza MsgBox "EXISTE" MsgBox Hoja1.Cells(fila, 3)
8/18/2019 codigo cotizacion
12/40
Exit For End If Next filaEnd Sub
'-------------------------------------------------------------''-------------------------------------------------------------Private Sub lba_atencion_Change()Dim fila, final As Integer
If cb_atencion.Value = Empty Then Me.tx_correo = EmptyEnd Iffila = 1 Do While Hoja2.Cells(fila, 4) Empty fila = fila + 1 Loop final = fila - 1 For fila = 2 To final If lba_atencion = Hoja2.Cells(fila, 4) Then Me.lba_emails = Hoja2.Cells(fila, 5) Exit For End If
NextEnd Sub
Private Sub lba_emp_Change()If lba_emp.Value = Empty Then End Iffila = 1 Do While Hoja2.Cells(fila, 1) Empty fila = fila + 1 Loop final = fila - 1 For fila = 2 To final
If lba_emp = Hoja2.Cells(fila, 1) Then Me.lba_dom = Hoja2.Cells(fila, 2) Me.lba_tel = Hoja2.Cells(fila, 3) Exit For End If NextEnd Sub
Private Sub lba_incidente_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If (KeyAscii >= 1 And KeyAscii = 1 And KeyAscii
8/18/2019 codigo cotizacion
13/40
KeyAscii = 0 End IfEnd Sub
Private Sub ComboBox2_Change() ComboBox2.MatchEntry = fmMatchEntryNone Call activacion lbx_descripcion.AddItem ComboBox2End SubPrivate Sub ComboBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If (KeyAscii >= 1 And KeyAscii
8/18/2019 codigo cotizacion
14/40
End Select dia = Mid(Me.tx_fpago, 1, 2) mes = Mid(Me.tx_fpago, 2, 2) If dia = Empty Then Exit Sub ElseIf dia > 31 Then MsgBox "Día invalido", vbInformation Me.tx_fpago = Empty Exit Sub End If
If mes = Empty Then Exit Sub ElseIf mes > 12 Then MsgBox "Mes invalido", vbInformation Me.tx_fpago = Empty Exit Sub End IfEnd Sub
Private Sub tx_fauto_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 MsgBox "Solo números porfavor", vbInformation
End IfEnd Sub
'---------------------------------------------------------------------' formato captura fecha inicio'---------------------------------------------------------------------Private Sub Tx_finicio_Change() Dim dia, mes As String Select Case Len(Me.Tx_finicio.Text) Case 2: Me.Tx_finicio.Text = Me.Tx_finicio.Text & "-" Case 5: Me.Tx_finicio.Text = Me.Tx_finicio.Text & "-20" End Select dia = Mid(Me.Tx_finicio, 1, 2)
mes = Mid(Me.Tx_finicio, 2, 2) If dia = Empty Then Exit Sub ElseIf dia > 31 Then MsgBox "Día invalido", vbInformation Me.Tx_finicio = Empty Exit Sub End If If mes = Empty Then Exit Sub ElseIf mes > 12 Then MsgBox "Mes invalido", vbInformation Me.Tx_finicio = Empty
Exit Sub End IfEnd Sub
Private Sub tx_fpago_Change()Dim dia, mes As String Select Case Len(Me.tx_fpago.Text) Case 2: Me.tx_fpago.Text = Me.tx_fpago.Text & "-" Case 5: Me.tx_fpago.Text = Me.tx_fpago.Text & "-20" End Select
8/18/2019 codigo cotizacion
15/40
dia = Mid(Me.tx_fpago, 1, 2) mes = Mid(Me.tx_fpago, 2, 2) If dia = Empty Then Exit Sub ElseIf dia > 31 Then MsgBox "Día invalido", vbInformation Me.tx_fpago = Empty Exit Sub End If
If mes = Empty Then Exit Sub ElseIf mes > 12 Then MsgBox "Mes invalido", vbInformation Me.tx_fpago = Empty Exit Sub End IfEnd Sub
Private Sub tx_fpago_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 MsgBox "Solo números porfavor", vbInformationEnd If
End Sub
'---------------------------------------------------------------------' formato captura fecha termino'---------------------------------------------------------------------Private Sub tx_ftermino_Change()Dim dia, mes As String Select Case Len(Me.tx_ftermino.Text) Case 2: Me.tx_ftermino.Text = Me.tx_ftermino.Text & "-" Case 5: Me.tx_ftermino.Text = Me.tx_ftermino.Text & "-20" End Select dia = Mid(Me.tx_ftermino, 1, 2) mes = Mid(Me.tx_ftermino, 2, 2)
If dia = Empty Then Exit Sub ElseIf dia > 31 Then MsgBox "Día invalido", vbInformation Me.tx_ftermino = Empty Exit Sub End If
If mes = Empty Then Exit Sub ElseIf mes > 12 Then MsgBox "Mes invalido", vbInformation Me.tx_ftermino = Empty
Exit Sub End IfEnd Sub'---------------------------------------------------------------------' formato captura solo numero'---------------------------------------------------------------------Private Sub tx_finicio_keypress(ByVal KeyAscii As MSForms.ReturnInteger)If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 MsgBox "Solo números porfavor", vbInformation
8/18/2019 codigo cotizacion
16/40
End IfEnd Sub'---------------------------------------------------------------------' formato captura solo numero'---------------------------------------------------------------------Private Sub tx_ftermino_keypress(ByVal KeyAscii As MSForms.ReturnInteger)If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 MsgBox "Solo números porfavor", vbInformationEnd IfEnd Sub'---------------------------------------------------------------------' combo box atencion enter'---------------------------------------------------------------------Private Sub cb_atencion_Enter()Dim fila As IntegerDim final As IntegerDim Lista As Stringfila = 1For fila = 1 To cb_atencion.ListCount cb_atencion.RemoveItem 0Next fila Do While Hoja2.Cells(fila, 1) Empty fila = fila + 1
Loop final = fila - 1 For fila = 2 To final Lista = Hoja2.Cells(fila, 4) cb_atencion.AddItem (Lista) NextEnd Sub'---------------------------------------------------------------------' combo box pagina cotizacion empresa change'---------------------------------------------------------------------Private Sub cbc_empresa_Change()Dim fila As IntegerDim final As Integer
If cbc_empresa.Value = Empty Then Me.tx_domicilio = Empty Me.tx_telefono = EmptyEnd Iffila = 1 Do While Hoja2.Cells(fila, 1) Empty fila = fila + 1 Loop final = fila - 1 For fila = 2 To final If cbc_empresa = Hoja2.Cells(fila, 1) Then Me.tx_domicilio = Hoja2.Cells(fila, 2) Me.tx_telefono = Hoja2.Cells(fila, 3)
Exit For End If NextEnd Sub'---------------------------------------------------------------------' combo box pagina cotizacion empresa enter'---------------------------------------------------------------------Private Sub cbc_empresa_Enter()Dim fila As IntegerDim final As Integer
8/18/2019 codigo cotizacion
17/40
Dim Lista As Stringfila = 1 For fila = 1 To cbc_empresa.ListCount cbc_empresa.RemoveItem 0 Next fila Do While Hoja2.Cells(fila, 1) Empty fila = fila + 1 Loop final = fila - 1 For fila = 2 To final Lista = Hoja2.Cells(fila, 1) cbc_empresa.AddItem (Lista) NextEnd Sub'---------------------------------------------------------------------' combobox OBSERVACION enter'---------------------------------------------------------------------Private Sub cb_observa_Enter()Dim fila As IntegerDim final As IntegerDim Lista As Stringfila = 1For fila = 1 To cb_observa.ListCount cb_observa.RemoveItem 0
Next fila Do While Hoja2.Cells(fila, 1) Empty fila = fila + 1Loop final = fila - 1 For fila = 2 To final Lista = Hoja2.Cells(fila, 4) cb_observa.AddItem (Lista) NextEnd Sub'---------------------------------------------------------------------' combobox INCIDENTE change'---------------------------------------------------------------------
Private Sub cb_incidente_Change()Dim fila As IntegerDim final, i As Integerfila = 1 Do While Hoja2.Cells(fila, 6) Empty fila = fila + 1 Loop final = fila - 1 For fila = 2 To final If cb_incidente = Hoja2.Cells(fila, 6) Then Exit For End If Next
' ------------------------------------------------------------------' agregar numero nombre e incidente a listbox' ------------------------------------------------------------------ Me.lbx_incidente.AddItem Me.lba_incidentei = i + 1 Me.lba_incidente.SetFocusEnd Sub'---------------------------------------------------------------------' boton guardar y crear apertura'---------------------------------------------------------------------
8/18/2019 codigo cotizacion
18/40
Private Sub bt_crearti_Click() If cb_empresa = Empty Then MsgBox ("No se puede guardar en blanco la emprsa"), vbCritical Exit Sub cb_empresa = Empty cb_empresa.SetFocus End If
Dim fila, final, i, conta, fi1, final1, fi2, final2, fi3, final3, fi4, final4 As Integer fila = 2 Do While Hoja1.Cells(fila, 1) Empty fila = fila + 1 Loop final = fila cb_empresa = UCase(cb_empresa) tx_domicilio = UCase(tx_domicilio) cb_atencion = UCase(cb_atencion) Hoja1.Cells(fila, 1) = Val(lb_numcot) Hoja1.Cells(fila, 2) = Format(lb_fecha, "d-mmm-yy") Hoja1.Cells(fila, 3) = UCase(cb_empresa) Hoja1.Cells(fila, 4) = UCase(tx_domicilio) Hoja1.Cells(fila, 5) = UCase(tx_telefono) Hoja1.Cells(fila, 6) = UCase(cb_atencion)
Hoja1.Cells(fila, 7) = tx_correo If ch_rate = False Then Hoja1.Cells(fila, 8) = " " Else Hoja1.Cells(fila, 8) = Val(tx_rate) End If If ch_rate = True Then Hoja1.Cells(final, 9) = Empty Else If ch_out = True Then Hoja1.Cells(final, 9) = "O" Hoja1.Cells(final, 10) = " " Else
Hoja1.Cells(final, 9) = "T" Hoja1.Cells(final, 10) = " " End If End If Hoja1.Cells(final, 10) = Val(tx_inventario) Hoja1.Cells(final, 11) = Val(tx_precio) Hoja1.Cells(final, 12) = Val(tx_item) Hoja1.Cells(final, 13) = Val(tx_precio) pre = Val(tx_precio) * Val(tx_precio) Hoja1.Cells(final, 14) = Format(Val(pre), "#,##0.##") If Tx_finicio = Empty And tx_ftermino = Empty Then Hoja1.Cells(final, 15) = Empty Hoja1.Cells(final, 16) = Empty
Else Hoja1.Cells(final, 15) = Tx_finicio Hoja1.Cells(final, 15).NumberFormat = ("d-mmm-yy") Hoja1.Cells(final, 16) = tx_ftermino Hoja1.Cells(final, 16).NumberFormat = ("d-mmm-yy") End If Hoja1.Cells(final, 17) = "P" Hoja1.Cells(final, 33) = tx_planta final = final + 1
8/18/2019 codigo cotizacion
19/40
fi1 = 2Do While Hoja3.Cells(fi1, 1) Empty fi1 = fi1 + 1Loop final1 = fi1 lbx_incidente.Clear For i = 0 To lbx_incidente.ListCount - 1 Hoja3.Cells(final1, 1) = lb_numcot Hoja3.Cells(final1, 2) = UCase(lbx_incidente.List(i, 0)) final1 = final1 + 1 Next
fi2 = 2Do While Hoja4.Cells(fi2, 1) Emptyfi2 = fi2 + 1Loopfinal2 = fi2lbx_descripcion.Clear For i = 0 To lbx_descripcion.ListCount - 1 Hoja4.Cells(final2, 1) = Val(lb_numcot) Hoja4.Cells(final2, 2) = UCase(lbx_descripcion.List(i, 0)) final2 = final2 + 1 Next
fi3 = 2 Do While Hoja5.Cells(fi3, 1) Empty fi3 = fi3 + 1 Loop final3 = fi3 lbx_observa.Clear For i = 0 To lbx_observa.ListCount - 1 Hoja5.Cells(final3, 1) = Val(lb_numcot) Hoja5.Cells(final3, 2) = UCase(lbx_observa.List(i, 0)) final3 = final3 + 1 Next
fi4 = 2
Do While Hoja7.Cells(fi4, 1) Emptyfi4 = fi4 + 1Loopfinal4 = fi4 - 1lbx_numparte.Clear For i = 0 To lbx_incidente.ListCount - 1 Hoja7.Cells(final4, 1) = Val(lb_numcot) Hoja7.Cells(final4, 2) = UCase(lbx_numparte.List(i, 0)) Hoja7.Cells(final4, 3) = UCase(lbx_nomparte.List(i, 1)) final4 = final4 + 1 Next conta = Val(lb_numcot) conta = conta + 1
lb_numcot = conta'--------------------------------------------------------------------------------' formato de coitzacion y gardar pdf excel y subir a la nube la informacion'-------------------------------------------------------------------------------- y = Right(lb_fecha, 2) Hoja6.Cells(1, 7) = lb_fecha Hoja6.Cells(1, 7).NumberFormat = "d-mmm-yy" Hoja6.Cells(2, 7) = "C-" & Val(lb_numcot) & "-" & y
8/18/2019 codigo cotizacion
20/40
Hoja6.Cells(4, 2) = cb_empresa Hoja6.Cells(5, 2) = tx_domicilio Hoja6.Cells(6, 2) = tx_telefono Hoja6.Cells(3, 2) = cb_atencion Hoja6.Cells(7, 2) = tx_correo Hoja6.Cells(10, 1) = Val(tx_item) Hoja6.Cells(10, 2) = tx_horas Hoja6.Cells(10, 3) = Val(tx_rate) Hoja6.Cells(10, 4) = tx_rate Hoja6.Cells(10, 6) = Val(tx_precio) Hoja6.Cells(10, 7) = Val(tx_precio) Hoja6.Cells(10, 8) = Val(importe_lb) aa = "Periodo" bb = "Planta" cc = "Número(os) parte: " dd = "Incidente" d = lbx_descripcion & aa & " " & Tx_finicio & " " & tx_ftermino & " " e = bb & " " & tx_planta Hoja6.Cells(10, 2) = d & e'--------------------------------------------------------------------------------' poner en blanco todo alta cotizacion'-------------------------------------------------------------------------------
- cb_empresa = Empty cb_atencion = Empty tx_domicilio = Empty tx_telefono = Empty tx_correo = Empty tx_numparte = Empty tx_nomparte = Empty lbx_numparte.Clear lbx_nomparte.Clear tx_rate = Empty tx_inventario = Empty tx_precio = Empty
tx_planta = Empty tx_item = Empty tx_horas = Empty importe_lb = Empty cb_incidente = Empty lbx_incidente.Clear ComboBox2.Clear ComboBox3.Clear lba_incidente.Clear Tx_finicio = Empty tx_ftermino = Empty cb_descripcion = Empty lbx_descripcion.Clear
cb_observa = Empty lbx_observa.Clear h = 0End Sub
Private Sub tx_horas_AfterUpdate()importe_lb = importe_lb * Val(tx_horas)End Sub
Private Sub tx_inventario_AfterUpdate()
8/18/2019 codigo cotizacion
21/40
8/18/2019 codigo cotizacion
22/40
Call desactivar_descripcion Call desactivar_periodo Call desactivar_autorizacion End WithEnd Sub
' --------------------------------------------------' Busqueda de numero parte' --------------------------------------------------Private Sub buscanumpart()
Dim fila, final As Integer fila = 1 Do While Hoja7.Cells(fila, 2) Empty fila = fila + 1 Loop final = fila - 1
If Hoja7.Cells(fila, 2) = txa_numparte Then MsgBox " numero encontrado" 'filapublica = fila End IfEnd Sub'-------------------------------------------------
' Activar llenado de combo box llenados'-------------------------------------------------Private Sub activacion() Dim fila, final, reg1, final1, fila1, fila2, final2, fila3, final3, fila4,final4 As Integer fila = 1 fila1 = 1 Do While Hoja1.Cells(fila, 1) Empty fila = fila + 1 Loop final = fila - 1 lb_numcot = final'-------------------------------------------------------------------------------
-------------------- Do While Hoja2.Cells(fila1, 1) Empty fila1 = fila1 + 1 Loop final1 = fila1 - 1 For fila1 = 2 To final1 reg = WorksheetFunction.CountIf(Range(Cells(1, 1), Cells(fila1, 1)), Cells(fila1, 1)) If reg = 1 Then cb_empresa.AddItem Hoja2.Cells(fila1, 1) cb_atencion.AddItem Hoja2.Cells(fila1, 2) End If Next fila1
'---------------------------------------------------------------------------------------------------
Do While Hoja2.Cells(fila1, 1) Empty fila1 = fila1 + 1 Loop final1 = fila1 - 1 For fila1 = 2 To final1 reg = WorksheetFunction.CountIf(Range(Cells(1, 1), Cells(fila1, 6)), Cells(fila1, 6))
8/18/2019 codigo cotizacion
23/40
If reg = 1 Then lba_incidente.AddItem Hoja2.Cells(fila1, 6) End If Next fila1'---------------------------------------------------------------------------------------------------
Do While Hoja2.Cells(fila1, 1) Empty fila1 = fila1 + 1 Loop final1 = fila1 - 1 For fila1 = 2 To final1 reg = WorksheetFunction.CountIf(Range(Cells(1, 1), Cells(fila1, 7)), Cells(fila1, 7)) If reg = 1 Then ComboBox3.AddItem Hoja2.Cells(fila1, 7) End If Next fila1'---------------------------------------------------------------------------------------------------
Do While Hoja2.Cells(fila1, 1) Empty fila1 = fila1 + 1 Loop
final1 = fila1 - 1 For fila1 = 2 To final1 reg = WorksheetFunction.CountIf(Range(Cells(1, 1), Cells(fila1, 8)), Cells(fila1, 8)) If reg = 1 Then ComboBox2.AddItem Hoja2.Cells(fila1, 8) End If Next fila1End Sub'----------------------------------------------------------------' activar campos descripcion'----------------------------------------------------------------Private Sub activar_descripcion()
Call colores With cbm_incidentes .Value = Empty .BackColor = blanco .Enabled = True End With With cbm_desc .Value = Empty .BackColor = blanco .Enabled = True End With With cbm_obs .Value = Empty
.BackColor = blanco .Enabled = True End With With lbm_desc Value = Empty .BackColor = blanco .Enabled = True End With With lbm_obs Value = Empty
8/18/2019 codigo cotizacion
24/40
.BackColor = blanco .Enabled = True End With With lbm_incidentes Value = Empty .BackColor = blanco .Enabled = True End With With lbm_numparte Value = Empty .BackColor = blanco .Enabled = True End With With lbm_nomparte Value = Empty .BackColor = blanco .Enabled = True End With With txt_numparte Value = Empty .BackColor = blanco .Enabled = True End With With txt_nomparte
Value = Empty .BackColor = blanco .Enabled = True End WithEnd Sub'----------------------------------------------------------------' desactivar campos descripcion'----------------------------------------------------------------Private Sub desactivar_descripcion()Call colores With cbm_incidentes .Value = Empty .BackColor = gris
.Enabled = False End With With cbm_desc .Value = Empty .BackColor = gris .Enabled = False End With With cbm_obs .Value = Empty .BackColor = gris .Enabled = False End With With lbm_desc
Value = Empty .BackColor = gris .Enabled = False End With With lbm_obs Value = Empty .BackColor = gris .Enabled = False End With With lbm_incidentes
8/18/2019 codigo cotizacion
25/40
Value = Empty .BackColor = gris .Enabled = False End With With lbm_numparte Value = Empty .BackColor = gris .Enabled = False End With With lbm_nomparte Value = Empty .BackColor = gris .Enabled = False End With With txt_numparte Value = Empty .BackColor = gris .Enabled = False End With With txt_nomparte Value = Empty .BackColor = gris .Enabled = False End With
End Sub'-------------------------------------------------------------' limpiar celdas pagina autorizacion, modificar'-------------------------------------------------------------Private Sub limpiar() txa_cotiza = Empty txa_numparte = Empty lba_emp = Empty lba_dom = Empty lba_atencion = Empty lba_incidente = Empty lba_emails = Empty
lba_tel = Empty lba_estatus = Empty ComboBox2 = Empty ComboBox3 = Empty txt_rate = Empty txt_inven = Empty txt_precio = Empty txt_item = Empty txt_horas = Empty txt_importe = Empty txt_finicio = Empty txt_ftermino = Empty txt_personas = Empty
lbm_numparte.Clear lbm_nomparte.Clear lbm_incidentes.Clear lbm_obs.Clear lbm_desc.Clear tx_fauto = Empty tx_autorizacion = Empty tx_release = Empty tx_oc = Empty tx_fpago = Empty
8/18/2019 codigo cotizacion
26/40
tx_semanal = Empty tx_numfact = Empty tx_requi = Empty tx_sello = Empty tx_pagara = Empty tx_inspe = Empty tx_planta = EmptyEnd Sub'-------------------------------------------------' llenar datos autorizacion, pago, modificar cancelar'-------------------------------------------------Private Sub llenar() fila = filapublica lba_emp = Hoja1.Cells(fila, 3) lba_dom = Hoja1.Cells(fila, 4) lba_tel = Hoja1.Cells(fila, 5) lba_atencion = Hoja1.Cells(fila, 6) lba_emails = Hoja1.Cells(fila, 7) txt_rate = Hoja1.Cells(fila, 8) txt_inven = Hoja1.Cells(fila, 10) txt_planta = Hoja1.Cells(fila, 33) txt_precio = Hoja1.Cells(fila, 11) txt_item = Hoja1.Cells(fila, 12) txt_horas = Hoja1.Cells(fila, 13)
txt_importe = Format(Hoja1.Cells(fila, 14), "#,##0.00") txt_finicio = Hoja1.Cells(fila, 15) txt_ftermino = Hoja1.Cells(fila, 16) tx_fcierre = Hoja1.Cells(fila, 19) tx_fauto = Hoja1.Cells(fila, 20) tx_autorizacion = Hoja1.Cells(fila, 21) tx_release = Hoja1.Cells(fila, 22) tx_oc = Hoja1.Cells(fila, 23) If Hoja1.Cells(fila, 17) = "P" Then lba_estatus = "PENDIENTE" Else If Hoja1.Cells(fila, 17) = "A" Then lba_estatus = "ABIERTA"
Else If Hoja1.Cells(fila, 17) = "CR" Then lba_estatus = "CERRADA" Else If Hoja1.Cells(fila, 17) = "CA" Then lba_estatus = "CANCELADA" Else If Hoja1.Cells(fila, 17) = Empty Then lba_e
status = Empty End If End If End If End If End If If Hoja1.Cells(fila, 8) = Empty Then With chb_rate .Value = False End With
8/18/2019 codigo cotizacion
27/40
Else With chb_rate .Value = True End With End If tx_semanal = Hoja1.Cells(fila, 24) tx_fpago = Hoja1.Cells(fila, 25) tx_numfact = Hoja1.Cells(fila, 26) tx_requi = Hoja1.Cells(fila, 27) tx_sello = Hoja1.Cells(fila, 28) tx_pagara = Hoja1.Cells(fila, 29) tx_inspe = Hoja1.Cells(fila, 30) txa_planta = Hoja1.Cells(fila, 33) '--------------------------------------------- item = Hoja7.Range("a:c").CurrentRegion.Rows.Count lbm_numparte.Clear lbm_nomparte.Clear For i = 2 To item If Val(Hoja7.Cells(i, 1)) = Val(txa_cotiza) Then lbm_numparte.AddItem Hoja7.Cells(i, 2) lbm_nomparte.AddItem Hoja7.Cells(i, 3) End If Next i'---------------------------------------------
item2 = Hoja3.Range("a:b").CurrentRegion.Rows.Count lbm_incidentes.Clear For i = 2 To item2 If Val(Hoja3.Cells(i, 1)) = Val(txa_cotiza) Then lbm_incidentes.AddItem Hoja3.Cells(i, 2) End If Next i'--------------------------------------------- item3 = Hoja4.Range("a:b").CurrentRegion.Rows.Count lbm_desc.Clear
For i = 2 To item3 If Val(Hoja4.Cells(i, 1)) = Val(txa_cotiza) Then lbm_desc.AddItem Hoja4.Cells(i, 2) End If Next i'--------------------------------------------- item4 = Hoja5.Range("a:b").CurrentRegion.Rows.Count lbm_obs.Clear For i = 2 To item4 If Val(Hoja5.Cells(i, 1)) = Va
l(txa_cotiza) Then lbm_obs.AddItem Hoja5.Cells(i, 2) End If Next iEnd Sub'-------------------------------------------------' desactivar autorizacion'-------------------------------------------------Private Sub desctiva_chbox1()
8/18/2019 codigo cotizacion
28/40
With ch_pagada .Enabled = False End With With ch_modificar .Enabled = False End With With ch_cancelar .Enabled = False End WithEnd Sub'-------------------------------------------------' desactivar pagar'-------------------------------------------------Private Sub desctiva_chbox2() With ch_autorizar ' chkbox PAGADA desactivada .Enabled = False End With With ch_modificar 'chkbox MODIFICAR desctivada .Enabled = False End With With ch_cancelar .Enabled = False End WithEnd Sub
'-------------------------------------------------' desactivar modificar'-------------------------------------------------Private Sub desctiva_chbox3() With ch_autorizar ' chkbox PAGADA desactivada .Enabled = False End With With ch_pagada 'chkbox MODIFICAR desctivada .Enabled = False End With With ch_cancelar .Enabled = False End With
End Sub'-------------------------------------------------' desactivar chk box cancelar'-------------------------------------------------Private Sub desctiva_chbox4() With ch_pagada .Enabled = False End With With ch_modificar .Enabled = False End With With ch_autorizar .Enabled = False
End WithEnd Sub
'-------------------------------------------------' activar autoriza'-------------------------------------------------Private Sub activa_chbox1() With ch_pagada ' chkbox PAGADA desactivada .Enabled = True End With
8/18/2019 codigo cotizacion
29/40
With ch_modificar 'chkbox MODIFICAR desctivada .Enabled = True End With With ch_cancelar .Enabled = True End WithEnd Sub'-------------------------------------------------' activar pagar'-------------------------------------------------Private Sub activa_chbox2() With ch_autorizar ' chkbox PAGADA desactivada .Enabled = True End With With ch_modificar 'chkbox MODIFICAR desctivada .Enabled = True End With With ch_cancelar .Enabled = True End WithEnd Sub'-------------------------------------------------' activar chk box modificar'-------------------------------------------------
Private Sub activa_chbox3() With ch_autorizar ' chkbox PAGADA desactivada .Enabled = True End With With ch_pagada 'chkbox MODIFICAR desctivada .Enabled = True End With With ch_cancelar .Enabled = True End WithEnd Sub'-------------------------------------------------' activar cancelar
'-------------------------------------------------Private Sub activa_chbox4() With ch_pagada .Enabled = True End With With ch_modificar .Enabled = True End With With ch_autorizar .Enabled = True End WithEnd Sub
'-------------------------------------------------' activar empresa'-------------------------------------------------Private Sub emp_activar()Call colores With lba_emp .Value = Empty .BackColor = blanco End With With lba_dom
8/18/2019 codigo cotizacion
30/40
.Value = Empty .BackColor = blanco .Enabled = False End With With txt_planta .Value = Empty .BackColor = blanco .Enabled = False End With With lba_tel .Value = Empty .BackColor = blanco .Enabled = False End With With lba_atencion .Value = Empty .BackColor = blanco .Enabled = False End With With lba_emails .Value = Empty .BackColor = blanco .Enabled = False End With
With txt_horas .Value = Empty .BackColor = blanco .Enabled = False End With With txt_rate .Value = Empty .BackColor = blanco .Enabled = False End With With txt_item .Value = Empty .BackColor = blanco
.Enabled = False End With With txt_precio .Value = Empty .BackColor = blanco .Enabled = False End With With txt_inven .Value = Empty .BackColor = blanco .Enabled = False End WithEnd Sub
'-------------------------------------------------' desactivar empresa'-------------------------------------------------Private Sub emp_desactivar()Call colores With chb_rate .Value = Empty .Enabled = False End With With lba_emp
8/18/2019 codigo cotizacion
31/40
.BackColor = gris .Enabled = False .Value = Empty End With With txt_planta .BackColor = gris .Enabled = False .Value = Empty End With With lba_dom .BackColor = gris .Enabled = False .Value = Empty End With With lba_tel .BackColor = gris .Enabled = False .Value = Empty End With With lba_atencion .BackColor = gris .Enabled = False .Value = Empty End With
With lba_emails .BackColor = gris .Enabled = False .Value = Empty End With With txt_horas .Value = Empty .BackColor = gris .Enabled = False End With With txt_rate .Value = Empty .BackColor = gris
.Enabled = False End With With txt_item .Value = Empty .BackColor = gris .Enabled = False End With With txt_precio .Value = Empty .BackColor = gris .Enabled = False End With With txt_inven
.Value = Empty .BackColor = gris .Enabled = False End WithEnd Sub'-------------------------------------------------' desactivar filtro'-------------------------------------------------Private Sub fil_desactiva()Call colores
8/18/2019 codigo cotizacion
32/40
With txa_cotiza .Value = Empty .BackColor = gris .Enabled = FalseEnd WithWith txa_numparte .Value = Empty .BackColor = gris .Enabled = FalseEnd WithEnd Sub
'-------------------------------------------------' activar filtro'-------------------------------------------------
Private Sub fil_activa()Call colores With txa_cotiza .Value = Empty .BackColor = blanco .Enabled = TrueEnd WithWith txa_numparte
.Value = Empty .BackColor = blanco .Enabled = TrueEnd WithEnd Sub
'-------------------------------------------------' activar autorizacion'-------------------------------------------------Private Sub activar_autorizacion()Call coloresWith tx_autorizacion .BackColor = blanco
.Value = Empty .Enabled = True End With With tx_release .BackColor = blanco .Value = Empty .Enabled = True End With With tx_oc .BackColor = blanco .Value = Empty .Enabled = True End With
With tx_fauto .BackColor = blanco .Value = Empty .Enabled = True End WithEnd Sub
'-------------------------------------------------' desactivar autorizacion'-------------------------------------------------
8/18/2019 codigo cotizacion
33/40
8/18/2019 codigo cotizacion
34/40
.BackColor = blanco .Value = Empty .Enabled = True End With With tx_inspe .BackColor = blanco .Value = Empty .Enabled = TrueEnd WithEnd Sub
'-------------------------------------------------' desactivar pago'-------------------------------------------------Private Sub desactivar_pago()Call colores With tx_semanal .Value = Empty .BackColor = gris .Enabled = False End With With tx_fcierre .Value = Empty .BackColor = gris
.Enabled = False End With With tx_fpago .Value = Empty .BackColor = gris .Enabled = False End With With tx_numfact .Value = Empty .BackColor = gris .Enabled = False End With With tx_requi
.Value = Empty .BackColor = gris .Enabled = False End With With tx_sello .Value = Empty .BackColor = gris .Enabled = False End With With tx_pagara .Value = Empty .BackColor = gris .Enabled = False
End With With tx_inspe .Value = Empty .BackColor = gris .Enabled = False End WithEnd Sub
'-------------------------------------------------' desactivar periodo
8/18/2019 codigo cotizacion
35/40
8/18/2019 codigo cotizacion
36/40
End Sub
Private Sub colores()gris = &H8000000F 'RGB(235, 235, 235)blanco = &H80000005 'RGB(255, 255, 255)End Sub
Private Sub espa()Dim aa, bb, cc, d As Stringaa = "Periodo"bb = "Planta"cc = "Número(os) parte: "dd = "Incidente"d = lbx_descripcion & aa & " " & Tx_finicio & " " & tx_ftermino & " "e = bb & " " & tx_planta
End SubPrivate Sub ingles()'----------------------------------------------------' poner cotizacion en ingles'----------------------------------------------------End Sub'----------------------------------------------------' inabhilitar boton x en el formulario
'----------------------------------------------------'Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)' If CloseMode = 0 Then' 'inserta comillas delante del texto' QQ = Chr(34)' MsgBox "Use el botón " & QQ & "Cerrar" & QQ & " del formulario", vbInformation, "*** Botón desactivado ***"' Cancel = 1' End If''End SubPrivate Sub nuevouser() UserForm1.MultiPage1.Pages("nuevo").Visible = False UserForm1.MultiPage1.Pages("t_invertido").Visible = True
UserForm1.MultiPage1.Pages("APM").Visible = True UserForm1.MultiPage1.Pages("contacto").Visible = True UserForm1.MultiPage1.Pages("buscar").Visible = TrueEnd SubPrivate Sub vista_activar()bt_vista.Enabled = TrueEnd SubPrivate Sub vista_desactivar()bt_vista.Enabled = TrueEnd SubPrivate Sub llenar2()'-------------------------------------------------------------' llenar datos autorizacion, pago, modificar cancelar
'------------------------------------------------------------- fila = filapublica Label119 = Hoja1.Cells(fila, 3) lba_dom = Hoja1.Cells(fila, 4) lba_tel = Hoja1.Cells(fila, 5) lba_atencion = Hoja1.Cells(fila, 6) lba_emails = Hoja1.Cells(fila, 7) txt_rate = Hoja1.Cells(fila, 8) txt_inven = Hoja1.Cells(fila, 10) txt_planta = Hoja1.Cells(fila, 33)
8/18/2019 codigo cotizacion
37/40
txt_precio = Hoja1.Cells(fila, 11) txt_item = Hoja1.Cells(fila, 12) txt_horas = Hoja1.Cells(fila, 13) txt_importe = Hoja1.Cells(fila, 14) txt_finicio = Hoja1.Cells(fila, 15) txt_ftermino = Hoja1.Cells(fila, 16) tx_fcierre = Hoja1.Cells(fila, 19) tx_fauto = Hoja1.Cells(fila, 20) tx_autorizacion = Hoja1.Cells(fila, 21) tx_release = Hoja1.Cells(fila, 22) tx_oc = Hoja1.Cells(fila, 23) If Hoja1.Cells(fila, 17) = "P" Then lba_estatus = "PENDIENTE" Else If Hoja1.Cells(fila, 17) = "A" Then lba_estatus = "ABIERTA" Else If Hoja1.Cells(fila, 17) = "CR" Then lba_estatus = "CERRADA" Else If Hoja1.Cells(fila, 17) = "CA" Then lba_estatus = "
CANCELADA" Else If Hoja1.Cells(fila, 17) = Empty Then lba_estatus = Empty End If End If End If End If End If If Hoja1.Cells(fila, 8) = Empty Then With chb_rate
.Value = False End With Else With chb_rate .Value = True End With End If tx_semanal = Hoja1.Cells(fila, 24) tx_fpago = Hoja1.Cells(fila, 25) tx_numfact = Hoja1.Cells(fila, 26) tx_requi = Hoja1.Cells(fila, 27) tx_sello = Hoja1.Cells(fila, 28) tx_pagara = Hoja1.Cells(fila, 29)
tx_inspe = Hoja1.Cells(fila, 30) txa_planta = Hoja1.Cells(fila, 33)
item = Hoja7.Range("a:c").CurrentRegion.Rows.Count lbm_numparte.Clear lbm_nomparte.Clear For i = 2 To item If Val(Hoja7.Cells(i, 1)) = Val(txa_cotiza) Then lbm_numparte.AddItem Hoja7.Cells(i, 2) lbm_nomparte.AddItem Hoja7.Cells(i, 3)
8/18/2019 codigo cotizacion
38/40
End If Next i
item2 = Hoja3.Range("a:b").CurrentRegion.Rows.Count lbm_incidentes.Clear For i = 2 To item2 If Val(Hoja3.Cells(i, 1)) = Val(txa_cotiza) Then lbm_incidentes.AddItem Hoja3.Cells(i, 2) End If Next i
item3 = Hoja4.Range("a:b").CurrentRegion.Rows.Count lbm_desc.Clear For i = 2 To item3 If Val(Hoja4.Cells(i, 1)) = Val(txa_cotiza) Then lbm_desc.AddItem Hoja4.Cells(i, 2) End If Next i
item4 = Hoja5.Range("a:b").CurrentRegion.Rows.Count lbm_obs.Clear For i = 2 To item4 If Val(Hoja5.Cells(i, 1)) = Val(txa_cotiza) Then lbm_obs.AddItem Hoja5.Cells(i, 2) End If Next iEnd SubPrivate Sub mejora() Dim fila1, final1 As Integer
MsgBox filapublica ' esta es la fila de la cotización fila1 = 1 ' ciclo para encontrar el ultimo registro e igualar num cotizacacion nueva Do While Hoja1.Cells(fila1, 1) Empty fila1 = fila1 + 1 Loop final1 = fila1 Hoja1.Cells(filapublica, 17) = "CR" ' CIERRE DE APS Hoja1.Cells(filapublica, 19) = "CR-M-" & lb_numcot ' VINCULO CON LA APS NUEVA
Hoja1.Cells(fila1, 1) = Val(lb_numcot) Hoja1.Cells(fila1, 2) = Format(lb_fecha, "d-mmm-yy")
Hoja1.Cells(fila1, 3) = lba_emp Hoja1.Cells(fila1, 4) = lba_dom Hoja1.Cells(fila1, 5) = lba_tel Hoja1.Cells(fila1, 6) = lba_atencion Hoja1.Cells(fila1, 7) = lba_emails Hoja1.Cells(fila1, 8) = Val(txt_rate) Hoja1.Cells(fila1, 10) = Val(txt_inven) Hoja1.Cells(fila1, 33) = txt_planta Hoja1.Cells(fila1, 11) = Val(txt_precio) Hoja1.Cells(fila1, 12) = Val(txt_item)
8/18/2019 codigo cotizacion
39/40
Hoja1.Cells(fila1, 13) = Format(Val(txt_horas), "#,##0") Hoja1.Cells(fila1, 14) = Format(Val(txt_importe), "#,##0") Hoja1.Cells(fila1, 15) = Format(txt_finicio, "d-mmm-yy") Hoja1.Cells(fila1, 16) = Format(txt_ftermino, "d-mmm-yy") Hoja1.Cells(fila1, 17) = "P" Hoja1.Cells(fila1, 19) = "CR-M-" & Hoja1.Cells(filapublica, 1) ' Hoja1.Cells(fila1, 20) = Format(tx_fauto, "d-mmm-yy") Hoja1.Cells(fila1, 21) = tx_autorizacion Hoja1.Cells(fila1, 22) = tx_release Hoja1.Cells(fila1, 23) = tx_oc Hoja1.Cells(fila1, 24) = tx_semanal Hoja1.Cells(fila1, 25) = Format(tx_fpago, "d-mmm-yy") Hoja1.Cells(fila1, 26) = tx_numfact Hoja1.Cells(fila1, 27) = tx_requi Hoja1.Cells(fila1, 28) = tx_sello Hoja1.Cells(fila1, 29) = tx_pagara Hoja1.Cells(fila1, 30) = tx_inspe
fi1 = 2 Do While Hoja3.Cells(fi1, 1) Empty fi1 = fi1 + 1 Loop fil1 = fi1 For i = 0 To lbm_incidentes.ListCount - 1
Hoja3.Cells(fil1, 1) = Val(lb_numcot) Hoja3.Cells(fil1, 2) = UCase(lbm_incidentes.List(i, 0)) fil1 = fil1 + 1 Next
fi2 = 2Do While Hoja4.Cells(fi2, 1) Empty fi2 = fi2 + 1Loop final2 = fi2 For i = 0 To lbm_desc.ListCount - 1 Hoja4.Cells(final2, 1) = Val(lb_numcot) Hoja4.Cells(final2, 2) = UCase(lbm_desc.List(i, 0))
final2 = final2 + 1 Next
fi3 = 2 Do While Hoja5.Cells(fi3, 1) Empty fi3 = fi3 + 1 Loop final3 = fi3 For i = 0 To lbm_obs.ListCount - 1 Hoja5.Cells(final3, 1) = Val(lb_numcot) Hoja5.Cells(final3, 2) = UCase(lbm_obs.List(i, 0)) final3 = final3 + 1 Next
fi4 = 2
Do While Hoja7.Cells(fi4, 1) Empty fi4 = fi4 + 1Loop final4 = fi4 - 1 For i = 0 To lbm_numparte.ListCount - 1 Hoja7.Cells(final4, 1) = Val(lb_numcot) Hoja7.Cells(final4, 2) = lbm_numparte.List(i, 0) Hoja7.Cells(final4, 3) = UCase(lbm_nomparte.List(i, 1))
8/18/2019 codigo cotizacion
40/40
final4 = final4 + 1 NextEnd Sub
Recommended