dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: help please shift schedule

  1. #1
    Join Date
    Apr 2019
    Posts
    8

    help please shift schedule

    I need help, I have a table: ORG_TURNOS with the following fields: id, code, description, hentrada, hsalida, totalh and L, M, X, J, V, S, D (days of the week abbreviated type check), I would need to consult the query and check with the msflexgrid a loop if the day is true put the value of the field 'code', I do not know how to do this. below I indicate the source code

    Code:
    Private Sub Text1_LostFocus(Index As Integer)
        Select Case Index
            Case 1
                ArrayFestivos "ORG_FESTIVOS", Text1(0), " WHERE TRANSFERIBLE=-1"
                Grid.Clear
                fechainicial = "01/" & Text1(1) & "/" & Text1(0)
                numdias = DaysInMonth(fechainicial)
                For i = 0 To numdias
                    With Grid
                        .Cols = numdias + 3
                        .FontFixed.Bold = True
                        .CellFontBold = False
                        .Redraw = False
                        .Rows = 7
                        .FixedRows = 2
                        .ColAlignmentFixed = 4 'flexAlignCenterCenter
                        
                        For ii = 0 To .Rows - 1
                            .RowHeight(ii) = 300
                        Next
                        
                        .ColWidth(0) = 300
                        .ColWidth(1) = 1300
                        .TextMatrix(1, 1) = "ID EMPLEADO"
                        .ColWidth(i + 1) = 400
                        If i <= .Cols - 4 Then
                            .TextMatrix(0, i + 2) = Format(CStr(FormatDateTime(fechainicial + i, vbShortDate)), "dd")
                            .TextMatrix(1, i + 2) = Letradiasemana(i + 1 & "/" & Text1(1) & "/" & Text1(0))
                            If Weekday(fechainicial + i, vbMonday) = 7 Then
                                numc = i + 2
                                fila = 1
                                .Col = numc
                                .Row = fila
                                .CellForeColor = vbRed
                                .TextMatrix(2, i + 2) = "D"
                            End If
                        
                            If Weekday(fechainicial + i, vbMonday) = 7 Then
                                For filacolor = 3 To .Rows - 1
                                    .Row = filacolor
                                    .CellBackColor = RGB(209, 222, 253)
                                Next
                            End If
                            
                            For x = 0 To UBound(aFestivosN)
                                fechafest = Format(CStr(FormatDateTime(fechainicial + i, vbShortDate)), "dd/mm/yyyy")
                                If fechafest = aFestivosN(x) Then
                                    If Weekday(fechafest, vbMonday) = 7 Then
                                        numc = i + 3
                                        fila = 1
                                        .Col = numc
                                        .Row = fila
                                        .CellForeColor = vbRed
                                        .TextMatrix(2, i + 3) = "F"
                                    Else
                                        numc = i + 2
                                        fila = 1
                                        .Col = numc
                                        .Row = fila
                                        .CellForeColor = vbRed
                                        .TextMatrix(2, i + 2) = "F"
                                    End If
                                End If
                            Next x
                        End If
                        
                        .ColWidth(.Cols - 1) = 900
                        .TextMatrix(1, .Cols - 1) = "HORAS"
                        .Col = 1
                        .Row = 3
                        .Redraw = True
                    End With
                Next i
                'End If
        End Select
    End Sub
    thanks for all

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,320

    Re: help please shift schedule

    I can't really make out the question,
    The code you have shown is for text1 lost focus so I am nto even sure how that applies to the question.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Apr 2019
    Posts
    8

    Re: help please shift schedule

    yes, when text1 lostfocus then setup the msflexgrid with a calendar

  4. #4
    Join Date
    Apr 2019
    Posts
    8

    Re: help please shift schedule

    I want is to open the recordset of the table org_turnos and compare the registers L, M, X, J, V, S, D with the columns of the msflexgrid by weekly cycles, if they agree that it puts in the cell the value of the code fieldName:  monthly shift shedule.jpg
Views: 25
Size:  22.0 KBName:  table org_turnos.jpg
Views: 24
Size:  9.0 KB
    Last edited by juanfrasantos; April 9th, 2019 at 10:19 AM.

  5. #5
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,320

    Re: help please shift schedule

    Where is the data in the flex grid coming from?
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Apr 2019
    Posts
    8

    Re: help please shift schedule

    They are not, do not do that, data coming from table name org_turnos, two record ID EMPLEADO-TURNO1,TURNO2 in each cell according to letterweekdayname: M or M1, en de column1 of msflexgrid the record of field descripcion. Name:  table org_turnos.jpg
Views: 26
Size:  9.0 KB
    Last edited by juanfrasantos; April 9th, 2019 at 10:58 AM.

  7. #7
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,320

    Re: help please shift schedule

    Sorry can not understand your response. If as I suspect the data is coming from the table then it would seem that what you need is a query or two against the db, not a loop to check everything in the grid
    Always use [code][/code] tags when posting code.

  8. #8
    Join Date
    Apr 2019
    Posts
    8

    Re: help please shift schedule

    I would like to know how to transfer the data from the org_turnos table to the msflexgrid by means of a check loop the days of the week (msflexgrid columns) with the table data per weekly cycles
    thanks for all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)