set console off #DEFINE CR CHR(13) #DEFINE YR "08-09" public nFixes, iindex, iindex2, cbackup, cpath, cPathCopy, cCommand, cHelp public ncounter, ncounter2, ctable, cfield, cfield2, ctarget, cNewCompanyName text to cHelp This utility allows you to quickly backup your Visipay Company database and rename it for archive purposes. Please ensure everyone is logged out of Visipay before continuing. Do you want to continue? endtext cResult = messagebox(cHelp,4,"Axsapt Visipay Backup Utility") if cResult = 7 && No return endif cpath = getdir() If empty(cpath) messagebox("No changes made", 0, "Axsapt") return endif cPath = alltrim(cPath) cPathCopy = left(cPath, len(cPath) - 1)+"-"+ YR + "\" *messagebox(cPathCopy,0,"Debug") *return cd "&cpath" if not file("vpsystem.dbf") messagebox(cPath + CR + "is not a valid Visipay directory.",0,"Invalid Directory Selected") return endif * Execute directory Copy cCommand = [XCopy "&cPath*.*" "&cPathCopy" /e ] *messagebox(cCommand) run &cCommand *wait *use vpsystem *cbackup = cpath+"vpsystem"+Alltrim(str(year(date())))+Alltrim(str(month(date())))+Alltrim(str(day(date()))) *set safety off *copy to "&cbackup" *set safety on *use cd "&cPathCopy" use vpsystem *if not file("&cbackup"+".DBF") * messagebox("WARNING!" + CR + "A complete backup of VPsystem.dbf was NOT successful"+ CR +"Processing Aborted", 0, "Axsapt - ERROR") * return *endif go top cField = vpsystem.uniqueid cField2 = vpsystem.company cNewCompanyName = left(trim(cField2),29) + " " + YR *alltrim(str(year(lastdate) - 1)) + "/" + alltrim(str(year(lastdate))) cTarget = left(cField,9) + chr(asc(substr(cField,10,1)) + 1) *messagebox(cField,"Original UniqueId") *messagebox(cTarget,"Amended UniqueId") select vpsystem replace uniqueid with cTarget replace Company with cNewCompanyName use cHelp = [You should now run Visipay, log in and "Find Company" the following] + CR cHelp = cHelp + [company folder to add it to the list of Companies in Visipay:] + CR + cPathCopy Messagebox(cHelp, 0, "Axsapt")