summaryrefslogtreecommitdiff
path: root/debian/monkeysphere.install
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2008-06-13 15:12:07 -0400
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2008-06-13 15:12:07 -0400
commita7275bfcb21bccff64ccc544676406cb6318a021 (patch)
treec6bc3224eac33ea50500fe66b689c22d425c4442 /debian/monkeysphere.install
parent3283d7979d05ff3bb83aff1944e78589ac63370d (diff)
added TODO documentation with additional projects.
Diffstat (limited to 'debian/monkeysphere.install')
0 files changed, 0 insertions, 0 deletions
ed 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;
  • 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 name="duedatefrom" value="$form->{duedatefrom}" title="$myconfig{dateformat}" size="11"></td>
  • <th align="right">| . $locale->text('To') . qq|</th>
  • <td><input 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 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>";