This begins with enquiring about open to whom and, vitally, by whom?
This commit is contained in:
parent
caa40a9be6
commit
a7b602af8c
1 changed files with 1194 additions and 1165 deletions
131
f20_budget.pl
131
f20_budget.pl
|
@ -12,7 +12,7 @@ no warnings qw(experimental::smartmatch);
|
|||
# #
|
||||
##############################################################################
|
||||
|
||||
do "./f20-budget.config.pl";
|
||||
do "./f20_budget_config.pl";
|
||||
|
||||
##############################################################################
|
||||
# #
|
||||
|
@ -76,9 +76,12 @@ $new_url=$q->param("new_url");
|
|||
$new_item = sanitise($q->param("new_item"));
|
||||
$new_labour = sanitise($q->param("new_labour"));
|
||||
$new_resource = sanitise($q->param("new_resource"));
|
||||
$insert_labour = sanitise($q->param("insert_labour"));
|
||||
$insert_resources = sanitise($q->param("insert_resources"));
|
||||
$new_status = sanitise($q->param("new_status"));
|
||||
$new_lstatus = sanitise($q->param("new_lstatus"));
|
||||
$new_rstatus = sanitise($q->param("new_rstatus"));
|
||||
$new_notes = sanitise($q->param("new_notes"));
|
||||
$type = sanitise($q->param("type"));
|
||||
|
||||
for ( $i=0; $i<=50; $i+=1) {
|
||||
|
@ -324,7 +327,7 @@ END
|
|||
print(qq(>$cat</option>));
|
||||
}
|
||||
print(qq(</select></td>));
|
||||
print(qq(<td colspan="3">item <input type="text" name="new_item$i" value="$record4->{item}" size="70" maxsize="100"></td></tr>));
|
||||
print(qq(<td colspan="3">item <input type="text" name="new_item$i" value="$record4->{item}" size="70" maxsize="120"></td></tr>));
|
||||
$i++
|
||||
}
|
||||
|
||||
|
@ -360,11 +363,12 @@ END
|
|||
print(qq( size="3" maxsize="5"></td></tr>\n));
|
||||
|
||||
|
||||
## resources section !!! read-in notworking !!!
|
||||
## resources section
|
||||
|
||||
print(qq(<tr><td colspan="8" height="20"> </td></tr>\n));
|
||||
print(qq(<tr><td colspan="1" class="medbig"><b>input labour</b></td><td colspan="8">things you commit to doing, non-remunerated. (check the box if this labour has already been deployed) </td></tr>));
|
||||
|
||||
|
||||
my $sql5 = qq( SELECT * from nonfinance where budget_id=$record->{id} AND agent_id =$record2->{id} AND kind='labour' );
|
||||
my $sth5 = $dbh->prepare($sql5);
|
||||
$sth5->execute;
|
||||
|
@ -378,19 +382,21 @@ END
|
|||
|
||||
for ($i=1;$i<=$t;$i++) {
|
||||
while (my $record5 = $sth5->fetchrow_hashref) {
|
||||
print(qq(<tr><td colspan="1"><b>$i.</b></td>\n));
|
||||
print(qq(<td><input type="checkbox" NAME="new_lstatus$i" VALUE="delivered"));
|
||||
if ($record5->{status} eq 'delivered') { print"CHECKED" };
|
||||
print(qq(></td>\n));
|
||||
print(qq(<td colspan="3"><input type="text" name="new_labour$i" value="$record5->{item}" size="100" maxsize="200"></td></tr>\n));
|
||||
print "<tr><td colspan=\"1\"><b>$i.</b></td>\n";
|
||||
print "<td><input type=\"checkbox\" NAME=\"new_lstatus$i\" VALUE=\"delivered\"";
|
||||
if ($record5->{status} eq 'delivered') { print "CHECKED"};
|
||||
print "></td>\n";
|
||||
print "<td colspan=\"3\"><input type=\"text\" name=\"new_labour$i\" value=\"$record5->{item}\" size=\"100\" maxsize=\"200\"></td></tr>\n";
|
||||
$i++
|
||||
}
|
||||
}
|
||||
|
||||
print(qq(<tr><td colspan="4"><input type="text" name="insert_labour" size=1 maxsize=2 value="">));
|
||||
print(qq(enter a number to add budget lines </td></tr>));
|
||||
print "<tr><td colspan=\"4\"><input type=\"text\" name=\"insert_labour\" size=1 maxsize=2 value=\"\">";
|
||||
print " enter a number to add budget lines </td></tr>\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
print(qq(<tr><td colspan="8" height="20"> </td></tr>\n));
|
||||
print(qq(<tr><td colspan="1" class="medbig"><b>input resources</b></td><td colspan="8">materials, spaces, tools, previous work etc (check the box if your resource has already been deployed) </td></tr>));
|
||||
|
||||
|
@ -398,6 +404,7 @@ END
|
|||
my $sth5 = $dbh->prepare($sql5);
|
||||
$sth5->execute;
|
||||
|
||||
|
||||
my $sqlCR = qq( SELECT count(id) AS count from nonfinance where budget_id=$record->{id} AND agent_id =$record2->{id} AND kind='resources' );
|
||||
my $sthCR = $dbh->prepare($sqlCR);
|
||||
$sthCR->execute;
|
||||
|
@ -407,27 +414,23 @@ END
|
|||
|
||||
for ($i=1;$i<=$t;$i++) {
|
||||
while (my $record5 = $sth5->fetchrow_hashref) {
|
||||
print(qq(<tr><td colspan="1"><b>$i.</b></td>\n));
|
||||
print(qq(<td><input type="checkbox" NAME="new_rstatus$i" VALUE="delivered"));
|
||||
if ($record5->{status} eq 'delivered') { print "CHECKED" };
|
||||
print(qq(></td>\n));
|
||||
print(qq(<td colspan="3"><input type="text" name="new_resource$i" value="$record5->{item}" size="100" maxsize="200"></td></tr>\n));
|
||||
print "<tr><td colspan=\"1\"><b>$i.</b></td>\n";
|
||||
print "<td><input type=\"checkbox\" NAME=\"new_rstatus$i\" VALUE=\"delivered\"";
|
||||
if ($record5->{status} eq 'delivered') { print "CHECKED"};
|
||||
print "></td>\n";
|
||||
print "<td colspan=\"3\"><input type=\"text\" name=\"new_resource$i\" value=\"$record5->{item}\" size=\"100\" maxsize=\"200\"></td></tr>\n";
|
||||
$i++
|
||||
}
|
||||
}
|
||||
|
||||
print "<tr><td colspan=\"4\"><input type=\"text\" name=\"insert_resources\" size=1 maxsize=2 value=\"\">";
|
||||
print " enter a number to add budget lines</td></tr>\n";
|
||||
}
|
||||
|
||||
my $sql6 = qq( SELECT * from nonfinance where budget_id=$record->{id} AND agent_id =$record2->{id} AND kind='notes');
|
||||
my $sth6 = $dbh->prepare($sql6);
|
||||
$sth6->execute;
|
||||
|
||||
print <<END;
|
||||
<tr><td colspan="4">
|
||||
<input type="text" name="insert_resources" size=1 maxsize=2 value="">
|
||||
enter a number to add budget lines</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
print(qq(<tr><td colspan="8" height="20"> </td></tr>\n));
|
||||
print(qq(<tr><td colspan="1" class="medbig"><b>notes</b></td><td colspan="8">for your own reference only, these notes will not show up in the shared budget</td></tr>\n));
|
||||
print(qq(<tr><td colspan=4 align="left"><TEXTAREA NAME="new_notes" ROWS="6" COLS="110" WRAP=SOFT>));
|
||||
|
@ -465,7 +468,7 @@ sub input_budget {
|
|||
&print_header;
|
||||
print(qq(<center>\n));
|
||||
print(qq(<table width="700" cellspacing="20" cellpadding="0" bgcolor="#ffffff">\n));
|
||||
print(qq(<tr><td><<table width="700" cellspacing="5" cellpadding="2" bgcolor="#ffffff" border="0">\n));
|
||||
print(qq(<tr><td><table width="700" cellspacing="5" cellpadding="2" bgcolor="#ffffff" border="0">\n));
|
||||
|
||||
## delete expenditure line for agent + budget, if exists
|
||||
my $sqld = qq( DELETE from expenditure where budget_id="$budget_id" AND agent_id="$agent_id");
|
||||
|
@ -506,6 +509,7 @@ sub input_budget {
|
|||
my $sthi = $dbh->prepare($sqli);
|
||||
$sthi->execute;
|
||||
|
||||
## delete nonfinance line for agent + budget, if exists
|
||||
my $sqld = qq( DELETE from nonfinance where budget_id="$budget_id" AND agent_id="$agent_id");
|
||||
my $sthd= $dbh->prepare($sqld);
|
||||
$sthd->execute;
|
||||
|
@ -529,6 +533,35 @@ sub input_budget {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
## add new budget lines for resources or labour ***
|
||||
|
||||
if (param('insert_labour') ne '') {
|
||||
#if ('$insert_labour' ne '') {
|
||||
for ($i=1; $i<=$insert_labour; $i++) {
|
||||
my $sqlIL = (qq{INSERT INTO nonfinance (budget_id, agent_id, item, kind, status) VALUES ('$budget_id','$agent_id','', 'labour', '')});
|
||||
my $sthIL = $dbh->prepare($sqlIL);
|
||||
$sthIL->execute;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (param('insert_resources') ne '') {
|
||||
#if ('$insert_resources' ne '') {
|
||||
for ($i=1; $i<=$insert_resources; $i++) {
|
||||
my $sqlIR = (qq{INSERT INTO nonfinance (budget_id, agent_id, item, kind, status) VALUES ('$budget_id','$agent_id','', 'resources', '')});
|
||||
my $sthIR = $dbh->prepare($sqlIR);
|
||||
$sthIR->execute;
|
||||
}
|
||||
}
|
||||
|
||||
## input notes nonfinance for agent
|
||||
if ($new_notes ne '') {
|
||||
my $sqln = (qq{INSERT INTO nonfinance (budget_id, agent_id, item, kind) VALUES ($budget_id, $agent_id, "$new_notes", "notes")});
|
||||
my $sthn = $dbh->prepare($sqln);
|
||||
$sthn->execute;
|
||||
}
|
||||
|
||||
## read back in to get these values from the db, not from the cgi
|
||||
|
||||
my $sqlv = (qq{SELECT DISTINCT item, cost, expenditure.currency, type, fullname from expenditure RIGHT JOIN agents on expenditure.agent_id=agents.id LEFT JOIN finance on expenditure.agent_id=finance.agent_id
|
||||
|
@ -816,7 +849,7 @@ sub compile_budget {
|
|||
<div class="headline-2">
|
||||
<b>$projectname</b> | |
|
||||
$recordb->{location} | |
|
||||
budget adjustments to $currentyear-$currentmonth-$currentdayofmonth
|
||||
budget adjustments to $currentdayofmonth-$currentmonth-$currentyear
|
||||
</div>
|
||||
<div class="headline-3">
|
||||
<img src="$feral_logo">
|
||||
|
@ -824,7 +857,7 @@ END
|
|||
if ($agent_id ne "") {
|
||||
while (my $recordfc = $sthfc->fetchrow_hashref) {
|
||||
print <<END;
|
||||
Contributing agents <b>[$recordfc->{count}]</b>. This budget will remain open for editing until <b>$recordb->{end_date}</b>. Monetary items will be kept anonymous (although identifable to the budget r/administrators). Labour & resources will be tagged with the name of the contributor.
|
||||
Contributing agents <b>[$recordfc->{count}]</b>. This multi-player budget will remain open for editing until <b>$recordb->{end_date}</b>. Monetary items will be kept anonymous (although identifable to the budget r/administrators). Labour & resources will be tagged with the name of the contributor.
|
||||
END
|
||||
}
|
||||
}
|
||||
|
@ -909,7 +942,7 @@ END
|
|||
$display_cost = sprintf "%.2f",$cost;
|
||||
$display_cost =~ s/(\d)(?=(\d{3})+(\D|$))/$1\,/g; ## add commma
|
||||
|
||||
print_item("$recordex->{item}", ">$recordex->{currency}$display_cost");
|
||||
print_item("$recordex->{item}", "$recordex->{currency}$display_cost");
|
||||
}
|
||||
|
||||
print_subtitle("INCOME: / donations, contributions, sums, funds");
|
||||
|
@ -1921,51 +1954,47 @@ sub print_title {
|
|||
END
|
||||
}
|
||||
|
||||
## print a subtitle
|
||||
## print a subtitle
|
||||
|
||||
sub print_subtitle {
|
||||
sub print_subtitle {
|
||||
my $string = shift;
|
||||
print <<END;
|
||||
<div class="subtitle">$string</div>
|
||||
END
|
||||
}
|
||||
}
|
||||
|
||||
## print a budget subtotal line with a description and optional amount
|
||||
## print a budget subtotal line with a description and optional amount
|
||||
|
||||
sub print_subtotal {
|
||||
sub print_subtotal {
|
||||
my $string = shift;
|
||||
my $amount = shift;
|
||||
if (not $amount) {
|
||||
$amount = "";
|
||||
}
|
||||
if (not $amount) {$amount = "";}
|
||||
print <<END;
|
||||
<div class="budget-subtotal">
|
||||
<p class="subtotal-name">$string</p>
|
||||
<p class="subtotal-amount">$amount</p>
|
||||
</div>
|
||||
END
|
||||
}
|
||||
}
|
||||
|
||||
## print standard budget item with a description and optional amount
|
||||
## print standard budget item with a description and optional amount
|
||||
|
||||
sub print_item {
|
||||
sub print_item {
|
||||
my $string = shift;
|
||||
my $amount = shift;
|
||||
if (not $amount) {
|
||||
$amount = "";
|
||||
}
|
||||
if (not $amount) {$amount = "";}
|
||||
print <<END;
|
||||
<div class="budget-item">
|
||||
<p class="item-name">$string</p>
|
||||
<p class="item-amount">$amount</p>
|
||||
</div>
|
||||
END
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## print the page header
|
||||
## print the page header
|
||||
|
||||
sub print_header {
|
||||
sub print_header {
|
||||
print <<END;
|
||||
Content-type: text/html
|
||||
|
||||
|
@ -1980,22 +2009,22 @@ Content-type: text/html
|
|||
</head>
|
||||
<body>
|
||||
END
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## print a standard footer
|
||||
## print a standard footer
|
||||
|
||||
sub print_footer {
|
||||
sub print_footer {
|
||||
print <<END;
|
||||
</body>
|
||||
</html>
|
||||
END
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## print the admin footer
|
||||
## print the admin footer
|
||||
|
||||
sub adminfooter {
|
||||
sub adminfooter {
|
||||
|
||||
print(qq(<tr><td bgcolor="ffffff" colspan="4"><br><a href="$script_name?action\=display_budgets">all budgets: edit</a></td></tr>\n));
|
||||
print(qq(<tr><td bgcolor="ffffff" colspan="4"><br><a href="$script_name?action\=list_budgets">all budgets: list</a></td></tr>\n));
|
||||
|
@ -2006,4 +2035,4 @@ END
|
|||
print(qq(</body>\n));
|
||||
print(qq(</html>\n));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue