Hello Everyone,
My name is Chevin and I've recently got a job as a trainee windev developer
and i haveve come accross an issue
I have started a testproject and am now creating 2 windows:
first window
------------
Purpose:
- Fill a table with CUSTOMER info by clicking a button
- Open an edit window with detailed information about the selected customers invoices by clicking a button
Contains:
- Table (filled with "CUSTOMER" data from an sql file (trough query))
- 3 editfields (name, adress and ID(used to refer to a record in sql dbs))
- button FillTable (used to execute the query and fille the table with sql data
for example (Customer adress, name and id)
- button modify (used to read a record. opens our second window)
- button close (close the window)
Second window
--------------
Purpose:
-Fills an editable table with the selected customers ivoices.(user must be enabled to edit his invoice information by just double clicking a cell and typing to be added info)
-Save button that modifies the sql file data according to the changes in the table
Contains:
-Table(filled with the Customers "INVOICES", Table must be "EDITABLE" to enable the user to modify the table data)
-Button "SAVE" (to confirm the changes, modify the sql file)
Issue
------
The first window works but i have a problem with the funcionality in window 2
I'm just a student so sorry for the details .
Here is a fiew pieces of code i have tried but dont seem to work.
My Code
-------
Window 1
----------
Global Decl...
---------------
PROCEDURE WIN_Currency(par_CurID is int = 0, par_knop is string = "Modify")
i is int
IF par_CurID >0 THEN
HReadSeekFirst(filerelation,FileCompanyID,par_CurID)
IF HFound(filerelation) THEN
EDT_ID = filerelation.FileCompanyID
EDT_Name = filerelation.Name
EDT_Address = filerelation.Address
ELSE
Error("HFCS error: " + HError())
END
IF par_CurID=0 THEN
query_invoice.Param_invoice = Null
ELSE
query_invoice.Param_invoice = par_CurID
END
TableDeleteAll(Table_Invoice)
IF HExecuteQuery(query_invoice) = False THEN
Error("Query kan niet uitgevoerd worden")
ELSE
HReadFirst(query_invoice)
WHILE NOT HOut(query_invoice)
i=TableAddLine(Table_Invoice)
Table_Invoice.ID
=
query_invoice.FileCustomerInvoiceID
Table_Invoice.Name=query_invoice.Name
Table_Invoice.Total_EUR=query_invoice.Total_eur
HReadNext(query_invoice)
END
END
END
Button Modify
-------------
i = TableSelect(Table_Invoice)
IF i>0 THEN
par_CurID=Table_Invoice.ID
OpenSister(WIN_InvoiceDetail,par_CurID,"Modify")
ELSE
Error("HFCS error: " + HError())
END
Button Close
-------------
Close(WIN_CUSTOMERS)
Code Window 2
---------------
Global Decl
--------------
PROCEDURE WIN_Currency(par_CurID is int = 0, par_knop is string = "Modify")
i is int
IF par_CurID=0 THEN
query_invoicedetail.Par_Input = Null
ELSE
query_invoicedetail.Par_Input = par_CurID
END
TableDeleteAll(Table_InvoiiceDetail)
IF HExecuteQuery(query_invoicedetail) = False THEN
Error("Query kan niet uitgevoerd worden")
ELSE
HReadFirst(query_invoicedetail)
WHILE NOT HOut(query_invoicedetail)
i=TableAddLine(Table_InvoiiceDetail)
Table_InvoiiceDetail.ID = query_invoicedetail.FileCustomerInvoiceDetailID
Table_InvoiiceDetail.Description=query_invoicedetail.Description
Table_InvoiiceDetail.Price_P=query_invoicedetail.Price
Table_InvoiiceDetail.Quantity=query_invoicedetail.Quantity
Table_InvoiiceDetail.Total_EUR=query_invoicedetail.Total
HReadNext(query_invoicedetail)
END
IF par_CurID >0 THEN
HReadSeekFirst(filecustomerinvoicedetail,FileCustomerInvoiceDetailID,par_CurID)
IF HFound(filecustomerinvoicedetail) THEN
filecustomerinvoicedetail.FileCustomerInvoiceDetailID = Table_InvoiiceDetail.ID
filecustomerinvoicedetail.Description = Table_InvoiiceDetail.Description
filecustomerinvoicedetail.Price = Table_InvoiiceDetail.Price_P
filecustomerinvoicedetail.Quantity = Table_InvoiiceDetail.Quantity
filecustomerinvoicedetail.Total_eur = Table_InvoiiceDetail.Total_EUR
ELSE
IF HModify(filecustomerinvoicedetail) = False THEN
Error("HFCS error: " + HError())
END
END
END
IF par_knop = "Delete" THEN
BTN_Save..Caption = "Delete"
END
END
Button Save
-----------
IF par_knop = "Modify" THEN
filerelation.ChangedBy = "KEVIN"
filecustomerinvoicedetail.Description = Table_InvoiiceDetail.Description
filecustomerinvoicedetail.Price = Table_InvoiiceDetail.Price_P
filecustomerinvoicedetail.Quantity = Table_InvoiiceDetail.Quantity
filecustomerinvoicedetail.Total_eur = Table_InvoiiceDetail.Total_EUR
filecustomerinvoicedetail.LastChanged = DateSys() + TimeSys()
IF HModify(filerelation) = False THEN
Error("HFCS error" + HError())
END
END
This is as detailed as i can put it
my second windows code seems to not work. particularly the saving
does someone know how to do this
My question again:
-------------------
Save button doesn't save the data edited in the table (neitherin the table nor in the sql file)
thank you verry much
Chevin