Quantcast
Channel: Home of ActiveVFP - Foxpro on the World Wide Web
Viewing all articles
Browse latest Browse all 1109

New Post: Struggling with Activevfp

$
0
0
(part 1)
  • customers.prg -Customers Controller
    • bypasses Main.prg and .AVFP script code
      *
      Define Class master2Controller As restController
      *
      Procedure openData
      _cursel = Select()
      _currec = Recno()
      Set Exclusive Off
      If !Used('master')
      Select 0
      Use (This.homeFolder + "towmast.dbf") Alias Master
      Set Order To dispstring
      Endif
      If !Used('invoice')
      Select 0
      Use (This.homeFolder + "towinv.dbf") Alias invoice
      Set Order To dispinv
      Endif
      If !Used('drivetran')
      Select 0
      Use (This.homeFolder + "towdrive.dbf") Alias drivetran
      Set Order To dispdrvinv
      Endif
      If !Used('trans')
      Select 0
      Use (This.homeFolder + "towtrans.dbf") Alias Trans
      Set Order To dispdrvinv
      Endif
      Select (_cursel)
      Go (_currec)
    Endproc

    Procedure infoAction
    Return "homeFolder: <b>" + This.homeFolder + "</b>"
    Endproc
*** WHERE Towmast.dispnum = ( 200001 ) ;
Procedure getAction
Local c_dispnum
c_dispnum = This.Params[1]

Set Path To oProp.AppStartPath+'prg\rest\controllers'
*** THIS.openData()
Set Procedure To snippet1 ADDITIVE 

oJSON=Newobject('json','json.prg')

Do Case
Case Len(c_dispnum) = 6

    Select Allt(Str(towmast.dispnum)) As dispnum, Dtoc(towmast.towdate) As towdate,;
        towmast.yearcar, towmast.makecar, towmast.modelcar, towmast.colorcar,;
        towmast.calltype, Dtoc(towmast.datein) As datein, Dtoc(towmast.dateout) As dateout,;
        towmast.callactnum, towmast.refnumber, towmast.callname,;
        towmast.licensest, towmast.licensenum, towmast.callphone,;
        allt(Str(towmast.days)) As days, towmast.storagetype, towmast.whocalled,;
        allt(Str(towmast.perday)) As perday, Allt(Str(towmast.perdaytotal)) As perdaytotal, towmast.vin,;
        towmast.Type, towmast.tagmonthyear, towmast.bodytype, towmast.towedfrom,;
        towmast.towedto, towmast.retowto, towmast.cross_street, towmast.Odometer,;
        towmast.membernum, Dtoc(towmast.liendout) As liendout, Dtoc(towmast.liendin) As liendin, towmast.lientype,;
        towmast.lientypems, Allt(Str(towmast.lienfee)) As lienfee, towmast.releaselic,;
        towmast.condition, towmast.keysinfo, towmast.holdnote,;
        towmast.callremark1, towmast.aaacallnum, towmast.priority,;
        towmast.equipment, towmast.regnametow, towmast.regname, towmast.regaddr1,;
        towmast.regaddr2, towmast.regaddr3, towmast.regcity, towmast.regstate,;
        towmast.regzip, towmast.ReleaseType, towmast.foxtow_id, towmast.mapcord,;
        towmast.area, towmast.ftiresize, towmast.rtiresize, towmast.wposition, towmast.reason,towmast.lotsection,;
        towmast.callremark,Towdrive.invoicenum, Towdrive.Driver, Towdrive.towtagnum,;
        Towtrans.Description As description1,Towtrans.Description As description2,;
        Towtrans.Description As description3,Towtrans.Description As description4,;
        ALLTRIM(Str(Towtrans.quantity)) As quantity1,Alltrim(Str(Towtrans.quantity)) As quantity2,;
        ALLTRIM(Str(Towtrans.quantity)) As quantity3,Alltrim(Str(Towtrans.quantity)) As quantity4,;
        ALLTRIM(Str(Towtrans.price)) As price1,Alltrim(Str(Towtrans.price)) As price2,;
        ALLTRIM(Str(Towtrans.price)) As price3,Alltrim(Str(Towtrans.price)) As price4,;
        Towdrive.trucknum, Towdrive.timerec, Towdrive.timecall,;
        Towdrive.timeinrt, Towdrive.timearrive, Towdrive.timeintow,;
        Towdrive.timeardst, Towdrive.timeclear, Dtoc(Towinv.invdate) As invdate,;
        Towinv.itemgroup, Towinv.ponumber, Towinv.billtoact, Towinv.billtoname,;
        Towinv.billtoaddr1, Towinv.billtoaddr2, Towinv.billtocity,;
        Towinv.billtost, Towinv.billtozip, Towinv.billtophone, Towinv.billtocont,;
        Towinv.paytype, Dtoc(Towinv.release_date) As releasedate, Towinv.release_time,;
        ALLTRIM(Str(Towinv.Total)) As curtotal1, Alltrim(Str(Towinv.curbalance)) As curbalance1,;
        Towinv.release_bywho, Towinv.release_time2, Towinv.kitnum,;
        Towinv.oldinvnum, Towinv.aaamemtype, Allt(Str(Towinv.miles)) As miles,;
        allt(Str(Towinv.milesto)) As milesto, Dtoc(Received.datepaid) As datepaid, Received.custnum,;
        Received.callactnum As callactnum2, Received.paytype As paytype2, Allt(Str(Received.amount)) As amount,;
        Received.referencenum;
        FROM ;
        towbox!towmast ;
        INNER Join towbox!Towdrive ;
        ON  towmast.dispnum = Towdrive.dispnumdrv ;
        INNER Join towbox!Received ;
        ON  towmast.dispnum = Received.dispnum ;
        INNER Join towbox!Towtrans ;
        ON  towmast.dispnum = Towtrans.dispnumtrs ;
        INNER Join towbox!Towinv ;
        ON  towmast.dispnum = Towinv.dispnum;
        WHERE  Alltrim(Str(towmast.dispnum)) = c_dispnum;
        INTO Cursor searchresults Readwrite

