8/01/2012

Changing Label Colors (ZP SQL & ZP 32)

I have written before about how to use a script to change the text assigned to a field label. Today I had a customer ask if you could also change the color of the label to make it stand out. In this example I'm selecting "Base" as the Module, "Property" as the Screen, and "Screen" as the Action and my script is:


propscreen.zp_pageframe1.page1.lblExist_use.Caption = "Warning"
propscreen.zp_pageframe1.page1.lblExist_use.Forecolor = RGB(255,0,0)

The first line changes the label for the Existing Use field on the Property Screen to "Warning." The second line makes that label red. To change the color of a field you enter in three Red/Green/Blue values from 0 to 255. Different values produce the rainbow of colors. You can use a number of web sites to learn the RGB values for any color you desire.

3/15/2012

Forcing Final Date Fill Ins (ZP SQL)

A customer recently asked if there was a way to force the filling in of the Final Date field after a "FINAL" inspection was completed in the Building Inspection Details Screen. This script does just that assuming you have an inspection type called "FINAL" and that your result value is "APPROVED."  If those conditions are met and the Final Date field is empty in the Building Screen, the script will fill in today's date and put you in Edit Mode in the Building Screen after you exit the Inspection Details Screen. This script uses "Building" for the Module, "Buildinsp" for the Screen, and "Save" for the Action:

if detail1.detail = "FINAL" and detail1.iresult = "APPROVED" and ISNULL(build1.occ_date)
= messagebox("Be sure to check Final Date in Building Screen",64,"Alert")
CURSORSETPROP('Buffering',4,'build1')
replace build1.occ_date with date()
buildscreen.isediting = .T.
endif

1/09/2012

Auto Increment Permit Numbers By Ten (ZP 32 & ZP SQL)

I had a customer ask if there was a way to have the auto numbering feature for permits increment by 10 instead of just one. You can do this by adding a script to the "Add" function of any screen. This script uses "Building" as the Module, "Building" as the Screen, and "Add" as the Action. The script is:

newcert = left(cert, len(trim(cert))-4) +padl(alltrim(str(val(right(trim(cert),4))+9)),4,"0")
replace cert with newcert

This script add an extra 9 to the auto generated new permit number to make it increment by a total of ten. This script will work for any of the permit screens in either ZP 32 or ZP SQL.

5/19/2011

Set New Defaults for Max Rows in Reports (ZP SQL)

A customer asked me today if there was a way to set a new default value for the Max Rows field on report screens. The Max Rows value determines the maximum number of records pulled by a SQL query when running a report. It defaults to 100 records which is sufficient for most reports but in their case was not enough for the Building Combo Reports screen. This script sets the value to zero for that screen which removes the restriction on the number of rows a query can pull. The script uses "Building" for the Module, "BldCombo" for the Screen, and "Screen" for the Action.

 rep_combo.max_rows.value = 0

4/13/2011

Forcing Pick Box Use (ZP 32 & ZP SQL)

I recently had a customer ask if there is a way to force users to fill in fields using the Pick Box feature. One way to do this is to disable the field for direct editing by making the field read only. You can do this for selected fields in the screen scripts. The example below makes the Existing Use field read only so the only way it can be filled in is by using the Pick Box option. The script uses "Base" for the Module, "Property" for the Screen, and "Screen" for the Action.

propscreen.zp_pageframe1.page1.txtExist_use.readonly = .T.

You can add as many fields to the same script as needed.

3/23/2011

Archiving Previous Owners (ZP 32)

A ZP 32 customer has requested a script to log owner names if they change. She wants to add the old owner's name to the Notes field along with the date the change was made. The script uses "Base" for the Module, "Property" for the Screen, and "Save" for the Action.

if own_fname <> oldval("own_fname") or own_lname <> oldval("own_lname")
oldname = alltrim(trim(oldval("own_fname"))+" "+oldval("own_lname"))
replace notes2 with notes2 + "Old Owner: " + oldname + "  " +dtoc(date())
endif

NOTES
- This script is very sparse but it could be fleshed out easily to copy additional info such as the old owner's address (own_addr1 and own_addr2)
- This script can be easily modified to do the same thing for old occupants simply by changing each "own_" in the script to "occ_".

3/17/2011

Cover Photo for Windows Interface (ZP 32 or ZP SQL)

A while back I added a feature for ZP SQL customers where they could easily attach a "cover" photo to any property that would be viewed as part of the Staff web site when that property was viewed. Working with a customer today I explained that that same concept could be brought to the Windows interface for either ZP 32 or ZP SQL. The basic idea is that you have one photo you consider to be the main photo for a given property. I'm calling this photo the cover shot. You can store and display that photo easily in ZonePro using a script. This technique does not even require the Photo Module. Basically you just pick a location to store all such photos. A place on the server is best in a networked environment. Then you save the photos using an agreed upon naming scheme. For this script I am naming the photos after the property ID. Now I can easily create a generic script that will check my folder for the existence of such a photo for any given property and launch my default photo viewer for Windows. I added this script to the left-click action of the Script button on the Property Screen so the setup is "Base" for the Module, "Property" for the Screen and "Left" for the Action:

myfile = [c:\photo\]+property.prop_id + [.jpg]
if file(myfile)
shellexecute(0,"open",myfile,"","",1)
else
wait window "Cannot Find Photo " + myfile nowait
endif