<% =SYS(3101,1252) olddate=SET("Date") oldmark=SET("Mark") SET DATe YMD SET MARK TO [-] SET CENTURY ON ajaxresponse=CREATEOBJECT('empty') oJSON=NEWOBJECT('json','json.prg') fref=ALLTRIM(TRANSFORM(NVL(orequest.form('txtreffid'),''))) theaction=orequest.form('taction') thevoucher=orequest.form('vouchertype') set procedure to (addbs(oprop.appstartpath)+'prg\navigate_transactions.prg') additive do CASE case thevoucher='Receipt' navigate_receipt(theaction, theaction, fref) case thevoucher='CashSale' navigate_receipt(theaction, theaction, fref) DO case CASE theaction='num' SELECT x.transid, x.customer, y.name as customer_name, x.depositid, z.name as depositid_name, ; x.name, x.amount, x.saleman, a.name as saleman_name, x.date, x.checkno, x.chkdate ; FROM (dbclocation+[payment]) x ; INNER JOIN (dbclocation+[accounts]) y ON(x.customer=y.accountid) ; INNER JOIN (dbclocation+[accounts]) z ON(x.depositid=z.accountid) ; left JOIN (dbclocation+[accounts]) a ON(x.saleman=a.accountid) ; WHERE ALLTRIM(transid)==fref INTO CURSOR SearchResults readwrite CASE theaction='back' SELECT TOP 1 VAL(transid) as vtr, x.transid, x.customer, y.name as customer_name, x.depositid, z.name as depositid_name, ; x.name, x.amount, x.saleman, a.name as saleman_name, x.date, x.checkno, x.chkdate ; FROM (dbclocation+[payment]) x ; INNER JOIN (dbclocation+[accounts]) y ON(x.customer=y.accountid) ; INNER JOIN (dbclocation+[accounts]) z ON(x.depositid=z.accountid) ; left JOIN (dbclocation+[accounts]) a ON(x.saleman=a.accountid) ; WHERE VAL(TRANSFORM(ALLTRIM(transid)))VAL(fref) ; ORDER BY vtr, transid INTO CURSOR SearchResults readwrite CASE theaction='edit' OTHERWISE SELECT TOP 1 VAL(transid) as vtr, x.transid, x.customer, y.name as customer_name, x.depositid, z.name as depositid_name, ; x.name, x.amount, x.saleman, a.name as saleman_name, x.date, x.checkno, x.chkdate ; FROM (dbclocation+[payment]) x ; INNER JOIN (dbclocation+[accounts]) y ON(x.customer=y.accountid) ; INNER JOIN (dbclocation+[accounts]) z ON(x.depositid=z.accountid) ; left JOIN (dbclocation+[accounts]) a ON(x.saleman=a.accountid) ; WHERE VAL(TRANSFORM(ALLTRIM(transid)))>VAL(fref) ; ORDER BY vtr desc, transid desc INTO CURSOR SearchResults readwrite ENDCASE openingbalance=[] if BETWEEN(val(left(SearchResults.customer,2)),1,8) select sum(debit-credit) as dayopening from (dbclocation+[acctran]) where accountid=SearchResults.customer and date0 ojson.keyforcursors='TheDetails' fdets=oJSON.stringify('TheDetails') returnstring=oJSON.AddJSONProps(freffs,fdets) ELSE returnstring=freffs endif returnstring=oJSON.AddJSONProps(ojson.stringify(ajaxresponse),returnstring) oResponse.Write(returnstring) oresponse.flush SET DATE &olddate SET MARK TO &oldmark CLOSE TABLES CLOSE DATABASES %>