Case Len(c_dispnum) = 4
    Select Top 1 Allt(Str(towmast.dispnum)) As dispnum, Dtoc(towmast.towdate) As towdate,;
        towmast.yearcar, towmast.makecar, towmast.modelcar, towmast.colorcar,;
        towmast.calltype, Dtoc(towmast.datein) As datein, Dtoc(towmast.dateout) As dateout,;
        towmast.callactnum, towmast.refnumber, towmast.callname,;
        towmast.licensest, towmast.licensenum, towmast.callphone,;
        allt(Str(towmast.days)) As days, towmast.storagetype, towmast.whocalled,;
        allt(Str(towmast.perday)) As perday, Allt(Str(towmast.perdaytotal)) As perdaytotal, towmast.vin,;
        towmast.Type, towmast.tagmonthyear, towmast.bodytype, towmast.towedfrom,;
        towmast.towedto, towmast.retowto, towmast.cross_street, towmast.Odometer,;
        towmast.membernum, Dtoc(towmast.liendout) As liendout, Dtoc(towmast.liendin) As liendin, towmast.lientype,;
        towmast.lientypems, Allt(Str(towmast.lienfee)) As lienfee, towmast.releaselic,;
        towmast.condition, towmast.keysinfo, towmast.holdnote,;
        towmast.callremark1, towmast.aaacallnum, towmast.priority,;
        Towtrans.Description As description1,;
        towmast.equipment, towmast.regnametow, towmast.regname, towmast.regaddr1,;
        towmast.regaddr2, towmast.regaddr3, towmast.regcity, towmast.regstate,;
        towmast.regzip, towmast.ReleaseType, towmast.foxtow_id, towmast.mapcord,;
        towmast.area, towmast.ftiresize, towmast.rtiresize, towmast.wposition, towmast.reason,towmast.lotsection,;
        towmast.callremark,Towdrive.invoicenum, Towdrive.Driver, Towdrive.towtagnum,;
        Towtrans.Description As description1,Towtrans.Description As description2,;
        Towtrans.Description As description3,Towtrans.Description As description4,;
        Towtrans.quantity As quantity1,Towtrans.quantity As quantity2,;
        Towtrans.quantity As quantity3,Towtrans.quantity As quantity4,;
        Towtrans.price As price1,Towtrans.price As price2,;
        Towtrans.price As price3,Towtrans.price As price4,;
        Towdrive.trucknum, Towdrive.timerec, Towdrive.timecall,;
        Towdrive.timeinrt, Towdrive.timearrive, Towdrive.timeintow,;
        Towdrive.timeardst, Towdrive.timeclear, Dtoc(Towinv.invdate) As invdate,;
        Towinv.itemgroup, Towinv.ponumber, Towinv.billtoact, Towinv.billtoname,;
        Towinv.billtoaddr1, Towinv.billtoaddr2, Towinv.billtocity,;
        Towinv.billtost, Towinv.billtozip, Towinv.billtophone, Towinv.billtocont,;
        Towinv.paytype, Dtoc(Towinv.release_date) As releasedate, Towinv.release_time,;
        ALLTRIM(Str(Towinv.Total)) As curbalance1,;
        Towinv.release_bywho, Towinv.release_time2, Towinv.kitnum,;
        Towinv.oldinvnum, Towinv.aaamemtype, Allt(Str(Towinv.miles)) As miles,;
        allt(Str(Towinv.milesto)) As milesto, Dtoc(Received.datepaid) As datepaid, Received.custnum,;
        Received.callactnum As callactnum2, Received.paytype As paytype2, Allt(Str(Received.amount)) As amount,;
        Received.referencenum;
        FROM ;
        towbox!towmast ;
        INNER Join towbox!Towdrive ;
        ON  towmast.dispnum = Towdrive.dispnumdrv ;
        INNER Join towbox!Received ;
        ON  towmast.dispnum = Received.dispnum ;
        INNER Join towbox!Towtrans ;
        ON  towmast.dispnum = Towtrans.dispnumtrs ;
        INNER Join towbox!Towinv ;
        ON  towmast.dispnum = Towinv.dispnum;
        WHERE  Right(towmast.vin,4) = c_dispnum;
        ORDER By towmast.dispnum Desc;
        INTO Cursor searchresults Readwrite

Endcase
Replace searchresults.curtotal1 With ''
Replace searchresults.curbalance1 With ''
Replace searchresults.perdaytotal With ''

Replace searchresults.description1 With ''
Replace searchresults.description2 With ''
Replace searchresults.description3 With ''
Replace searchresults.description4 With ''

Replace searchresults.price1 With ''
Replace searchresults.price2 With ''
Replace searchresults.price3 With ''
Replace searchresults.price4 With ''

Replace searchresults.quantity1 With ''
Replace searchresults.quantity2 With ''
Replace searchresults.quantity3 With ''
Replace searchresults.quantity4 With 

Viewing all articles
Browse latest Browse all 1109

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>