summaryrefslogtreecommitdiff
path: root/locale/mx
diff options
context:
space:
mode:
Diffstat (limited to 'locale/mx')
0 files changed, 0 insertions, 0 deletions
"hl"># under the GNU General Public License version 2 or, at your option, any later
  • # version. For a full list including contact information of contributors,
  • # maintainers, and copyright holders, see the CONTRIBUTORS file.
  • #
  • # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
  • # Copyright (c) 2002
  • #
  • # Author: DWS Systems Inc.
  • # Web: http://www.sql-ledger.org
  • #
  • # Contributors:
  • #
  • #
  • # Author: DWS Systems Inc.
  • # Web: http://www.ledgersmb.org/
  • #
  • # Contributors:
  • #
  • # This program is free software; you can redistribute it and/or modify
  • # it under the terms of the GNU General Public License as published by
  • # the Free Software Foundation; either version 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.
  • #======================================================================
  • #
  • # Payment module
  • #
  • #======================================================================
  • use LedgerSMB::CP;
  • use LedgerSMB::OP;
  • use LedgerSMB::IS;
  • use LedgerSMB::IR;
  • use LedgerSMB::Template;
  • require "bin/arap.pl";
  • 1;
  • # end of main
  • # This may need to get more sophisticated in the future
  • # Anyway, it provides one point of control for date handling.
  • sub default_date {
  • $form->{date} ||= 'current_date';
  • }
  • sub payment {
  • if ( $form->{type} eq 'receipt' ) {
  • $form->{ARAP} = "AR";
  • $form->{arap} = "ar";
  • $form->{vc} = "customer";
  • $form->{formname} = "receipt";
  • }
  • if ( $form->{type} eq 'check' ) {
  • $form->{ARAP} = "AP";
  • $form->{arap} = "ap";
  • $form->{vc} = "vendor";
  • $form->{formname} = "check";
  • }
  • $form->{payment} = "payment";
  • $form->{callback} =
  • "$form->{script}?action=payment&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&all_vc=$form->{all_vc}&type=$form->{type}";
  • # setup customer/vendor selection for open invoices
  • if ( $form->{all_vc} ) {
  • $form->all_vc( \%myconfig, $form->{vc}, $form->{ARAP}, undef,
  • $form->{datepaid} );
  • }
  • else {
  • CP->get_openvc( \%myconfig, \%$form );
  • if ( $myconfig{vclimit} > 0 ) {
  • $form->{"all_$form->{vc}"} = $form->{name_list};
  • }
  • }
  • $form->{"select$form->{vc}"} = "";
  • if ( @{ $form->{"all_$form->{vc}"} } ) {
  • $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
  • for ( @{ $form->{"all_$form->{vc}"} } ) {
  • $form->{"select$form->{vc}"} .=
  • qq|<option value="$_->{name}--$_->{id}">$_->{name}\n|;
  • }
  • }
  • # departments
  • if ( @{ $form->{all_department} } ) {
  • $form->{selectdepartment} = "<option>\n";
  • $form->{department} = "$form->{department}--$form->{department_id}"
  • if $form->{department};
  • for ( @{ $form->{all_department} } ) {
  • $form->{selectdepartment} .=
  • qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|;
  • }
  • }
  • if ( @{ $form->{all_language} } ) {
  • $form->{selectlanguage} = "<option>\n";
  • for ( @{ $form->{all_language} } ) {
  • $form->{selectlanguage} .=
  • qq|<option value="$_->{code}">$_->{description}\n|;
  • }
  • }
  • CP->paymentaccounts( \%myconfig, \%$form );
  • $form->{selectaccount} = "";
  • $form->{"select$form->{ARAP}"} = "";
  • for ( @{ $form->{PR}{"$form->{ARAP}_paid"} } ) {
  • $form->{selectaccount} .= "<option>$_->{accno}--$_->{description}\n";
  • }
  • for ( @{ $form->{PR}{ $form->{ARAP} } } ) {
  • $form->{"select$form->{ARAP}"} .=
  • "<option>$_->{accno}--$_->{description}\n";
  • }
  • # currencies
  • @curr = split /:/, $form->{currencies};
  • $form->{defaultcurrency} = $curr[0];
  • chomp $form->{defaultcurrency};
  • $form->{selectcurrency} = "";
  • for (@curr) { $form->{selectcurrency} .= "<option>$_\n" }
  • $form->{currency} = $form->{defaultcurrency};
  • $form->{oldcurrency} = $form->{currency};
  • if ( $form->{currency} ne $form->{defaultcurrency} ) {
  • $form->{forex} = $form->{exchangerate} =
  • $form->check_exchangerate( \%myconfig, $form->{currency},
  • $form->{datepaid}, ( $form->{vc} eq 'customer' ) ? "buy" : "sell" );
  • }
  • $form->{olddatepaid} = $form->{datepaid};
  • $form->{media} = $myconfig{printer};
  • $form->{format} = "pdf" unless $myconfig{printer};
  • &payment_header;
  • &payment_footer;
  • }
  • sub payments {
  • if ( $form->{type} eq 'receipt' ) {
  • $form->{ARAP} = "AR";
  • $form->{arap} = "ar";
  • $form->{vc} = "customer";
  • $form->{formname} = "receipt";
  • }
  • if ( $form->{type} eq 'check' ) {
  • $form->{ARAP} = "AP";
  • $form->{arap} = "ap";
  • $form->{vc} = "vendor";
  • $form->{formname} = "check";
  • }
  • $form->{payment} = "payments";
  • $form->{callback} = "$form->{script}?action=$form->{action}";
  • for (qw(path login sessionid type)) {
  • $form->{callback} .= "&$_=$form->{$_}";
  • }
  • CP->paymentaccounts( \%myconfig, \%$form );
  • if ( @{ $form->{all_language} } ) {
  • $form->{selectlanguage} = "<option>\n";
  • for ( @{ $form->{all_language} } ) {
  • $form->{selectlanguage} .=
  • qq|<option value="$_->{code}">$_->{description}\n|;
  • }
  • }
  • # departments
  • if ( @{ $form->{all_department} } ) {
  • $form->{selectdepartment} = "<option>\n";
  • $form->{department} = "$form->{department}--$form->{department_id}"
  • if $form->{department};
  • for ( @{ $form->{all_department} } ) {
  • $form->{selectdepartment} .=
  • qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|;
  • }
  • }
  • $form->{selectaccount} = "";
  • $form->{"select$form->{ARAP}"} = "";
  • for ( @{ $form->{PR}{"$form->{ARAP}_paid"} } ) {
  • $form->{selectaccount} .= "<option>$_->{accno}--$_->{description}\n";
  • }
  • for ( @{ $form->{PR}{ $form->{ARAP} } } ) {
  • $form->{"select$form->{ARAP}"} .=
  • "<option>$_->{accno}--$_->{description}\n";
  • }
  • # currencies
  • @curr = split /:/, $form->{currencies};
  • $form->{defaultcurrency} = $curr[0];
  • chomp $form->{defaultcurrency};
  • $form->{selectcurrency} = "";
  • for (@curr) { $form->{selectcurrency} .= "<option>$_\n" }
  • $form->{oldcurrency} = $form->{currency} = $form->{defaultcurrency};
  • $form->{oldduedateto} = $form->{datepaid};
  • $form->{media} = $myconfig{printer};
  • $form->{format} = "pdf" unless $myconfig{printer};
  • &payments_header;
  • &invoices_due;
  • &payments_footer;
  • }
  • sub payments_header {
  • if ( $form->{type} eq 'receipt' ) {
  • $form->{title} = $locale->text('Receipts');
  • }
  • if ( $form->{type} eq 'check' ) {
  • $form->{title} = $locale->text('Payments');
  • }
  • for ("department") {
  • $form->{"select$_"} = $form->unescape( $form->{"select$_"} );
  • $form->{"select$_"} =~ s/ selected//;
  • $form->{"select$_"} =~ s/(<option value="\Q$form->{$_}\E")/$1 selected/;
  • }
  • for ( "account", "currency", "$form->{ARAP}" ) {
  • $form->{"select$_"} =~ s/ selected//;
  • $form->{"select$_"} =~
  • s/option>\Q$form->{$_}\E/option selected>$form->{$_}/;
  • }
  • if ( $form->{defaultcurrency} ) {
  • $exchangerate = qq|
  • <tr>
  • <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
  • <td><select name=currency>$form->{selectcurrency}</select></td>
  • <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
  • <input type=hidden name=oldcurrency value=$form->{oldcurrency}>
  • </tr>
  • |;
  • }
  • if ( $form->{currency} ne $form->{defaultcurrency} ) {
  • $form->{exchangerate} =
  • $form->format_amount( \%myconfig, $form->{exchangerate} );
  • if ( $form->{forex} ) {
  • $exchangerate .= qq|
  • <tr>
  • <th align=right nowrap>| . $locale->text('Exchange Rate') . qq|</th>
  • <td colspan=3><input type=hidden name=exchangerate size=10 value=$form->{exchangerate}>$form->{exchangerate}</td>
  • </tr>
  • |;
  • }
  • else {
  • $exchangerate .= qq|
  • <tr>
  • <th align=right nowrap>| . $locale->text('Exchange Rate') . qq|</th>
  • <td colspan=3><input name=exchangerate size=10 value=$form->{exchangerate}></td>
  • </tr>
  • |;
  • }
  • }
  • $department = qq|
  • <tr>
  • <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
  • <td><select name=department>$form->{selectdepartment}</select>
  • <input type=hidden name=selectdepartment value="|
  • . $form->escape( $form->{selectdepartment}, 1 ) . qq|">
  • </td>
  • </tr>
  • | if $form->{selectdepartment};
  • $form->header;
  • print qq|
  • <body>
  • <form method=post action=$form->{script}>
  • |;
  • $form->hide_form(
  • qw(defaultcurrency closedto vc type formname arap ARAP title oldduedatefrom oldduedateto payment olddepartment)
  • );
  • print qq|
  • <table width=100%>
  • <tr>
  • <th class=listtop>$form->{title}</th>
  • </tr>
  • <tr height="5"></tr>
  • <tr>
  • <td>
  • <table width=100%>
  • <tr valign=top>
  • <td>
  • <table>
  • <tr>
  • <th align=right>|
  • . $locale->text('Due Date')
  • . qq|&nbsp;|
  • . $locale->text('From')
  • . qq|</th>
  • <td><input class="date" name=duedatefrom value="$form->{duedatefrom}" title="$myconfig{dateformat}" size=11></td>
  • <th align=right>| . $locale->text('To') . qq|</th>
  • <td><input class="date" name=duedateto value="$form->{duedateto}" title="$myconfig{dateformat}" size=11></td>
  • </tr>
  • </table>
  • </td>
  • </td>
  • <td align=right>
  • <table>
  • $department
  • <tr>
  • <th align=right nowrap>| . $locale->text( $form->{ARAP} ) . qq|</th>
  • <td colspan=3><select name=$form->{ARAP}>$form->{"select$form->{ARAP}"}</select>
  • </td>
  • <input type=hidden name="select$form->{ARAP}" value="$form->{"select$form->{ARAP}"}">
  • </tr>
  • <tr>
  • <th align=right nowrap>| . $locale->text('Account') . qq|</th>
  • <td colspan=3><select name=account>$form->{selectaccount}</select>
  • <input type=hidden name=selectaccount value="$form->{selectaccount}">
  • </td>
  • </tr>
  • <tr>
  • <th align=right nowrap>| . $locale->text('Date') . qq|</th>
  • <td><input class="date" name=datepaid value="$form->{datepaid}" title="$myconfig{dateformat}" size=11></td>
  • </tr>
  • $exchangerate
  • </table>
  • </td>
  • </tr>
  • </table>
  • </td>
  • </tr>
  • |;
  • }
  • sub invoices_due {
  • @column_index =
  • qw(name invnumber transdate amount due checked paid memo source);
  • push @column_index, "language" if $form->{selectlanguage};
  • $colspan = $#column_index + 1;
  • $invoice = $locale->text('Invoices');
  • $vclabel = ucfirst $form->{vc};
  • $vclabel = $locale->text($vclabel);
  • print qq|
  • <input type=hidden name=column_index value="id @column_index">
  • <tr>
  • <td>
  • <table width=100%>
  • <tr>
  • <th class=listheading colspan=$colspan>$invoice</th>
  • </tr>
  • |;
  • $column_data{name} = qq|<th nowrap>$vclabel</th>|;
  • $column_data{invnumber} =
  • qq|<th nowrap>| . $locale->text('Invoice') . "</th>";
  • $column_data{transdate} = qq|<th nowrap>| . $locale->text('Date') . "</th>";
  • $column_data{amount} = qq|<th nowrap>| . $locale->text('Amount') . "</th>";
  • $column_data{due} = qq|<th nowrap>| . $locale->text('Amount Due') . "</th>";
  • $column_data{paid} = qq|<th nowrap>| . $locale->text('Amount') . "</th>";
  • $column_data{checked} = qq|<th nowrap>| . $locale->text('Select') . "</th>";
  • $column_data{memo} = qq|<th nowrap>| . $locale->text('Memo') . "</th>";
  • $column_data{source} = qq|<th nowrap>| . $locale->text('Source') . "</th>";
  • $column_data{language} =
  • qq|<th nowrap>| . $locale->text('Language') . "</th>";
  • print qq|
  • <tr>
  • |;
  • for (@column_index) { print "$column_data{$_}\n" }
  • print qq|
  • </tr>
  • |;
  • $form->{selectlanguage} = $form->unescape( $form->{selectlanguage} );
  • for $i ( 1 .. $form->{rowcount} ) {
  • for (qw(amount due paid)) {
  • $form->{"${_}_$i"} =
  • $form->parse_amount( \%myconfig, $form->{"${_}_$i"} );
  • }
  • $totalamount += $form->{"amount_$i"};
  • $totaldue += $form->{"due_$i"};
  • if ( $form->{"paid_$i"} =~ /NaN/ ) {
  • $form->{"paid_$i"} = '';
  • }
  • else {
  • $totalpaid += $form->{"paid_$i"};
  • }
  • for (qw(amount due paid)) {
  • $form->{"${_}_$i"} =
  • $form->format_amount( \%myconfig, $form->{"${_}_$i"}, 2 );
  • }
  • $column_data{invnumber} = qq|<td>$form->{"invnumber_$i"}</td>
  • <input type=hidden name="invnumber_$i" value="$form->{"invnumber_$i"}">
  • <input type=hidden name="id_$i" value=$form->{"id_$i"}>|;
  • $column_data{transdate} = qq|<td>$form->{"transdate_$i"}</td>
  • <input type=hidden name="transdate_$i" value=$form->{"transdate_$i"}>|;
  • $column_data{amount} = qq|<td align=right>$form->{"amount_$i"}</td>
  • <input type=hidden name="amount_$i" value=$form->{"amount_$i"}>|;
  • $column_data{due} = qq|<td align=right>$form->{"due_$i"}</td>
  • <input type=hidden name="due_$i" value=$form->{"due_$i"}>|;
  • if ( $form->{"paid_$i"} =~ /NaN/ ) {
  • $form->{"paid_$i"} = '';
  • }
  • $column_data{paid} =
  • qq|<td align=right><input name="paid_$i" size=10 value=$form->{"paid_$i"}></td>|;
  • if ( $same_id eq $form->{"$form->{vc}_id_$i"} ) {
  • for (qw(name memo source language)) {
  • $column_data{$_} = qq|<td>&nbsp;</td>|;
  • }
  • }
  • else {
  • $column_data{name} = qq|<td>$form->{"name_$i"}</td>|;
  • $column_data{memo} =
  • qq|<td align=right><input name="memo_$i" size=10 value="$form->{"memo_$i"}"></td>|;
  • $column_data{source} =
  • qq|<td align=right><input name="source_$i" size=10 value="$form->{"source_$i"}"></td>|;
  • if ( $form->{selectlanguage} ) {
  • $selectlanguage = $form->{selectlanguage};
  • $selectlanguage =~
  • s/(<option value="\Q$form->{"language_code_$i"}\E")/$1 selected/;
  • $column_data{language} =
  • qq|<td><select name="language_code_$i">$selectlanguage</select></td>|;
  • }
  • }
  • $column_data{name} .= qq|
  • <input type=hidden name="name_$i" value="$form->{"name_$i"}">
  • <input type=hidden name="$form->{vc}_id_$i" value="$form->{"$form->{vc}_id_$i"}">|;
  • $form->{"checked_$i"} = ( $form->{"checked_$i"} ) ? "checked" : "";
  • $column_data{checked} =
  • qq|<td align=center><input name="checked_$i" type=checkbox class=checkbox $form->{"checked_$i"}></td>|;
  • $j++;
  • $j %= 2;
  • print qq|
  • <tr class=listrow$j>
  • |;
  • for (@column_index) { print "$column_data{$_}\n" }
  • print qq|
  • </tr>
  • |;
  • $same_id = $form->{"$form->{vc}_id_$i"};
  • }
  • for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
  • $column_data{amount} =
  • qq|<th class=listtotal align=right>|
  • . $form->format_amount( \%myconfig, $totalamount, 2, "&nbsp;" )
  • . qq|</th>|;
  • $column_data{due} =
  • qq|<th class=listtotal align=right>|
  • . $form->format_amount( \%myconfig, $totaldue, 2, "&nbsp;" )
  • . qq|</th>|;
  • $column_data{paid} =
  • qq|<th class=listtotal align=right>|
  • . $form->format_amount( \%myconfig, $totalpaid, 2, "&nbsp;" )
  • . qq|</th>|;
  • print qq|
  • <tr class=listtotal>
  • |;
  • for (@column_index) { print "$column_data{$_}\n" }
  • print qq|
  • </tr>
  • </table>
  • </td>
  • </tr>
  • <input type=hidden name=selectlanguage value="|
  • . $form->escape( $form->{selectlanguage}, 1 ) . qq|">
  • |;
  • }
  • sub payments_footer {
  • $form->{DF}{ $form->{format} } = "selected";
  • $transdate = $form->datetonum( \%myconfig, $form->{datepaid} );
  • $closedto = $form->datetonum( \%myconfig, $form->{closedto} );
  • if ( ${LedgerSMB::Sysconfig::latex} ) {
  • $media = qq|<select name=media>
  • <option value=screen>| . $locale->text('Screen');
  • if ( %{LedgerSMB::Sysconfig::printer} ) {
  • for ( sort keys %{LedgerSMB::Sysconfig::printer} ) {
  • $media .= qq|
  • <option value="$_">$_|;
  • }
  • }
  • $media .= qq|</select>|;
  • $format = qq|<select name=format>
  • <option value=postscript $form->{DF}{postscript}>|
  • . $locale->text('Postscript') . qq|
  • <option value=pdf $form->{DF}{pdf}>|
  • . $locale->text('PDF')
  • . qq|</select>|;
  • }
  • print qq|
  • <tr>
  • <td><hr size=3 noshade></td>
  • </tr>
  • </table>
  • |;
  • # type=submit $locale->text('Update')
  • # type=submit $locale->text('Post')
  • # type=submit $locale->text('Print')
  • # type=submit $locale->text('Select all')
  • %button = (
  • 'update' => { ndx => 1, key => 'U', value => $locale->text('Update') },
  • 'select_all' =>
  • { ndx => 2, key => 'A', value => $locale->text('Select all') },
  • 'print' => { ndx => 3, key => 'P', value => $locale->text('Print') },
  • 'post' => { ndx => 4, key => 'O', value => $locale->text('Post') },
  • );
  • if ( !${LedgerSMB::Sysconfig::latex} ) {
  • delete $button{'print'};
  • }
  • if ( $transdate <= $closedto ) {
  • for ( 'post', 'print' ) { delete $button{$_} }
  • $media = $format = "";
  • }
  • for ( sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button ) {
  • $form->print_button( \%button, $_ );
  • }
  • $media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
  • print qq|
  • $format
  • $media
  • |;
  • $form->hide_form(qw(callback rowcount path login sessionid));
  • if ( $form->{lynx} ) {
  • require "bin/menu.pl";
  • &menubar;
  • }
  • print qq|
  • </form>
  • </body>
  • </html>
  • |;
  • }
  • sub select_all {
  • for ( 1 .. $form->{rowcount} ) { $form->{"checked_$_"} = 1 }
  • &{"update_$form->{payment}"}
  • }
  • sub update {
  • my ($new_name_selected) = @_;
  • &{"update_$form->{payment}"};
  • }
  • sub update_payments {
  • if ( $form->{ARAP} eq 'AR' ) {
  • $buysell = "buy";
  • }
  • else {
  • $buysell = "sell";
  • }
  • if ( ( $form->{oldduedatefrom} ne $form->{duedatefrom} )
  • || ( $form->{oldduedateto} ne $form->{duedateto} )
  • || ( $form->{department} ne $form->{olddepartment} ) )
  • {
  • CP->get_openinvoices( \%myconfig, \%$form );
  • $form->{redo} = 1;
  • }
  • if ( $form->{currency} ne $form->{oldcurrency} ) {
  • $form->{oldcurrency} = $form->{currency};
  • if ( !$form->{redo} ) {
  • CP->get_openinvoices( \%myconfig, \%$form );
  • $form->{redo} = 1;
  • }
  • }
  • for (qw(duedatefrom duedateto department)) {
  • $form->{"old$_"} = $form->{$_};
  • }
  • $form->{exchangerate} = $exchangerate
  • if (
  • $form->{forex} = (
  • $exchangerate = $form->check_exchangerate(
  • \%myconfig, $form->{currency}, $form->{datepaid}, $buysell
  • )
  • )
  • );
  • if ( $form->{redo} ) {
  • $form->{rowcount} = 0;
  • $i = 0;
  • foreach $ref ( @{ $form->{PR} } ) {
  • $i++;
  • for (qw(id name invnumber transdate)) {
  • $form->{"${_}_$i"} = $ref->{$_};
  • }
  • $form->{"$form->{vc}_id_$i"} = $ref->{"$form->{vc}_id"};
  • $ref->{exchangerate} = 1 unless $ref->{exchangerate};
  • $form->{"amount_$i"} = $ref->{amount} / $ref->{exchangerate};
  • $form->{"due_$i"} =
  • ( $ref->{amount} - $ref->{paid} ) / $ref->{exchangerate};
  • $form->{"checked_$i"} = "";
  • $form->{"paid_$i"} = "";
  • # need to format
  • for (qw(amount due)) {
  • $form->{"${_}_$i"} =
  • $form->format_amount( \%myconfig, $form->{"${_}_$i"}, 2 );
  • }
  • }
  • $form->{rowcount} = $i;
  • }
  • $form->{amount} = $form->parse_amount( \%myconfig, $form->{amount} );
  • # recalculate
  • $amount = 0;
  • for $i ( 1 .. $form->{rowcount} ) {
  • for (qw(amount due paid)) {
  • $form->{"${_}_$i"} =
  • $form->parse_amount( \%myconfig, $form->{"${_}_$i"} );
  • }
  • if ( $form->{"checked_$i"} ) {
  • # calculate paid_$i
  • if ( !$form->{"paid_$i"} ) {
  • $form->{"paid_$i"} = $form->{"due_$i"};
  • }
  • $amount += $form->{"paid_$i"};
  • $form->{redo} = 1;
  • }
  • else {
  • $form->{"paid_$i"} = "";
  • }
  • for (qw(amount due paid)) {
  • $form->{"${_}_$i"} =
  • $form->format_amount( \%myconfig, $form->{"${_}_$i"}, 2 )
  • if $form->{"${_}_$i"};
  • }
  • }
  • $form->{amount} += ( $amount - $form->{oldamount} ) if $form->{redo};
  • &payments_header;
  • &invoices_due;
  • &payments_footer;
  • }
  • sub update_payment {
  • if ( $form->{vc} eq 'customer' ) {
  • $buysell = "buy";
  • }
  • else {
  • $buysell = "sell";
  • }
  • $department = $form->{department};
  • # get customer/vendor
  • &check_openvc;
  • $form->{department} = $department;
  • if ( $form->{datepaid} ne $form->{olddatepaid} ) {
  • $form->{olddatepaid} = $form->{datepaid};
  • $form->{oldall_vc} = !$form->{oldall_vc} if $form->{all_vc};
  • }
  • if ( $form->{department} ne $form->{olddepartment} ) {
  • $form->{olddepartment} = $form->{department};
  • $form->{redo} = 1;
  • }
  • # if we switched to all_vc
  • if ( $form->{all_vc} ne $form->{oldall_vc} ) {
  • if ( $form->{"select$form->{vc}"} ) {
  • $form->{redo} = ( $form->{"old$name"} ne $form->{$name} );
  • }
  • else {
  • $form->{redo} =
  • ( $form->{"old$name"} ne
  • qq|$form->{$name}--$form->{"${name}_id"}| );
  • }
  • $form->{"select$form->{vc}"} = "";
  • if ( $form->{all_vc} ) {
  • $form->all_vc( \%myconfig, $form->{vc}, $form->{ARAP}, undef,
  • $form->{datepaid} );
  • if ( @{ $form->{"all_$form->{vc}"} } ) {
  • for ( @{ $form->{"all_$form->{vc}"} } ) {
  • $form->{"select$form->{vc}"} .=
  • qq|<option value="$_->{name}--$_->{id}">$_->{name}\n|;
  • }
  • }
  • }
  • else {
  • if ( ( $myconfig{vclimit} * 1 ) > 0 ) {