From e375afbde02e6659ecf21fd8c3910a4af78f4be0 Mon Sep 17 00:00:00 2001 From: nik gaffney Date: Fri, 27 Aug 2021 15:15:23 +0200 Subject: [PATCH] Art all the way down? --- f20-budget.config.pl | 36 +++++++++++++++++++++++++++ f20-budget.pl | 58 +++++++------------------------------------- 2 files changed, 45 insertions(+), 49 deletions(-) create mode 100644 f20-budget.config.pl diff --git a/f20-budget.config.pl b/f20-budget.config.pl new file mode 100644 index 0000000..b9781dc --- /dev/null +++ b/f20-budget.config.pl @@ -0,0 +1,36 @@ +#!/usr/bin/perl + +############################################################################## +# # +# configuration options for f20-budget.pl # +# # +############################################################################## + +## project +$projectname='f20 budget'; +$script_name='f20-budget.pl'; +$currency='€'; + +## server +$website_url='https://be.fo.am'; +$feral_logo="https://www.feraltrade.org/budget/feral_pigeon.jpg"; + +## database connection +$db_conect="DBI:mysql:feralbudget"; +$db_user="feraltrade"; +$db_pass="********"; + +## css options +$css_screen_url="/css/styles.css"; +$css_print_url="/css/print.css"; + +## possibly unused +# $logo_url="$website_url/budget/logo/"; +# $logo_path='/home/feraltrade/htdocs/budget/logo/'; +# $arrow="$website_url/im6/arrow.jpg"; + +# $locations_script_name='./locations.pl'; +# $agents_script_name='./agents/agents.pl'; + +# $locations_image_url="$website_url/locn_image/thumb/"; +# $locations_image_path='/home/feraltrade/htdocs/budget/locn_image/thumb/'; diff --git a/f20-budget.pl b/f20-budget.pl index 88ba266..d3de811 100644 --- a/f20-budget.pl +++ b/f20-budget.pl @@ -8,38 +8,11 @@ no warnings qw(experimental::smartmatch); ############################################################################## # # -# configuration # +# configuration details are kept in a separate file # # # ############################################################################## -## project -$projectname='f20 budget'; -$script_name='f20-budget.pl'; -$currency='€'; - -## server -$website_url='https://be.fo.am'; -$feral_logo="https://www.feraltrade.org/budget/feral_pigeon.jpg"; - -## database connection -$db_conect="DBI:mysql:feralbudget"; -$db_user="feraltrade"; -$db_pass="********"; - -## css options -$css_screen_url="/css/styles.css"; -$css_print_url="/css/print.css"; - -## possibly unused -# $logo_url="$website_url/budget/logo/"; -# $logo_path='/home/feraltrade/htdocs/budget/logo/'; -# $arrow="$website_url/im6/arrow.jpg"; - -# $locations_script_name='./locations.pl'; -# $agents_script_name='./agents/agents.pl'; - -# $locations_image_url="$website_url/locn_image/thumb/"; -# $locations_image_path='/home/feraltrade/htdocs/budget/locn_image/thumb/'; +do "f20-budget.config.pl"; ############################################################################## # # @@ -492,23 +465,6 @@ END sub input_budget { - #for ($i=1; $i<=8; $i++) { - # if (('$type{$i}' eq 'select category') && ('$new_item{$i}' ne '')) { - - # print(qq(
)); - # print(qq()); - # print(qq()); - # print(qq()); - # print(qq()); - # print(qq()); - # print(qq()); - # print(qq()); - # print(qq()); - # print(qq()); - # print(qq()); - - #} else { - my $dbh = DBI->connect($db_conect,$db_user,$db_pass) or die ("can't connect: $DBI::errstr"); @@ -532,7 +488,6 @@ sub input_budget { } } - ## read in finance for agent my $sql = qq( SELECT * from finance LEFT JOIN agents ON finance.agent_id=agents.id @@ -771,7 +726,13 @@ sub compile_budget { my $sthr = $dbh->prepare($sqlr); $sthr->execute; - my $sqlef = qq( SELECT budget_id, item, cost, currency, type FROM expenditure LEFT JOIN budgets on expenditure.budget_id=budgets.id WHERE expenditure.budget_id = '$budget_id' AND type='fee' ORDER BY expenditure.item); + my $sqlef = qq( + SELECT budget_id, item, cost, currency, type + FROM expenditure + LEFT JOIN budgets on expenditure.budget_id=budgets.id + WHERE expenditure.budget_id = '$budget_id' + AND type='fee' + ORDER BY expenditure.item); my $sthef = $dbh->prepare($sqlef); $sthef->execute; @@ -1006,7 +967,6 @@ END } - ############################################################################ # prepare expenditure