[set page_banner]Report Columns[/set] [set fm_class]Ledger[/set] [set help_name]report_col[/set] [set page_title]Report Columns[/set] [set icon_name]admin/icon_stats.gif[/set] @_FM_STD_HEAD_@ [if value mv_action] [if value select_col] [query list=1 sql="SELECT col_id, description FROM gl_reportcolhead WHERE col_id=[value select_col]"] [seti col_id][sql-param col_id][/seti] [seti description][sql-param description][/seti] [/query] [else] [set submit_value]Add[/set] [/else] [/if] [seti submit_value][value mv_action][/seti] [else] [set submit_value]Add[/set] [seti col_id][value col_id][/seti] [seti description][value description][/seti] [value name=select_col set=""] [/else] [/if] [perl tables="gl_report"] # Do we change an entry? if ($Values->{line_action}) { my $i = $Values->{select_line} || 0; my $ref = $Scratch->{cols}; my ($ar, $nul, $names) = @$ref; if ($Values->{line_action} eq "Update") { my @ary = @$ar; my $ref = $ary[$i - 1]; my ($type,$header,$fromperiod,$toperiod,$fsign1,$fromline,$fsign2,$toline) = @$ref; $type = $Values->{coltype} ; $header = $Values->{header} ; if ($type == 1) { $fromperiod = $Values->{fromperiod}; $toperiod = $Values->{toperiod}; } else { $fsign1 = $Values->{fsign1}; $fromline = $Values->{fromline}; $fsign2 = $Values->{fsign2} if $fsign1 != 3; $toline = $Values->{toline}; }; # $acctinfo = @$ar[$i - 1]->[6] if (@$ar && $i && !$acctinfo); # $journalnr = @$ar[$i - 1]->[1] if (@$ar && $i && !$journalnr); # $jdate = $Values->{jdate}; # $jdate = @$ar[$i - 1]->[2] if (@$ar && $i && !$jdate); # $description = $Values->{description}; # $description = @$ar[$i - 1]->[5] if (@$ar && $i && !$description); # $debit = $Values->{debit}; # $debit = @$ar[$i - 1]->[3] if (@$ar && $i && !$debit); # $debit = 0 if $debit == "-"; # $credit = $Values->{credit}; # $credit = @$ar[$i - 1]->[4] if (@$ar && $i && !$credit); # $credit = 0 if $credit == "-"; @ol = [$type,$header,$fromperiod,$toperiod,$fsign1,$fromline,$fsign2,$toline]; if ($i) { @$ar[$i - 1] = (@ol); } else { push @$ar, (@ol); }; } elsif ($Values->{line_action} eq "Delete") { splice (@$ar, $i - 1, 1); }; # We'll find the existing col entries } else { if ($Values->{select_col}) { my $db = $Db{gl_report} or return "NO table?"; my $q = qq{ SELECT coltype, coltext, fromperiod, toperiod, fsign1, fromline, fsign2, toline FROM gl_reportcol WHERE col_id = $Values->{select_col} ORDER BY linenr; }; my @ary = $db->query($q) or die "query failed"; $Scratch->{cols} = \@ary; } else { my @ary = ( [ ]); $Scratch->{cols} = \@ary; } }; delete $Values->{line_action}; delete $Values->{select_line}; return; [/perl] [if !scratch error]
[comment]Header[/comment]
[L]Column[/L]        
[L]Nr[/L] [L]Description[/L]
[comment]Report col lines[/comment]
[loop list=`$Scratch->{cols}`] [list] [if explicit] [condition] $type = '[loop-pos 0]'; return 1 if $type == 1; return 0; [/condition] [else] [/else] [/if] [/list] [more-list]
[more] [/more-list] [/loop]
[L]Select[/L] [L]Header[/L] [L]Type[/L] [L]From[/L] [L]To[/L]  
[loop-pos 1] [L]Period[/L] [loop-pos 2] [loop-pos 3] [L]Formula[/L] [calc] return '+' if [loop-pos 4]+0 == 1; return '-' if [loop-pos 4]+0 == 2; return 'sum' if [loop-pos 4]+0 == 3; [/calc] [loop-pos 5] [calc] return '+' if [loop-pos 6]+0 == 1; return '-' if [loop-pos 6]+0 == 2; [/calc] [loop-pos 7]
 
 
  [L]Period[/L]
[L]Formula[/L]
[set [L]Update Line[/L]] mv_todo=return mv_nextpage=freemoney/reportcol.html line_action=Update [/set] [set [L]Delete Line[/L]] mv_todo=return mv_nextpage=freemoney/reportcol.html line_action=Delete [/set]
[comment]END col lines END[/comment]
[set [L]Find Column[/L]] mv_todo=return mv_nextpage=freemoney/reportcolList.html mv_action= select_order= [/set] [set name=[L]"[scratch submit_value]"[/L]] mv_nextpage=freemoney/reportcolUpdate [/set]
[else] [scratch error] [set error][/set]

[L]BACK[/L] [/else] [/if] @_FM_STD_FOOTER_@