1st - you should have redacted the patient names - that is a HIPPA 
(read that as a FEDERAL issue) problem, and you should pull this 
document - NOW!!

2nd - The second page illegible

making assumption:
- all the primary data is in one table ([dispensations])
- using print form (I would think about using print selection but I'm 
not sure about the break between out and return)

(not real code, written in email)
set query destination(into set;"dispensed")
query([dispensations];[dispensations] dispensation_date >=$Start_Date;*)
query([dispensations];&;[dispensations] dispensation_date <=$End_Date;*)
query([dispensations];&;[dispensations] Is_Return = false)

set query destination(into set;"Returns")
query([dispensations];[dispensations] dispensation_date >=$Start_Date;*)
query([dispensations];&;[dispensations] dispensation_date <=$End_Date;*)
query([dispensations];&;[dispensations] Is_Return = true)

$header :=100    //guesses as to size
$detail := 20
$break := 50
$Totals := 150
$Page_Number := 20
Max_Page_Size := 740
$Printed:=0
$Printing_Completed := false
$Printing_Dispensed:=true

For($i;1;records in set("Returns")+records in set("dispensed"))

  if ($Printed = 0)  //top of page
    print form(header)
    $printed := 150
  end if

 if( Printing_Dispensed)
   use set("dispensed")
   $Detail_Name:="Dispensed_Detail"
   $Set_Name:="dispensed"
 else
   use set("Returns")
   $Detail_Name:="Return_Detail"
   $Set_Name:="Returns"
 end if

  if (($printed+$detail+$Page_Number)<$Max_Page_Size)
    Print form($Detail_Name)
    $Printed:=$Printed+$Detail
    Next record([dispensations])

    if (end selection([dispensations])
      $Set_Name:="Returns"
    else
      create set([dispensations];$Set_Name)
    end if
  else  //not enough room
    Print form("Page_footer")
    $i:=$i-1
    $Printed:=0
  end if
end for

if ($printed+$Totals+$Page_numbers)>$Max_Printed)
  print form("Header")
end if
print form ("Totals")
print form("page_Footer")


On Fri, 30 Jun 2017 12:54:48 -0500, Robert ListMail via 4D_Tech wrote:
> I was tasked with creating this report in 4D where I chose to use 
> Print Form…. Since it took me an embarrassingly long time to create 
> this and since it could be done from scratch in Excel in 20 minutes… 
> I wanted to hear from the smarter 4D Developers at large.  So, how 
> would you build a report like this in 4D? Also, how much time might 
> you budget or estimate…?
> 
> https://www.dropbox.com/s/c0kgzg9uwed840i/2017_06_27_16_52_46_OCR.pdf?dl=0
> 
> Thanks,
> 
> Robert
> 
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to