chiark / gitweb /
Implement constraint on available capital
[ypp-sc-tools.db-live.git] / yarrg / web / query_route
index d4a3bd15e4c06cd362765852d3e63bcc8c6284fd..81e91bcca2334c023edefb73060f544ebb77c08c 100644 (file)
@@ -39,6 +39,8 @@ $dbh
 $prselector
 $routestring => '';
 $capacitystring => '';
+$lossperleague => '';
+$capitalstring => '';
 $someresults
 $emsgokorprint
 </%args>
@@ -49,6 +51,8 @@ my @archipelagoes;
 my @islandids;
 my %islandid2;
 my ($max_volume, $max_mass);
+my $lossperleaguepct;
+my $capital;
 
 my $qa= \%ARGS;
 
@@ -86,14 +90,52 @@ Enter route (islands, or archipelagoes, separated by |s or commas;
  size=80
 </&>
 
-Vessel capacity:
+<strong>Advanced options - you may leave these blank:</strong>
+<p>
+<table>
+<tr>
+<td>
+
+Vessel or capacity:
 <&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'cs',
     thingstring => 'capacitystring', emsgstore => \$emsg,
+    helpref => 'capacity',
     perresult => sub {
-        ($max_volume,$max_mass) = @_;
+        ($max_mass,$max_volume) = @_;
     }
  &>
+ size=40
+</&>
+
+<td>
+&nbsp;
+&nbsp;
+
+<td>
+Expected losses:
+
+<&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'll',
+    thingstring => 'lossperleague', emsgstore => \$emsg,
+    helpref => 'losses',
+    perresult => sub { ($lossperleaguepct)= @_; }
+ &>
+ size=9
 </&>
+</tr>
+<tr>
+
+<td>Available capital:
+
+<&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'ac',
+    thingstring => 'capitalstring', emsgstore => \$emsg,
+    helpref => 'capital',
+    perresult => sub { ($capital)= @_; }
+ &>
+ size=9
+</&>
+</td>
+</tr>
+</table>
 
 % } else { #---------- dropdowns, user selects from menus ----------
 
@@ -193,7 +235,7 @@ function ms_Setarch(dd) {
 
 <input type=submit name=submit value="<% $goupdate->() %>">
 % my $ours= sub { $_[0] =~
-%      m/^island|^archipelago|^routestring|^capacitystring|^[RT]/;
+%  m/^island|^archipelago|^routestring|^capacitystring|^lossperleague|^capitalstring|^[RT]/;
 % };
 <& "lookup:formhidden", ours => $ours &>
 
@@ -238,7 +280,11 @@ for my $dd (0..$qa->{Dropdowns}-1) {
    dbh => $dbh,
    islandids => \@islandids,
    archipelagoes => \@archipelagoes,
-   qa => $qa
+   qa => $qa,
+   max_mass => $max_mass,
+   max_volume => $max_volume,
+   lossperleaguepct => $lossperleaguepct,
+   max_capital => $capital
  &>
 </form>
 % }