With Thisform numerollamada=.text1.value nDialogType = 4 + 32 + 256 * 4 = Yes and No buttons * 32 = Question mark icon * 256 = Second button is default nAnswer = MESSAGEBOX("Desea asignar la fecha de atención/solución para esta llamada?", nDialogType, "Asignación fecha atención/solución") DO CASE CASE nAnswer = 6 If empty(.pagellamadas.page4.txtFechaatencion.value) then if datetime() >= .pagellamadas.page1.txtfechacita.value then if empty(.pagellamadas.page1.txtfechacita.value) then wildcard=.text4.value else wildcard=.pagellamadas.page1.txtfechacita.value endif *CALCULO PARA EL TIEMPO DE FECHA ATENCIÓN-FECHA APERTURA calias=alias() valtot = val(sys(11,datetime())) - val(sys(11,wildcard)) ****** atencion ************************ fdias = 0 use festivos shared diadehoy=datetime() scan if festivos.fecha >= wildcard and festivos.fecha<= diadehoy fdias = fdias + 1 endif endscan valtot = valtot - fdias f_hora1 = hour(wildcard) f_minu1 = minute(wildcard) f_hora2 = hour(diadehoy) f_minu2 = minute(diadehoy) if f_hora1 < 7 f_hora1 = 7 f_minu1 = 0 endif if f_hora1 > 18 f_hora1 = 18 f_minu1 = 0 endif if f_hora2 < 7 f_hora2 = 7 f_minu2 = 0 endif if f_hora2 > 18 f_hora2 = 18 f_minu2 = 0 endif f_time1 = (f_hora1*60)+f_minu1 f_time2 = (f_hora2*60)+f_minu2 valtot = valtot*480 + f_time2 - f_time1 if valtot<0 valtot=0 endif *set step on *select &calias use llamadas set order to numero seek numerollamada replace llamadas.fatencion with diadehoy; llamadas.tatencion with valtot wait windows "Se asigno la fecha de atención de forma correcta " nowait else =messagebox("Esta ingresando una fecha inferior a la fecha"+chr(13)+"de la cita no se realizaran cambios.") endif else if not empty(.pagellamadas.page4.text1.value) and empty(.pagellamadas.page4.text2.value) then nDialogType = 0 + 16 nAnswer = MESSAGEBOX("No se puede asginar al fecha ni el tiempo de solución, hasta no haber colocado el fin de la espera del sistema", nDialogType, "Advertencia!!") else if empty(.pagellamadas.page4.txtfechasolucion.value) then replace llamadas.fcierre with datetime() &&diadehoy endif endif EndIf CASE nAnswer = 7 WAIT WINDOW 'Optó por no modificar fechas' nowait ENDCASE .refrescar() EndWithand i have the wizbtns class in my form where i placed the next code:
If frmllamadas_sw=0 then dodefault() else with thisform If frmllamadas_sw=1 then *VALIDA QUE TODOS LOS CAMPOS ESTEN LLENOS mistring="Por favor, Ingrese los siguientes datos:"+chr(13)+chr(13) If empty(.cmbestado.value) mistring=mistring+"Ingrese el estado de la llamada"+chr(13) valida_sw1=1 else valida_sw1=0 endif If empty(.combo1.value) and empty(.text5.value) mistring=mistring+"Ingrese la categoria del servicio"+chr(13) valida_sw2=1 else valida_sw2=0 endif If empty(.cmbprioridad.value) mistring=mistring+"Ingrese la prioridad de la llamada"+chr(13) valida_sw3=1 else valida_sw3=0 endif If empty(.pagellamadas.page1.txtcodusuario.value) mistring=mistring+"Ingrese el codigo del usuario"+chr(13) valida_sw4=1 else valida_sw4=0 endif if empty(.pagellamadas.page1.txtlocalidad.value) mistring=mistring+"Ingrese el codigo de la localidad/Edificio"+chr(13) valida_sw5=1 else valida_sw5=0 endif if empty(.pagellamadas.page1.text1.value) mistring=mistring+"Ingrese el serial del equipo"+chr(13) valida_sw6=1 else valida_sw6=0 endif if empty(.pagellamadas.page1.txtcolegio.value) mistring=mistring+"Ingrese el codigo del Colegio/Dependencia"+chr(13) valida_sw7=1 else valida_sw7=0 endif if empty(.pagellamadas.page2.text4.value) mistring=mistring+"Ingrese el nombre del ingeniero"+chr(13) valida_sw8=1 else valida_sw8=0 Endif if not empty(.pagellamadas.page1.txtfechacita.value) then if .pagellamadas.page1.txtfechacita.value<.text4.value then mistring=mistring+"La fecha de la cita no puede ser menor que la fecha de apertura de la llamada"+chr(13) valida_sw9=1 else valida_sw9=0 endif else valida_sw9=0 Endif if valida_sw1=0 and valida_sw2=0 and valida_sw3=0 and valida_sw4=0 and valida_sw5=0 and valida_sw6=0 and valida_sw7=0 and valida_sw8=0 and valida_sw9=0 then dodefault() frmllamadas_sw=0 valida_sw1="" valida_sw2="" valida_sw3="" valida_sw4="" valida_sw5="" valida_sw6="" valida_sw7="" valida_sw8="" valida_sw9="" else =messagebox(mistring,16,"Advertencia!!") endif endif endwith EndIf *SET STEP ON if this.parent.editmode ********* WITH OUTLOOK AUTOMATION: ********* With Thisform .CmbEstado.enabled=.t. .CmbPrioridad.Enabled=.t. .CmdPlus.Enabled=.t. .PageLlamadas.Page2.EdtProblema.enabled=.t. .PageLlamadas.Page2.CmbResponsable.enabled=.t. .PageLlamadas.Page4.Command1.enabled=.f. .PageLlamadas.Page4.Command2.enabled=.f. .PageLlamadas.Page1.CmdBuscarUsuario.enabled=.t. .PageLlamadas.Page2.CmdGenerarNueva.enabled=.f. .PageLlamadas.Page1.txtModelo.enabled=.t. EndWith frmllamadas_sw=1 else With Thisform ******* .CmbEstado.enabled=.f. .CmbPrioridad.Enabled=.f. .CmdPlus.Enabled=.f. .PageLlamadas.Page2.EdtProblema.enabled=.f. .PageLlamadas.Page2.CmbResponsable.enabled=.f. .PageLlamadas.Page4.Command1.enabled=.t. .PageLlamadas.Page4.Command2.enabled=.t. .PageLlamadas.Page1.CmdBuscarUsuario.enabled=.f. .PageLlamadas.Page2.CmdGenerarNueva.enabled=.t. .PageLlamadas.Page1.txtModelo.enabled=.f. frmllamadas_sw=0 *SET STEP ON if not empty(.pagellamadas.page4.txtfechaatencion.value) and not empty(.pagellamadas.page4.txtfechasolucion.value) and not empty(.pagellamadas.page4.txtfsoling.value) then if .pagellamadas.page4.txtfsoling.value < .pagellamadas.page4.txtfechaatencion.value then =messagebox("La fecha de solución no puede ser menor que la fecha de atención",16,"Adeventerncia") replace llamadas.fcierre2 with ctod(" / / : : ") .pagellamadas.page4.txtfsoling.refresh else If not empty(.pagellamadas.page4.txtFechaSolucion.value) and not empty(.pagellamadas.page4.txtFsoling.value) then *CALCULO PARA EL TIEMPO DE FECHA SOLUCION - FECHA ATENCIÓN diadehoy= .pagellamadas.page4.txtfsoling.value &&datetime() valtot = val(sys(11,.pagellamadas.page4.txtFechaatencion.value)) - val(sys(11,diadehoy)) fdias = 0 use festivos shared *go bottom scan if festivos.fecha >= .pagellamadas.page4.txtFechaatencion.value and festivos.fecha<=diadehoy fdias = fdias + 1 endif endscan valtot = valtot - fdias f_hora1 = hour(.pagellamadas.page4.txtFechaatencion.value) f_minu1 = minute(.pagellamadas.page4.txtFechaatencion.value) f_hora2 = hour(diadehoy) f_minu2 = minute(diadehoy) if f_hora1 < 7 f_hora1 = 7 f_minu1 = 0 endif if f_hora1 > 18 f_hora1 = 18 f_minu1 = 0 endif if f_hora2 < 7 f_hora2 = 7 f_minu2 = 0 endif If f_hora2 > 18 f_hora2 = 18 f_minu2 = 0 endif f_time1 = (f_hora1*60)+f_minu1 f_time2 = (f_hora2*60)+f_minu2 valtot = valtot*480 + f_time2 - f_time1 if valtot<0 valtot=0 endif use llamadas shared set order to numero seek .text1.value *&&llamadas.fcierre with diadehoy; .pagellamadas.page4.txttiemposolucion.value=valtot replace llamadas.tsolucion with valtot replace llamadas.estado with "CERRADA" .refresh() wait windows "Se asigno la fecha de solución de forma correcta " nowait *VALIDACION FCITA<FLLAMADA EndIf Endif Endif *set step on EndWith endif thisform.refrescar()So when i push the first button (the first code above) and then i press the add class button (the second code below the first) it displays the error: Uniqueness of index NUMERO is violated.