grid/browse for invoicing help
Moderator: Rathinagiri
Re: grid/browse for invoicing help
Thanks so much.
Now workiing .................. Franco
Now workiing .................. Franco
Last edited by franco on Mon Feb 03, 2014 8:20 pm, edited 1 time in total.
All The Best,
Franco
Canada
Franco
Canada
Re: grid/browse for invoicing help
daniel, javier
Thanks so much. Now working.
Do you know how to change or copy the save object in the grid to my own object (savefranco). I would like on save to stay
in the original cell instead of going to cell 1. That way in the onchange I can save and stay in the present cell. and also upate
other textboxes on the form.
Thanks again ............. This is great .................. Franco
Thanks so much. Now working.
Do you know how to change or copy the save object in the grid to my own object (savefranco). I would like on save to stay
in the original cell instead of going to cell 1. That way in the onchange I can save and stay in the present cell. and also upate
other textboxes on the form.
Thanks again ............. This is great .................. Franco
All The Best,
Franco
Canada
Franco
Canada
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: grid/browse for invoicing help
Hi Franco,
I do not understand what you want, but the valosres cells can be stored in an array do such and end posisionarte can save and the cell that you want and without any repeat sample is working hard to help you!
regards
I do not understand what you want, but the valosres cells can be stored in an array do such and end posisionarte can save and the cell that you want and without any repeat sample is working hard to help you!
regards
Re: grid/browse for invoicing help
Javier,
I am using a table. not an array. When I (save) the table is updated, this is good, but hi-lighted cell is row 1 ,col 1 after save.
I would like to stay on current cell which could be row 3 col 3.
Thanks again .............................. Franco
I am using a table. not an array. When I (save) the table is updated, this is good, but hi-lighted cell is row 1 ,col 1 after save.
I would like to stay on current cell which could be row 3 col 3.
Thanks again .............................. Franco
All The Best,
Franco
Canada
Franco
Canada
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: grid/browse for invoicing help
Hola Franco, creo que esto es lo que buscas....
Code: Select all
/*
* HMG Data-Bound Grid Demo
* (c) 2010 Roberto Lopez
*/
#include "hmg.ch"
Function Main
Local aValue := { Nil , Nil }
PUBLIC aValorCell
* Grid Column Controls Definitions
aCtrl_1 := {'TEXTBOX','NUMERIC','9999999999'}
aCtrl_2 := {'TEXTBOX','CHARACTER'}
aCtrl_3 := {'TEXTBOX','CHARACTER'}
aCtrl_4 := {'DATEPICKER','UPDOWN'}
aCtrl_5 := { 'CHECKBOX' , 'Yes' , 'No' }
aCtrl_6 := {'TEXTBOX','CHARACTER'}
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 510 ;
TITLE 'Hello World!' ;
MAIN
DEFINE MAIN MENU
POPUP 'File'
ITEM 'Append (Alt+A)' ACTION Form_1.Grid_1.Append
ITEM 'Set RecNo' ACTION Form_1.Grid_1.RecNo := val(InputBox('',''))
ITEM 'Get RecNo' ACTION MsgInfo( Str(Form_1.Grid_1.RecNo) )
ITEM 'Delete (Alt+D)' ACTION Form_1.Grid_1.Delete
ITEM 'Recall (Alt+R)' ACTION Form_1.Grid_1.Recall
ITEM 'Get Value' ACTION ( aValue := Form_1.Grid_1.Value , MsgInfo( Str( aValue [1] ) + ' , ' + Str( aValue [2] ) ) )
ITEM 'Set Value' ACTION ( aValue [ 1 ] := val(InputBox('New Row','Selected Cell (Value)')) , aValue [ 2 ] := val(InputBox('New Col','Selected Cell (Value)')) , Form_1.Grid_1.Value := { aValue [ 1 ] , aValue [ 2 ] } )
ITEM 'Save Pending Changes (Alt+S)' ACTION SalvaCell()
ITEM 'Clear Changes Buffer (Undo) (ALt+U)' ACTION Form_1.Grid_1.ClearBuffer
END POPUP
END MENU
*.............................................................
SELECT 1
USE TEST ALIAS TEST
INDEX ON CODE TO TEST_CODE
GO TOP
*..............................................................
SELECT 2
USE CHILD ALIAS CHILD
INDEX ON CODE TO CHILD_CODE
GO TOP
*..............................................................
SELECT 1
SET RELATION TO CODE INTO CHILD
GO TOP
*..............................................................
@ 10,10 GRID Grid_1 ;
WIDTH 770 ;
HEIGHT 440 ;
HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5','Column 6'} ;
WIDTHS {140,140,140,100,100,110};
EDIT ;
VALUE { 1 , 1 } ;
COLUMNCONTROLS { aCtrl_1 , aCtrl_2 , aCtrl_3 , aCtrl_4 , aCtrl_5 , aCtrl_6 } ;
ROWSOURCE "Test" ;
COLUMNFIELDS { 'Code' , 'First' , 'Last' , 'Birth' , 'Married' , 'date()+recno()' } ;
COLUMNWHEN { { || .T. } , { || .T. } , { || .T. } , { || .T. } , { || .T. } , { || .F. } } ;
ALLOWDELETE
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
PROCEDURE SalvaCell()
aValorCell := Form_1.Grid_1.VALUE
Form_1.Grid_1.Save
Form_1.Grid_1.VALUE := aValorCell
RETURN NIL
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: grid/browse for invoicing help
What I did is very simple:
1 -. I keep the value of the cell in a PUBLIC variable, which gives me the row and column.
2 -. Except as modified in the GRID.
. 3 - Finally I say that I put in the value of the cell that keep on varying PUBLIC!
regards
1 -. I keep the value of the cell in a PUBLIC variable, which gives me the row and column.
2 -. Except as modified in the GRID.
. 3 - Finally I say that I put in the value of the cell that keep on varying PUBLIC!
regards
Re: grid/browse for invoicing help
Javier,
This looks logical. I will try and let you know.
Thanks again ........... Franco
This looks logical. I will try and let you know.
Thanks again ........... Franco
All The Best,
Franco
Canada
Franco
Canada
Re: grid/browse for invoicing help
javier,
I have changed this post
I moved the public variable to a Local variable and it worked fine.
I am using an invoice item table with fields
item, qty, description, retail, sellprice, and qty*sellprice
This is the starting code for my invoice.
#include <hmg.ch>
function invs
Local aValue := { Nil , Nil }
* Grid Column Controls Definitions
aCtrl_1 := {'TEXTBOX','CHARACTER'}
aCtrl_2 := {'TEXTBOX','NUMERIC', '9999.99'}
aCtrl_3 := {'TEXTBOX','CHARACTER'}
aCtrl_4 := {'TEXTBOX', 'NUMERIC', '99999.99'}
aCtrl_5 := {'TEXTBOX', 'NUMERIC', '99999.99' }
aCtrl_6 := {'TEXTBOX','NUMERIC', '999999.99' }
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 510 ;
TITLE 'Hello World!' ;
child
*.............................................................
SELECT 1
USE INV_ITEM
GO TOP
*..............................................................
@ 10,10 GRID Grid_1 ;
WIDTH 770 ;
HEIGHT 440 ;
HEADERS {'Item','Quantity','Description','List','Unit Price','Total'} ;
WIDTHS {140,100,140,100,100,110};
EDIT ;
VALUE { 1 , 1 } ;
COLUMNCONTROLS { aCtrl_1 , aCtrl_2 , aCtrl_3 , aCtrl_4 , aCtrl_5 , aCtrl_6 } ;
ROWSOURCE "INV_ITEM" ;
COLUMNFIELDS { 'ITEM' , 'QTY' , 'DESC' , 'LIST' , 'UNIT_PRICE' , 'round(QTY*UNIT_PRICE,2)' } ;
COLUMNWHEN { { || .F. } , { || .T. } , { || .T. } , { || .T. } , { || .T. } , { || .F. } } ;
ALLOWDELETE;
ON CHANGE SalvaCell() ;
ALLOWAPPEND
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
PROCEDURE SalvaCell()
Local aValorCell
aValorCell := Form_1.Grid_1.VALUE
Form_1.Grid_1.Save
Form_1.Grid_1.VALUE := aValorCell
RETURN NIL
Thanks again .................................. Franco
I have changed this post
I moved the public variable to a Local variable and it worked fine.
I am using an invoice item table with fields
item, qty, description, retail, sellprice, and qty*sellprice
This is the starting code for my invoice.
#include <hmg.ch>
function invs
Local aValue := { Nil , Nil }
* Grid Column Controls Definitions
aCtrl_1 := {'TEXTBOX','CHARACTER'}
aCtrl_2 := {'TEXTBOX','NUMERIC', '9999.99'}
aCtrl_3 := {'TEXTBOX','CHARACTER'}
aCtrl_4 := {'TEXTBOX', 'NUMERIC', '99999.99'}
aCtrl_5 := {'TEXTBOX', 'NUMERIC', '99999.99' }
aCtrl_6 := {'TEXTBOX','NUMERIC', '999999.99' }
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 510 ;
TITLE 'Hello World!' ;
child
*.............................................................
SELECT 1
USE INV_ITEM
GO TOP
*..............................................................
@ 10,10 GRID Grid_1 ;
WIDTH 770 ;
HEIGHT 440 ;
HEADERS {'Item','Quantity','Description','List','Unit Price','Total'} ;
WIDTHS {140,100,140,100,100,110};
EDIT ;
VALUE { 1 , 1 } ;
COLUMNCONTROLS { aCtrl_1 , aCtrl_2 , aCtrl_3 , aCtrl_4 , aCtrl_5 , aCtrl_6 } ;
ROWSOURCE "INV_ITEM" ;
COLUMNFIELDS { 'ITEM' , 'QTY' , 'DESC' , 'LIST' , 'UNIT_PRICE' , 'round(QTY*UNIT_PRICE,2)' } ;
COLUMNWHEN { { || .F. } , { || .T. } , { || .T. } , { || .T. } , { || .T. } , { || .F. } } ;
ALLOWDELETE;
ON CHANGE SalvaCell() ;
ALLOWAPPEND
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
PROCEDURE SalvaCell()
Local aValorCell
aValorCell := Form_1.Grid_1.VALUE
Form_1.Grid_1.Save
Form_1.Grid_1.VALUE := aValorCell
RETURN NIL
Thanks again .................................. Franco
Last edited by franco on Wed Feb 05, 2014 4:43 am, edited 1 time in total.
All The Best,
Franco
Canada
Franco
Canada
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: grid/browse for invoicing help
Hi frank,
No, if I'm in any cell in the GRID, for example, (2.5) and I do Click on Save, Save the changes made and is still positioned in the cell (2,5). It does not return to the cell (1,1). You command the *. Exe to try it.
Regards
No, if I'm in any cell in the GRID, for example, (2.5) and I do Click on Save, Save the changes made and is still positioned in the cell (2,5). It does not return to the cell (1,1). You command the *. Exe to try it.
Regards
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: grid/browse for invoicing help
Hi frank,
I should not have difference, since both work equally though as I'm only using a single *. Prg is better to use private variables! as they are visible throughout the *. PRG, and Public variables are visibres any *. PRG if my example was more than a * PRG.
Greetings.
I should not have difference, since both work equally though as I'm only using a single *. Prg is better to use private variables! as they are visible throughout the *. PRG, and Public variables are visibres any *. PRG if my example was more than a * PRG.
Greetings.