diff --git a/css/styles.css b/css/styles.css index a32fcc3..7ef8335 100644 --- a/css/styles.css +++ b/css/styles.css @@ -1,12 +1,17 @@ /* Document Layout */ body { - line-height: 1.2; + line-height: 1.1em; font-family: sans-serif; - font-size: 1.5em + font-size: 1.0em; background: "#ffffff"; } +p { + padding: 0em; + margin: 0em; +} + .container { display: flex; flex-direction: row; @@ -87,7 +92,6 @@ body { .budget-subtotal { font-family: monospace; font-size: 1.2em; - display: table-row; } .subtotal-name { @@ -95,15 +99,17 @@ body { font-size: 1.1em; padding-top: 0.5em; padding-bottom: 0.1em; - display: table-cell; + display: inline-block; + width: 60%; } .subtotal-amount { font-family: sans-serif; font-size: 1.1em; font-weight: bold; - padding-left: 20px; - display: table-cell; + text-align: right; + display: inline-block; + width: 35%; } @@ -112,22 +118,26 @@ body { .budget-item { font-family: monospace; font-size: 0.9em; - display: table-row; + padding-top: 0em; + padding-bottom: 0em; } .item-name { font-family: serif; font-size: 0.9em; - padding-top: 0.1em; - padding-bottom: 0.1em; - display: table-cell; + padding-top: 0em; + padding-bottom: 0em; + display: inline-block; + width: 60%; } .item-amount { font-family: sans-serif; font-size: 0.9em; font-weight: bold; - padding-left: 20px; text-align: right; - display: table-cell; + padding-top: 0em; + padding-bottom: 0em; + display: inline-block; + width: 35%; } diff --git a/f20-budget.pl b/f20-budget.pl index 0024076..bead06d 100644 --- a/f20-budget.pl +++ b/f20-budget.pl @@ -73,45 +73,27 @@ $new_amount = sprintf "%.2f",$new_amount; ## 2 decimal places $new_url=$q->param("new_url"); #$new_url=~ s/http\:\/\///g; # don't remove http:// -$new_item = $q->param("new_item"); -$new_item =~ s/\'/\'\'/g; -$new_item =~ s/\x92/’/g; -$new_labour = $q->param("new_labour"); -$new_labour =~ s/\'/\'\'/g; -$new_labour =~ s/\x92/’/g; -$new_resource = $q->param("new_resource"); -$new_resource =~ s/\'/\'\'/g; -$new_resource =~ s/\x92/’/g; -$new_status = $q->param("new_status"); -$new_lstatus = $q->param("new_lstatus"); -$new_rstatus = $q->param("new_rstatus"); -$type = $q->param("type"); +$new_item = sanitise($q->param("new_item")); +$new_labour = sanitise($q->param("new_labour")); +$new_resource = sanitise($q->param("new_resource")); +$new_status = sanitise($q->param("new_status")); +$new_lstatus = sanitise($q->param("new_lstatus")); +$new_rstatus = sanitise($q->param("new_rstatus")); +$type = sanitise($q->param("type")); for ( $i=0; $i<=50; $i+=1) { - $new_status{$i} = $q->param("new_status$i"); - $type{$i} = $q->param("type$i"); - $new_item{$i} = $q->param("new_item$i"); - $new_item{$i} =~ s/\'/\'\'/g; - $new_item{$i} =~ s/\x92/’/g; - $new_resource{$i} = $q->param("new_resource$i"); - $new_resource{$i} =~ s/\'/\'\'/g; - $new_resource{$i} =~ s/\x92/’/g; - $new_labour{$i} = $q->param("new_labour$i"); - $new_labour{$i} =~ s/\'/\'\'/g; - $new_labour{$i} =~ s/\x92/’/g; - $new_status{$i} = $q->param("new_status$i"); - $new_lstatus{$i} = $q->param("new_lstatus$i"); - $new_rstatus{$i} = $q->param("new_rstatus$i"); + $new_status{$i} = sanitise($q->param("new_status$i")); + $type{$i} = sanitise($q->param("type$i")); + $new_item{$i} = sanitise($q->param("new_item$i")); + $new_resource{$i} = sanitise($q->param("new_resource$i")); + $new_labour{$i} = sanitise($q->param("new_labour$i")); + $new_status{$i} = sanitise($q->param("new_status$i")); + $new_lstatus{$i} = sanitise($q->param("new_lstatus$i")); + $new_rstatus{$i} = sanitise($q->param("new_rstatus$i")); - $new_firstname{$i} = $q->param("new_firstname$i"); - $new_firstname{$i} =~ s/\'/\'\'/g; - $new_firstname{$i} =~ s/\x92/’/g; - $new_lastname{$i} = $q->param("new_lastname$i"); - $new_lastname{$i} =~ s/\'/\'\'/g; - $new_lastname{$i} =~ s/\x92/’/g; - $new_codename{$i} = $q->param("new_codename$i"); - $new_codename{$i} =~ s/\'/\'\'/g; - $new_codename{$i} =~ s/\x92/’/g; + $new_firstname{$i} = sanitise($q->param("new_firstname$i")); + $new_lastname{$i} = sanitise($q->param("new_lastname$i")); + $new_codename{$i} = sanitise($q->param("new_codename$i")); $cost{$i}=~ s/\€/@euro/g; $cost{$i} = $q->param("cost$i"); @@ -183,10 +165,11 @@ given ($action) { } exit; -# saniti[sz]e sql inputs as needed +# saniti[sz]e parameters and sql inputs as needed sub sanitise { my $string = shift; - $string =~ s/\'/\'\'/g; + $string =~ s/\'/\'\'/g; # convert ' to '' + $string =~ s/\x92/’/g; # convert "RIGHT SINGLE QUOTATION MARK" to html return $string; } @@ -810,8 +793,10 @@ sub compile_budget { $sthb->execute; my $recordb = $sthb->fetchrow_hashref; + # page header &print_header; + # budget header print <
@@ -837,8 +822,8 @@ END
END + # CGI parameter forms $sthr->execute; - while (my $recordr = $sthr->fetchrow_hashref) { print< @@ -873,13 +858,16 @@ END END } + # budget columns print <
-
FINANCIAL
-
OUTGOINGS: / money requested or supplied
END + print_title("FINANCIAL"); + + print_subtitle("OUTGOINGS: / money requested or supplied"); + print_subtitle("Labour / paid"); while (my $recordef = $sthef->fetchrow_hashref) { @@ -913,7 +901,7 @@ END print_item("$recordex->{item}", ">$recordex->{currency}$display_cost"); } - print_subtotal("INCOME: / donations, contributions, sums, funds"); + print_subtitle("INCOME: / donations, contributions, sums, funds"); while (my $recordf = $sthf->fetchrow_hashref) { print_item("", sprintf("€%.2f", $recordf->{amount})); @@ -947,9 +935,10 @@ END print <
)); - $dbh->disconnect; + print(qq()); &print_footer; } # capitalise the initials of a name from a record + sub get_initials { $record = shift; my $first=$record->{firstname} ; @@ -1014,6 +997,7 @@ sub get_initials { return "$first_init$last_init" } + ############################################################################ # prepare expenditure @@ -1916,16 +1900,25 @@ sub select_start_date { ############################################################################## +## print a title + +sub print_title { + my $string = shift; + print <$string +END +} + ## print a subtitle sub print_subtitle { my $string = shift; print <$string

+
$string
END } -## print a budget subtotal +## print a budget subtotal line with a description and optional amount sub print_subtotal { my $string = shift; @@ -1939,7 +1932,7 @@ sub print_subtotal { END } -## print standard budget item +## print standard budget item with a description and optional amount sub print_item { my $string = shift; @@ -1974,7 +1967,7 @@ END } -## print the standard footer +## print a standard footer sub print_footer { print <