summaryrefslogtreecommitdiff
path: root/doc/news/code_swarm
ModeNameSize
-rw-r--r--code_swarm.config1115logplain
-rwxr-xr-xcode_swarm_log.pl703logplain
-rw-r--r--discussion.mdwn132logplain
-rw-r--r--screenshot.png64320logplain
n 2 of the License, or
  • # (at your option) any later version.
  • #
  • # This program is distributed in the hope that it will be useful,
  • # but WITHOUT ANY WARRANTY; without even the implied warranty of
  • # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • # GNU General Public License for more details.
  • # You should have received a copy of the GNU General Public License
  • # along with this program; if not, write to the Free Software
  • # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  • #======================================================================
  • #
  • # This file has not undergone any whitespace cleanup.
  • #
  • # printing routines for ar, ap
  • #
  • # any custom scripts for this one
  • if (-f "bin/custom/arapprn.pl") {
  • eval { require "bin/custom/arapprn.pl"; };
  • }
  • if (-f "bin/custom/$form->{login}_arapprn.pl") {
  • eval { require "bin/custom/$form->{login}_arapprn.pl"; };
  • }
  • 1;
  • # end of main
  • sub print {
  • if ($form->{media} !~ /screen/) {
  • $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(postscript|pdf)/;
  • $old_form = new Form;
  • for (keys %$form) { $old_form->{$_} = $form->{$_} }
  • }
  • if ($form->{formname} =~ /(check|receipt)/) {
  • if ($form->{media} eq 'screen') {
  • $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(postscript|pdf)/;
  • }
  • }
  • if (! $form->{invnumber}) {
  • $invfld = 'sinumber';
  • $invfld = 'vinumber' if $form->{ARAP} eq 'AP';
  • $form->{invnumber} = $form->update_defaults(\%myconfig, $invfld);
  • if ($form->{media} eq 'screen') {
  • if ($form->{media} eq 'screen') {
  • &update;
  • exit;
  • }
  • }
  • }
  • if ($form->{formname} =~ /(check|receipt)/) {
  • if ($form->{media} ne 'screen') {
  • for (qw(action header)) { delete $form->{$_} }
  • $form->{invtotal} = $form->{oldinvtotal};
  • foreach $key (keys %$form) {
  • $form->{$key} =~ s/&/%26/g;
  • $form->{previousform} .= qq|$key=$form->{$key}&|;
  • }
  • chop $form->{previousform};
  • $form->{previousform} = $form->escape($form->{previousform}, 1);
  • }
  • if ($form->{paidaccounts} > 1) {
  • if ($form->{"paid_$form->{paidaccounts}"}) {
  • &update;
  • exit;
  • } elsif ($form->{paidaccounts} > 2) {
  • # select payment
  • &select_payment;
  • exit;
  • }
  • } else {
  • $form->error($locale->text('Nothing to print!'));
  • }
  • }
  • if ($filename = $queued{$form->{formname}}) {
  • $form->{queued} =~ s/$form->{formname} $filename//;
  • unlink "${LedgerSMB::Sysconfig::spool}/$filename";
  • $filename =~ s/\..*$//g;
  • } else {
  • $filename = time;
  • $filename .= $$;
  • }
  • $filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
  • $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
  • $form->{queued} .= " $form->{formname} $filename";
  • $form->{queued} =~ s/^ //;
  • $printform = new Form;
  • for (keys %$form){
  • $printform->{$_} = $form->{$_};
  • }
  • if ($form->{printandpost}){
  • &post;
  • } else {
  • &{ "print_$form->{formname}" }($old_form, 1);
  • }
  • }
  • sub print_check {
  • my ($old_form, $i) = @_;
  • $display_form = ($form->{display_form}) ? $form->{display_form} : "display_form";
  • if ($form->{"paid_$i"}) {
  • @a = ();
  • if (exists $form->{longformat}) {
  • $form->{"datepaid_$i"} = $locale->date(\%myconfig, $form->{"datepaid_$i"}, $form->{longformat});
  • }
  • push @a, "source_$i", "memo_$i";
  • $form->format_string(@a);
  • }
  • $form->{amount} = $form->{"paid_$i"};
  • if (($form->{formname} eq 'check' && $form->{vc} eq 'customer') ||
  • ($form->{formname} eq 'receipt' && $form->{vc} eq 'vendor')) {
  • $form->{amount} =~ s/-//g;
  • }
  • for (qw(datepaid source memo)) { $form->{$_} = $form->{"${_}_$i"} }
  • &{ "$form->{vc}_details" };
  • @a = qw(name address1 address2 city state zipcode country);
  • foreach $item (qw(invnumber ordnumber)) {
  • $temp{$item} = $form->{$item};
  • delete $form->{$item};
  • push(@{ $form->{$item} }, $temp{$item});
  • }
  • push(@{ $form->{invdate} }, $form->{transdate});
  • push(@{ $form->{due} }, $form->format_amount(\%myconfig, $form->{oldinvtotal}, 2));
  • push(@{ $form->{paid} }, $form->{"paid_$i"});
  • use LedgerSMB::CP;
  • $c = CP->new(($form->{language_code}) ? $form->{language_code} : $myconfig{countrycode});
  • $c->init;
  • ($whole, $form->{decimal}) = split /\./, $form->parse_amount(\%myconfig, $form->{amount});
  • $form->{decimal} .= "00";
  • $form->{decimal} = substr($form->{decimal}, 0, 2);
  • $form->{text_decimal} = $c->num2text($form->{decimal} * 1);
  • $form->{text_amount} = $c->num2text($whole);
  • $form->{integer_amount} = $form->format_amount($myconfig, $whole);
  • ($form->{employee}) = split /--/, $form->{employee};
  • $form->{notes} =~ s/^\s+//g;