Results 1 to 10 of 10

Thread: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2024
    Posts
    8

    Question How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    In my case I have to shift the print of "tot" in the row at column number 6, leaving the column from 0 to 5 blank in the same row (keeping in mind column count start by 0 etc.)
    How can I do this?
    My actual situation is in the file JPG attachment
    Attached Images Attached Images  

  2. #2

    Thread Starter
    New Member
    Join Date
    Jun 2024
    Posts
    8

    Re: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    This is my programmed button with click event which I can read data from the data base


    Private Sub btnLeggi_Click()


    If Op1 = True And optd = 0 Then
    mysql = " SELECT ordct.ccl, cli.RAGSOC, ordcc.*,isnull(ordct.trasp,'') as trasp FROM ordcc " _
    & " left outer join ordct on ordct.ndoc=ordcc.ndoc and ordct.ddoc=ordcc.ddoc right join CLI on CLI.ID = ORDCT.CCL" _
    & " WHERE ordcc.DCONS BETWEEN '" & FNRD(datain) & "' AND '" & FNRD(datafi) & "' and ordcc.CARTIC between '" & Ss(cartin) & "' and '" & Ss(cartfi) & "'" _
    & " AND ordcc.DDOC BETWEEN '" & FNRD(din) & "' AND '" & FNRD(dfi) & "'" _
    & " and ordcc.ndoc BETWEEN '" & Ss(FNSPAZISX(ndocin, 10)) & "' AND '" & Ss(FNSPAZISX(ndocfi, 10)) & "'"

    If Val(cli) <> 0 Then mysql = mysql & " AND ordcc.CCL = " & Val(cli) & ""
    If chiusi = True Then mysql = mysql & " AND ordcc.qtres=0"
    If aperti = True Then mysql = mysql & " AND ordcc.qtres<>0"
    mysql = mysql & " ORDER BY ordcc.CCL,ordcc.dCONS"

    End If

    Dim KIM As String
    With dgOrdini
    dgOrdini.Rows = 1
    If Not OpenRsDb Then MsgBox ("ERRORE")
    If rsdb.EOF = True Then lblTrovati = "Non ci sono ordini.": 'Call TappoTabella: Exit Sub

    Do While Not rsdb.EOF

    riga = riga + 1
    .Rows = riga + 1
    '.TextMatrix(riga, 0) = 0



    .TextMatrix(riga, 0) = rsdb!CCL 'codice cliente
    .TextMatrix(riga, 1) = rsdb!ragsoc 'rag. soc.
    .TextMatrix(riga, 2) = "NDOC" 'num. ord. interno
    .TextMatrix(riga, 3) = rsdb!DDOC 'd. ord
    .TextMatrix(riga, 4) = rsdb!CCL 'n. ord. cliente
    .TextMatrix(riga, 5) = rsdb!CARTIC 'cod. articolo
    .TextMatrix(riga, 6) = rsdb!da 'descrizione
    .TextMatrix(riga, 7) = rsdb!qt 'quantita ordinata
    .TextMatrix(riga, 8) = rsdb!qtc 'quantita consegnata
    .TextMatrix(riga, 9) = rsdb!qtres 'residuo
    .TextMatrix(riga, 10) = rsdb!dcons 'data consegnata


    rsdb.MoveNext
    Loop


    .Subtotal flexSTSum, [/I][/I], 7, , vbGreen, , , " Tot", 0, True

    End With

    End Sub[/I]

  3. #3
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,437

    Re: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    Show us the code you use to fill the grid and to display the "tot" rows.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2024
    Posts
    8

    Re: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    Private Sub btnLeggi_Click()

    If Op1 = True And optd = 0 Then
    mysql = " SELECT ordct.ccl, cli.RAGSOC, ordcc.*,isnull(ordct.trasp,'') as trasp FROM ordcc " _
    & " left outer join ordct on ordct.ndoc=ordcc.ndoc and ordct.ddoc=ordcc.ddoc right join CLI on CLI.ID = ORDCT.CCL" _
    & " WHERE ordcc.DCONS BETWEEN '" & FNRD(datain) & "' AND '" & FNRD(datafi) & "' and ordcc.CARTIC between '" & Ss(cartin) & "' and '" & Ss(cartfi) & "'" _
    & " AND ordcc.DDOC BETWEEN '" & FNRD(din) & "' AND '" & FNRD(dfi) & "'" _
    & " and ordcc.ndoc BETWEEN '" & Ss(FNSPAZISX(ndocin, 10)) & "' AND '" & Ss(FNSPAZISX(ndocfi, 10)) & "'"

    If Val(cli) <> 0 Then mysql = mysql & " AND ordcc.CCL = " & Val(cli) & ""
    If chiusi = True Then mysql = mysql & " AND ordcc.qtres=0"
    If aperti = True Then mysql = mysql & " AND ordcc.qtres<>0"
    mysql = mysql & " ORDER BY ordcc.CCL,ordcc.dCONS"

    End If

    Dim KIM As String
    With dgOrdini
    dgOrdini.Rows = 1
    If Not OpenRsDb Then MsgBox ("ERRORE")
    If rsdb.EOF = True Then lblTrovati = "Non ci sono ordini.": 'Call TappoTabella: Exit Sub

    Do While Not rsdb.EOF

    riga = riga + 1
    .Rows = riga + 1
    '.TextMatrix(riga, 0) = 0



    .TextMatrix(riga, 0) = rsdb!CCL 'codice cliente
    .TextMatrix(riga, 1) = rsdb!ragsoc 'rag. soc.
    .TextMatrix(riga, 2) = "NDOC" 'num. ord. interno
    .TextMatrix(riga, 3) = rsdb!DDOC 'd. ord
    .TextMatrix(riga, 4) = rsdb!CCL 'n. ord. cliente
    .TextMatrix(riga, 5) = rsdb!CARTIC 'cod. articolo
    .TextMatrix(riga, 6) = rsdb!da 'descrizione
    .TextMatrix(riga, 7) = rsdb!qt 'quantita ordinata
    .TextMatrix(riga, 8) = rsdb!qtc 'quantita consegnata
    .TextMatrix(riga, 9) = rsdb!qtres 'residuo
    .TextMatrix(riga, 10) = rsdb!dcons 'data consegnata


    rsdb.MoveNext
    Loop

    .Subtotal flexSTSum, , 7, , vbGreen, , , " Tot", 0, True


    End With

    End Sub

  5. #5
    Hyperactive Member
    Join Date
    Jan 2018
    Posts
    304

    Re: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    You just want to move the "Tot" text?
    You can completely alter the rows after each call to .Subtotal, something like:
    Code:
    For lRow = 1 To .Rows - 1
       If .IsSubtotal(lRow) Then
         .TextMatrix(lRow, 0) = ""
         .TextMatrix(lRow, 5) = "Tot"
      End If
    Next

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,536

    Re: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    Your description of what you want to accomplish is very confusing. AND, that tiny image is almost/really unreadable.

    I don't see any "tot" letters in column 6 (which would be col(7)) in your little picture.

    And I surely don't understand what you mean to make the first 6 columns (0 through 5) blank after you do whatever you want to do.

    Try again (I don't need your code on filling the grid, more interested in what you have done in code to do whatever you want to do.)

    ahenry might have your solution...but to WHAT? Why? To accomplish what?

    Sam
    Sam I am (as well as Confused at times).

  7. #7
    Hyperactive Member
    Join Date
    Jan 2018
    Posts
    304

    Re: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    The thing to watch out for with VSFlexGrid is that the subtotal function can tie into a lot of different features. So if you're just filling in the data once and subtotalling you can customize without worries, but if you get fancy with the grid functions then customizing it might not be worth the effort.

  8. #8

    Thread Starter
    New Member
    Join Date
    Jun 2024
    Posts
    8

    Re: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    Quote Originally Posted by SamOscarBrown View Post
    Your description of what you want to accomplish is very confusing. AND, that tiny image is almost/really unreadable.

    I don't see any "tot" letters in column 6 (which would be col(7)) in your little picture.

    And I surely don't understand what you mean to make the first 6 columns (0 through 5) blank after you do whatever you want to do.

    Try again (I don't need your code on filling the grid, more interested in what you have done in code to do whatever you want to do.)

    ahenry might have your solution...but to WHAT? Why? To accomplish what?

    Sam







    Hi... I solved it with this code Thank you very much anyway!




    Private Sub btnLeggi_Click()

    If Op1 = True And optd = 0 Then
    mysql = " SELECT ordct.ccl, cli.RAGSOC, ordcc.*,isnull(ordct.trasp,'') as trasp FROM ordcc " _
    & " left outer join ordct on ordct.ndoc=ordcc.ndoc and ordct.ddoc=ordcc.ddoc right join CLI on CLI.ID = ORDCT.CCL" _
    & " WHERE ordcc.DCONS BETWEEN '" & FNRD(datain) & "' AND '" & FNRD(datafi) & "' and ordcc.CARTIC between '" & Ss(cartin) & "' and '" & Ss(cartfi) & "'" _
    & " AND ordcc.DDOC BETWEEN '" & FNRD(din) & "' AND '" & FNRD(dfi) & "'" _
    & " and ordcc.ndoc BETWEEN '" & Ss(FNSPAZISX(ndocin, 10)) & "' AND '" & Ss(FNSPAZISX(ndocfi, 10)) & "'"

    If Val(cli) <> 0 Then mysql = mysql & " AND ordcc.CCL = " & Val(cli) & ""
    If chiusi = True Then mysql = mysql & " AND ordcc.qtres=0"
    If aperti = True Then mysql = mysql & " AND ordcc.qtres<>0"
    mysql = mysql & " ORDER BY ordcc.CCL,ordcc.dCONS"

    End If

    Dim KIM As String
    With dgOrdini
    dgOrdini.Rows = 1
    If Not OpenRsDb Then MsgBox ("ERRORE")
    If rsdb.EOF = True Then lblTrovati = "Non ci sono ordini."

    Dim riga As Integer

    Do While Not rsdb.EOF

    riga = riga + 1
    .Rows = riga + 1
    '.TextMatrix(riga, 0) = 0


    'da qua incolla

    .TextMatrix(riga, 0) = rsdb!CCL 'codice cliente
    .TextMatrix(riga, 1) = rsdb!ragsoc 'rag. soc.
    .TextMatrix(riga, 2) = rsdb!ndoc 'num. ord. interno
    .TextMatrix(riga, 3) = rsdb!DDOC 'd. ord
    .TextMatrix(riga, 4) = rsdb!CCL 'n. ord. cliente
    .TextMatrix(riga, 5) = rsdb!CARTIC 'cod. articolo
    .TextMatrix(riga, 6) = rsdb!da 'descrizione
    .TextMatrix(riga, 7) = rsdb!qt 'quantita ordinata
    .TextMatrix(riga, 8) = rsdb!qtc 'quantita consegnata
    .TextMatrix(riga, 9) = rsdb!qtres 'residuo
    .TextMatrix(riga, 10) = rsdb!dcons 'data consegnata


    rsdb.MoveNext
    Loop

    .Subtotal flexSTSum, , 7, , , vbRed, , " ", 0, False:



    For i = 1 To dgOrdini.Rows - 1 Step 1

    If .TextMatrix(i, 0) = " " Then
    .TextMatrix(i, 6) = "tot"

    End If
    Next i

    End With

    End Sub

  9. #9

    Thread Starter
    New Member
    Join Date
    Jun 2024
    Posts
    8

    Re: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    Quote Originally Posted by ahenry View Post
    The thing to watch out for with VSFlexGrid is that the subtotal function can tie into a lot of different features. So if you're just filling in the data once and subtotalling you can customize without worries, but if you get fancy with the grid functions then customizing it might not be worth the effort.








    Hi... I solved it with this code Thank you very much anyway!




    Private Sub btnLeggi_Click()

    If Op1 = True And optd = 0 Then
    mysql = " SELECT ordct.ccl, cli.RAGSOC, ordcc.*,isnull(ordct.trasp,'') as trasp FROM ordcc " _
    & " left outer join ordct on ordct.ndoc=ordcc.ndoc and ordct.ddoc=ordcc.ddoc right join CLI on CLI.ID = ORDCT.CCL" _
    & " WHERE ordcc.DCONS BETWEEN '" & FNRD(datain) & "' AND '" & FNRD(datafi) & "' and ordcc.CARTIC between '" & Ss(cartin) & "' and '" & Ss(cartfi) & "'" _
    & " AND ordcc.DDOC BETWEEN '" & FNRD(din) & "' AND '" & FNRD(dfi) & "'" _
    & " and ordcc.ndoc BETWEEN '" & Ss(FNSPAZISX(ndocin, 10)) & "' AND '" & Ss(FNSPAZISX(ndocfi, 10)) & "'"

    If Val(cli) <> 0 Then mysql = mysql & " AND ordcc.CCL = " & Val(cli) & ""
    If chiusi = True Then mysql = mysql & " AND ordcc.qtres=0"
    If aperti = True Then mysql = mysql & " AND ordcc.qtres<>0"
    mysql = mysql & " ORDER BY ordcc.CCL,ordcc.dCONS"

    End If

    Dim KIM As String
    With dgOrdini
    dgOrdini.Rows = 1
    If Not OpenRsDb Then MsgBox ("ERRORE")
    If rsdb.EOF = True Then lblTrovati = "Non ci sono ordini."

    Dim riga As Integer

    Do While Not rsdb.EOF

    riga = riga + 1
    .Rows = riga + 1
    '.TextMatrix(riga, 0) = 0


    'da qua incolla

    .TextMatrix(riga, 0) = rsdb!CCL 'codice cliente
    .TextMatrix(riga, 1) = rsdb!ragsoc 'rag. soc.
    .TextMatrix(riga, 2) = rsdb!ndoc 'num. ord. interno
    .TextMatrix(riga, 3) = rsdb!DDOC 'd. ord
    .TextMatrix(riga, 4) = rsdb!CCL 'n. ord. cliente
    .TextMatrix(riga, 5) = rsdb!CARTIC 'cod. articolo
    .TextMatrix(riga, 6) = rsdb!da 'descrizione
    .TextMatrix(riga, 7) = rsdb!qt 'quantita ordinata
    .TextMatrix(riga, 8) = rsdb!qtc 'quantita consegnata
    .TextMatrix(riga, 9) = rsdb!qtres 'residuo
    .TextMatrix(riga, 10) = rsdb!dcons 'data consegnata


    rsdb.MoveNext
    Loop

    .Subtotal flexSTSum, , 7, , , vbRed, , " ", 0, False:



    For i = 1 To dgOrdini.Rows - 1 Step 1

    If .TextMatrix(i, 0) = " " Then
    .TextMatrix(i, 6) = "tot"

    End If
    Next i

    End With

    End Sub

  10. #10

    Thread Starter
    New Member
    Join Date
    Jun 2024
    Posts
    8

    Re: How can I shft the print of subTotal in the DataGrid/control VSFLEXGRID in a row?

    Quote Originally Posted by Arnoutdv View Post
    Show us the code you use to fill the grid and to display the "tot" rows.









    Hi... I solved it with this code Thank you very much anyway!




    Private Sub btnLeggi_Click()

    If Op1 = True And optd = 0 Then
    mysql = " SELECT ordct.ccl, cli.RAGSOC, ordcc.*,isnull(ordct.trasp,'') as trasp FROM ordcc " _
    & " left outer join ordct on ordct.ndoc=ordcc.ndoc and ordct.ddoc=ordcc.ddoc right join CLI on CLI.ID = ORDCT.CCL" _
    & " WHERE ordcc.DCONS BETWEEN '" & FNRD(datain) & "' AND '" & FNRD(datafi) & "' and ordcc.CARTIC between '" & Ss(cartin) & "' and '" & Ss(cartfi) & "'" _
    & " AND ordcc.DDOC BETWEEN '" & FNRD(din) & "' AND '" & FNRD(dfi) & "'" _
    & " and ordcc.ndoc BETWEEN '" & Ss(FNSPAZISX(ndocin, 10)) & "' AND '" & Ss(FNSPAZISX(ndocfi, 10)) & "'"

    If Val(cli) <> 0 Then mysql = mysql & " AND ordcc.CCL = " & Val(cli) & ""
    If chiusi = True Then mysql = mysql & " AND ordcc.qtres=0"
    If aperti = True Then mysql = mysql & " AND ordcc.qtres<>0"
    mysql = mysql & " ORDER BY ordcc.CCL,ordcc.dCONS"

    End If

    Dim KIM As String
    With dgOrdini
    dgOrdini.Rows = 1
    If Not OpenRsDb Then MsgBox ("ERRORE")
    If rsdb.EOF = True Then lblTrovati = "Non ci sono ordini."

    Dim riga As Integer

    Do While Not rsdb.EOF

    riga = riga + 1
    .Rows = riga + 1
    '.TextMatrix(riga, 0) = 0


    'da qua incolla

    .TextMatrix(riga, 0) = rsdb!CCL 'codice cliente
    .TextMatrix(riga, 1) = rsdb!ragsoc 'rag. soc.
    .TextMatrix(riga, 2) = rsdb!ndoc 'num. ord. interno
    .TextMatrix(riga, 3) = rsdb!DDOC 'd. ord
    .TextMatrix(riga, 4) = rsdb!CCL 'n. ord. cliente
    .TextMatrix(riga, 5) = rsdb!CARTIC 'cod. articolo
    .TextMatrix(riga, 6) = rsdb!da 'descrizione
    .TextMatrix(riga, 7) = rsdb!qt 'quantita ordinata
    .TextMatrix(riga, 8) = rsdb!qtc 'quantita consegnata
    .TextMatrix(riga, 9) = rsdb!qtres 'residuo
    .TextMatrix(riga, 10) = rsdb!dcons 'data consegnata


    rsdb.MoveNext
    Loop

    .Subtotal flexSTSum, , 7, , , vbRed, , " ", 0, False:



    For i = 1 To dgOrdini.Rows - 1 Step 1

    If .TextMatrix(i, 0) = " " Then
    .TextMatrix(i, 6) = "tot"

    End If
    Next i

    End With

    End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width