Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help about OneToMany form designs !!!
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Help about OneToMany form designs !!!
Divers
Thread ID:
00984620
Message ID:
00984620
Vues:
66
Hi All,

i've trouble about OneToMany forms such as Invoice forms.
i'am using standart toolbar on my applications and i executes
add delete edit etc. commands via
_screen.activeform.addnew()
_screen.activeform.delete() ...
command for toolbar cmdbuttos click codes for form methods.

i've designed my invoice form and preffered
for parent table fields ( invoice no,invoice date,InvoiceID,subotal,tax,grandtotal ... ) with textbox,combobox etc

for child table fields ( itemCode,Quantity,price etc .. ) grid

my table(s) structures like below

invheader.dbf
---------------
myguid c(38) PK indexed && default value guid()
InvoiceId Integer regular indexed



invdetail.dbf
--------------
myguid c(38) PK indexed && default value guid()
pmyguid c(38) regular indexed && default value guid()
InvoiceId Integer regular indexed

Relation between invoiceheader.myguid -> invoicedetail.Pmyguid

grid.recordsource = invoicedetail
grid.linkmaster = invoiceheader
grid.relationalexpr = Pmyguid
grid.childorder = Pmyguid
* function for myguid field default value
Function guid()
Local pGUID,rGUID
Declare Integer UuidCreate In 'RPCRT4.dll' String @pguid
Declare Integer StringFromGUID2 In 'Ole32.dll' ;
	string rguid, String @lpsz, Integer cchMax

pGUID=Replicate(Chr(0),16)
rGUID=Replicate(Chr(0),80)

Return Iif(Inlist(UuidCreate(@pGUID),0,1824),;
	Iif(StringFromGUID2(pGUID,@rGUID,40) # 0, ;
	Strconv(Left(rGUID,76),6), ""),"")
Endfunc
i am using LcFile1,LcFile2.. properties for assign the table names for navigate and the other actions.
such as for last method
select (thisform.LcFile1)
go bottom
_screen.activeform.refresh
my great troubles

1- when i use below codes at grid when,valid event for navigate and for other actions
when activecontrol is grid some calculations from grid afterrowcolchange event
doesnt updates in parenttable (lcfile1)
*grid when 
thisform.lcfile1 = this.recordsource
_screen.activeform.refresh

* grid valid
thisform.lcfile1 = this.linkmaster
_screen.activeform.refresh
2- when i dont use above codes at grid this time it works
but record pointer moves to another usually goes lastrecord
( in form init i am redirect to last record via go bottom command )

3-when i use modal forms for add-edit occurs same things

shortly i wantto use invoice forms like i above described and parent fields
should be on textbox,combobox etc. and child fields sohould be on grid.

detail entries will be on grid and some calculations total,value addedtax,grand total will be on textbox
and calculations will auto calculate on grid afterrowcolchange event will refresh the results on textbox
and also will update the tables both of parent-child.


please helpme that where i'am doing mistaken ?
and as my wish if you were me how would be the your forms designs,settings,codes ?
or please refer me via simple code samples or show me download links about this issue

TIA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform