I have a code which summarizes aging of receivables, it is working very very very fast on 3 records, I thought it is fine and proceded to demonstrate the power of alpha five to a potential client, when i demonstrated the application, the client is amazed and agreed to but the app, after a few days, the client is withdrawing the contract because it took forever for the code to display the aging of receivables with just 20 records. the code goes this way, it is working fine, no errors, It was a slap to my face when the client decided not to continue to buy the app.the code goes this way:
option strict
dim invoice as p
dim aged as p
dim age as n
dim inv_date as d
dim query.order as c
dim query.description as c
dim query.options as c
dim query.filter as c
aged = table.open("aged_inv",FILE_RW_EXCLUSIVE)
aged.zap(.t.)
aged.close()
aged = table.open("aged_inv",FILE_RW_SHARED)
invoice = table.open("invoiceflow",FILE_RO_SHARED)
query.description="Balances greater than 0"
query.order=""
query.options=""
query.filter="Inv_Bal > 0.01"
invoice.query_create()
invoice.fetch_first()
while .not. invoice.fetch_eof()
aged.enter_begin()
age = date() - invoice.due_date
select
case age >=90
aged.ninety = invoice.inv_bal
case age >=60
aged.sixty = invoice.inv_bal
case age >=30
aged.thirty = invoice.inv_bal
case else
aged.current = invoice.inv_bal
end select
aged.inv_no = invoice.refnum
aged.custid = invoice.custid
aged.due_date=invoice.due_date
aged.enter_end(.t.)
invoice.fetch_next()
end while
invoice.close()
aged.close()
preview_report("aging_report")
end
option strict
dim invoice as p
dim aged as p
dim age as n
dim inv_date as d
dim query.order as c
dim query.description as c
dim query.options as c
dim query.filter as c
aged = table.open("aged_inv",FILE_RW_EXCLUSIVE)
aged.zap(.t.)
aged.close()
aged = table.open("aged_inv",FILE_RW_SHARED)
invoice = table.open("invoiceflow",FILE_RO_SHARED)
query.description="Balances greater than 0"
query.order=""
query.options=""
query.filter="Inv_Bal > 0.01"
invoice.query_create()
invoice.fetch_first()
while .not. invoice.fetch_eof()
aged.enter_begin()
age = date() - invoice.due_date
select
case age >=90
aged.ninety = invoice.inv_bal
case age >=60
aged.sixty = invoice.inv_bal
case age >=30
aged.thirty = invoice.inv_bal
case else
aged.current = invoice.inv_bal
end select
aged.inv_no = invoice.refnum
aged.custid = invoice.custid
aged.due_date=invoice.due_date
aged.enter_end(.t.)
invoice.fetch_next()
end while
invoice.close()
aged.close()
preview_report("aging_report")
end
Comment