diff options
-rw-r--r-- | UI/rp-search-aging.html | 108 | ||||
-rw-r--r-- | UI/rp-search-balance_sheet.html | 97 | ||||
-rw-r--r-- | UI/rp-search-generate_tax_report.html | 199 | ||||
-rw-r--r-- | UI/rp-search-generate_trial_balance.html | 81 | ||||
-rw-r--r-- | UI/rp-search-income_statement.html | 147 | ||||
-rw-r--r-- | UI/rp-search-inv_activity.html | 60 | ||||
-rw-r--r-- | UI/rp-search-payments.html | 95 | ||||
-rw-r--r-- | UI/rp-search-projects.html | 79 | ||||
-rw-r--r-- | UI/rp-search.html | 53 | ||||
-rw-r--r-- | bin/rp.pl | 848 |
10 files changed, 1080 insertions, 687 deletions
diff --git a/UI/rp-search-aging.html b/UI/rp-search-aging.html new file mode 100644 index 00000000..6e5f86ac --- /dev/null +++ b/UI/rp-search-aging.html @@ -0,0 +1,108 @@ + <tr> + <th align="right"><?lsmb text(form.uvc) ?></th> + <td><?lsmb PROCESS $form.vci.type element_data=form.vci.input ?></td> + </tr> + <tr> + <th align="right"><?lsmb text('To') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'todate', + size => '11', + title => user.dateformat, + } ?></td> + </tr> + <tr> + <th></th> + <td> +<?lsmb IF form.selectaccountingyear.defined ?> + <?lsmb PROCESS select element_data=form.selectaccountingmonth -?> + <?lsmb PROCESS select element_data=form.selectaccountingyear -?> +<?lsmb END ?> + </td> + </tr> + <tr> + <th></th> + <td> +<?lsmb PROCESS input element_data={ + type => 'radio', + name => 'summary', + value => '1', + label => text('Summary'), + checked => 'checked', + } -?> +<?lsmb PROCESS input element_data={ + type => 'radio', + name => 'summary', + value => '0', + label => text('Detail'), + } -?> + </td> + </tr> + <tr><td colspan="2"> + <table> + <tr> + <th align="right"><?lsmb text('Include in Report') ?></th> + <td> + <table> + <tr> + <td> +<?lsmb PROCESS input element_data={ + name => 'overdue', + type => 'radio', + value => '0', + label => text('Aged'), + checked => 'checked', + } -?> + </td> + <td> +<?lsmb PROCESS input element_data={ + name => 'overdue', + type => 'radio', + value => '1', + label => text('Overdue'), + } -?> + </td> + </tr> + <tr> + <td width="70"> +<?lsmb PROCESS input element_data={ + name => 'c0', + type => 'checkbox', + value => '1', + label => text('Current'), + checked => 'checked', + } -?> + </td> + <td width="70"> +<?lsmb PROCESS input element_data={ + name => 'c30', + type => 'checkbox', + value => '1', + label => '30', + checked => 'checked', + } -?> + </td> + <td width="70"> +<?lsmb PROCESS input element_data={ + name => 'c60', + type => 'checkbox', + value => '1', + label => '60', + checked => 'checked', + } -?> + </td> + <td width="70"> +<?lsmb PROCESS input element_data={ + name => 'c90', + type => 'checkbox', + value => '1', + label => '90', + checked => 'checked', + } -?> + </td> + </tr> + </table> + </td> + </tr> + </table></td> + </tr> diff --git a/UI/rp-search-balance_sheet.html b/UI/rp-search-balance_sheet.html new file mode 100644 index 00000000..2363b4a6 --- /dev/null +++ b/UI/rp-search-balance_sheet.html @@ -0,0 +1,97 @@ + <tr> + <th align="right"><?lsmb text('as at') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'asofdate', + size => '11', + title => user.dateformat, + value => form.asofdate, + } ?></td> + <td colspan="2"> +<?lsmb IF form.selectaccountingyear.defined ?> + <?lsmb PROCESS select element_data=form.selectaccountingmonth -?> + <?lsmb PROCESS select element_data=form.selectaccountingyear -?> +<?lsmb END ?> + </td> + </tr> + <tr><th align="right"><?lsmb text('Compare to') ?></th><td colspan="3" /></tr> + <tr> + <th align="right"><?lsmb text('From') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'compareasofdate', + size => '11', + title => user.dateformat, + } ?></td> + <td> +<?lsmb IF form.selectaccountingyear.defined; + compare_month = { + options => form.selectaccountingmonth.options, + name => 'compareasofmonth', + }; + compare_year = { + options => form.selectaccountingyear.options, + name => 'compareasofyear', + }; + -?> + <?lsmb PROCESS select element_data=compare_month -?> + <?lsmb PROCESS select element_data=compare_year -?> +<?lsmb END ?> + </td> + </tr> + <tr> + <th align="right"><?lsmb text('Decimal Places') ?></th> + <td colspan="3"><?lsmb PROCESS input element_data={ + name => 'decimalplaces', + size => '3', + value => '2', + } ?> + </td> + </tr> + </table> + </td> +</tr> +<tr> + <td> + <table> + <tr> + <th align="right"><?lsmb text('Method') ?></th> + <td colspan="3"> +<?lsmb PROCESS input element_data={ + name => 'method', + type => 'radio', + value => 'accrual', + label => text('Accrual'), + checked => 'checked', + } -?> +<?lsmb PROCESS input element_data={ + name => 'method', + type => 'radio', + value => 'cash', + label => text('Cash'), + } -?> + </td> + </tr> + <tr> + <th align="right"><?lsmb text('Include in Report') ?></th> + <td colspan="3"> +<?lsmb PROCESS input element_data={ + name => 'l_heading', + type => 'checkbox', + value => 'Y', + label => text('Heading'), + } -?> +<?lsmb PROCESS input element_data={ + name => 'l_subtotal', + type => 'checkbox', + value => 'Y', + label => text('Subtotal'), + } -?> +<?lsmb PROCESS input element_data={ + name => 'l_accno', + type => 'checkbox', + value => 'Y', + label => text('Account Number'), + } -?> + </td> + </tr> diff --git a/UI/rp-search-generate_tax_report.html b/UI/rp-search-generate_tax_report.html new file mode 100644 index 00000000..2323acd6 --- /dev/null +++ b/UI/rp-search-generate_tax_report.html @@ -0,0 +1,199 @@ + <tr> + <th align="right"><?lsmb text('From') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'fromdate', + size => '11', + title => user.dateformat, + value => form.fromdate, + } ?></td> + <th align="right"><?lsmb text('To') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'todate', + size => '11', + title => user.dateformat, + value => form.todate, + } ?></td> + </tr> +<?lsmb IF form.selectaccountingyear.defined ?> + <tr> + <th align="right"><?lsmb text('Period') ?></th> + <td colspan="3"> + <?lsmb PROCESS select element_data=form.selectaccountingmonth -?> + <?lsmb PROCESS select element_data=form.selectaccountingyear -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '0', + label => text('Current'), + checked => 'checked', + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '1', + label => text('Month'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '3', + label => text('Quarter'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '12', + label => text('Year'), + } -?> + </td> + </tr> +<?lsmb END ?> + <tr> + <th></th> + <td> +<?lsmb PROCESS input element_data={ + type => 'radio', + name => 'summary', + value => '1', + label => text('Summary'), + checked => 'checked', + } -?> +<?lsmb PROCESS input element_data={ + type => 'radio', + name => 'summary', + value => '0', + label => text('Detail'), + } -?> + </td> + </tr> +<?lsmb IF form.report.matches('^tax_') ?> + <tr> + <th align="right"><?lsmb text('Report for') ?></th> + <td colspan="3"> + <?lsmb FOREACH account IN form.taxaccountlist; + PROCESS input element_data=account; + END -?> + </td> + </tr> + <?lsmb IF form.gifitaxaccountlist.defined -?> + <tr> + <th align="right"><?lsmb text('GIFI') ?></th> + <td colspan="3"> + <?lsmb FOREACH account IN form.gifitaxaccountlist; + PROCESS input element_data=account; + END -?> + </td> + </tr> + <?lsmb END -?> +<?lsmb END -?> + <tr> + <th align="right"><?lsmb text('Method') ?></th> + <td colspan="3"> +<?lsmb PROCESS input element_data={ + name => 'method', + type => 'radio', + value => 'accrual', + label => text('Accrual'), + checked => 'checked', + } -?> +<?lsmb PROCESS input element_data={ + name => 'method', + type => 'radio', + value => 'cash', + label => text('Cash'), + } -?> + </td> + </tr> + </table> + </td> +</tr> +<tr> + <td> + <table> + <tr> + <th align="right"><?lsmb text('Include in Report') ?></th> + <td> +<?lsmb PROCESS input element_data={ + name => 'l_id', + type => 'checkbox', + value => 'Y', + } -?> + </td><td><?lsmb text('ID') ?></td> + <td> +<?lsmb PROCESS input element_data={ + name => 'l_invnumber', + type => 'checkbox', + value => 'Y', + checked => 'checked', + } -?> + </td><td><?lsmb text('Invoice') ?></td> + <td> +<?lsmb PROCESS input element_data={ + name => 'l_transdate', + type => 'checkbox', + value => 'Y', + checked => 'checked', + } -?> + </td><td><?lsmb text('Date') ?></td> + </tr> + <tr> + <td /> + <td> +<?lsmb PROCESS input element_data={ + name => 'l_name', + type => 'checkbox', + value => 'Y', + checked => 'checked', + } -?> + </td><td><?lsmb IF form.db == 'ar'; + text('Customer'); +ELSIF form.db == 'ap'; + text('Vendor'); +END ?></td> + <td> +<?lsmb PROCESS input element_data={ + name => 'l_description', + type => 'checkbox', + value => 'Y', + checked => 'checked', + } -?> + </td><td><?lsmb text('Description') ?></td> + <td> +<?lsmb PROCESS input element_data={ + name => 'l_netamount', + type => 'checkbox', + value => 'Y', + checked => 'checked', + } -?> + </td><td><?lsmb text('Amount') ?></td> +<?lsmb IF form.report.matches('^tax_') ?> + <td> + <?lsmb PROCESS input element_data={ + name => 'l_tax', + type => 'checkbox', + value => 'Y', + checked => 'checked', + } -?> + </td><td><?lsmb text('Tax') ?></td> + <td> + <?lsmb PROCESS input element_data={ + name => 'l_total', + type => 'checkbox', + value => 'Y', + checked => 'checked', + } -?> + </td><td><?lsmb text('Total') ?></td> + </tr> + <tr> + <td /> +<?lsmb END ?> + <td> +<?lsmb PROCESS input element_data={ + name => 'l_subtotal', + type => 'checkbox', + value => 'Y', + } -?> + </td><td><?lsmb text('Subtotal') ?></td> + </tr> diff --git a/UI/rp-search-generate_trial_balance.html b/UI/rp-search-generate_trial_balance.html new file mode 100644 index 00000000..db8c7c4b --- /dev/null +++ b/UI/rp-search-generate_trial_balance.html @@ -0,0 +1,81 @@ + <tr> + <th align="right"><?lsmb text('From') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'fromdate', + size => '11', + title => user.dateformat, + value => form.fromdate, + } ?></td> + <th align="right"><?lsmb text('To') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'todate', + size => '11', + title => user.dateformat, + value => form.todate, + } ?></td> + </tr> +<?lsmb IF form.selectaccountingyear.defined ?> + <tr> + <th align="right"><?lsmb text('Period') ?></th> + <td colspan="3"> + <?lsmb PROCESS select element_data=form.selectaccountingmonth -?> + <?lsmb PROCESS select element_data=form.selectaccountingyear -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '0', + label => text('Current'), + checked => 'checked', + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '1', + label => text('Month'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '3', + label => text('Quarter'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '12', + label => text('Year'), + } -?> + </td> + </tr> +<?lsmb END ?> + </table> + </td> +</tr> +<tr> + <td> + <table> + <tr> + <th align="right"><?lsmb text('Include in Report') ?></th> + <td colspan="3"> +<?lsmb PROCESS input element_data={ + name => 'l_heading', + type => 'checkbox', + value => 'Y', + label => text('Heading'), + } -?> +<?lsmb PROCESS input element_data={ + name => 'l_subtotal', + type => 'checkbox', + value => 'Y', + label => text('Subtotal'), + } -?> +<?lsmb PROCESS input element_data={ + name => 'all_accounts', + type => 'checkbox', + value => 'Y', + label => text('All Accounts'), + } -?> + </td> + </tr> diff --git a/UI/rp-search-income_statement.html b/UI/rp-search-income_statement.html new file mode 100644 index 00000000..3af19469 --- /dev/null +++ b/UI/rp-search-income_statement.html @@ -0,0 +1,147 @@ + <tr> + <th align="right"><?lsmb text('Project') ?></th> + <td colspan="3"><?lsmb PROCESS select element_data=form.selectproject ?></td> + </tr> + <tr> + <th align="right"><?lsmb text('From') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'fromdate', + size => '11', + title => user.dateformat, + value => form.fromdate, + } ?></td> + <th align="right"><?lsmb text('To') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'todate', + size => '11', + title => user.dateformat, + value => form.todate, + } ?></td> + </tr> +<?lsmb IF form.selectaccountingyear.defined ?> + <tr> + <th align="right"><?lsmb text('Period') ?></th> + <td colspan="3"> + <?lsmb PROCESS select element_data=form.selectaccountingmonth -?> + <?lsmb PROCESS select element_data=form.selectaccountingyear -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '0', + label => text('Current'), + checked => 'checked', + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '1', + label => text('Month'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '3', + label => text('Quarter'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '12', + label => text('Year'), + } -?> + </td> + </tr> +<?lsmb END ?> + <tr><th align="right"><?lsmb text('Compare to') ?></th><td colspan="3" /></tr> + <tr> + <th align="right"><?lsmb text('From') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'comparefromdate', + size => '11', + title => user.dateformat, + } ?></td> + <th align="right"><?lsmb text('To') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'comparetodate', + size => '11', + title => user.dateformat, + } ?></td> + </tr> +<?lsmb IF form.selectaccountingyear.defined; + compare_month = { + options => form.selectaccountingmonth.options, + name => 'comparemonth', + }; + compare_year = { + options => form.selectaccountingyear.options, + name => 'compareyear', + }; + -?> + <tr> + <th align="right"><?lsmb text('Period') ?></th> + <td colspan="3"> + <?lsmb PROCESS select element_data=compare_month -?> + <?lsmb PROCESS select element_data=compare_year -?> + </td> + </tr> +<?lsmb END ?> + <tr> + <th align="right"><?lsmb text('Decimal Places') ?></th> + <td colspan="3"><?lsmb PROCESS input element_data={ + name => 'decimalplaces', + size => '3', + value => '2', + } ?> + </td> + </tr> + </table> + </td> +</tr> +<tr> + <td> + <table> + <tr> + <th align="right"><?lsmb text('Method') ?></th> + <td colspan="3"> +<?lsmb PROCESS input element_data={ + name => 'method', + type => 'radio', + value => 'accrual', + label => text('Accrual'), + checked => 'checked', + } -?> +<?lsmb PROCESS input element_data={ + name => 'method', + type => 'radio', + value => 'cash', + label => text('Cash'), + } -?> + </td> + </tr> + <tr> + <th align="right"><?lsmb text('Include in Report') ?></th> + <td colspan="3"> +<?lsmb PROCESS input element_data={ + name => 'l_heading', + type => 'checkbox', + value => 'Y', + label => text('Heading'), + } -?> +<?lsmb PROCESS input element_data={ + name => 'l_subtotal', + type => 'checkbox', + value => 'Y', + label => text('Subtotal'), + } -?> +<?lsmb PROCESS input element_data={ + name => 'l_accno', + type => 'checkbox', + value => 'Y', + label => text('Account Number'), + } -?> + </td> + </tr> diff --git a/UI/rp-search-inv_activity.html b/UI/rp-search-inv_activity.html new file mode 100644 index 00000000..a6078eed --- /dev/null +++ b/UI/rp-search-inv_activity.html @@ -0,0 +1,60 @@ + <tr> + <th align="right"><?lsmb text('From') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'fromdate', + size => '11', + title => user.dateformat, + value => form.fromdate, + } ?></td> + <th align="right"><?lsmb text('To') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'todate', + size => '11', + title => user.dateformat, + value => form.todate, + } ?></td> + </tr> +<?lsmb IF form.selectaccountingyear.defined ?> + <tr> + <th align="right"><?lsmb text('Period') ?></th> + <td colspan="3"> + <?lsmb PROCESS select element_data=form.selectaccountingmonth -?> + <?lsmb PROCESS select element_data=form.selectaccountingyear -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '0', + label => text('Current'), + checked => 'checked', + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '1', + label => text('Month'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '3', + label => text('Quarter'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '12', + label => text('Year'), + } -?> + </td> + </tr> +<?lsmb END ?> + </table> + <table> + <tr> + <th><?lsmb text('Part Number') ?></th> + <td><?lsmb PROCESS input element_data={name => 'partnumber'} ?></td> + <th><?lsmb text('Description') ?></th> + <td><?lsmb PROCESS input element_data={name => 'description'} ?></td> + </tr> diff --git a/UI/rp-search-payments.html b/UI/rp-search-payments.html new file mode 100644 index 00000000..54a3ca0b --- /dev/null +++ b/UI/rp-search-payments.html @@ -0,0 +1,95 @@ + <tr> + <th align="right"><?lsmb text('Account') ?></th> + <td colspan="3"><?lsmb PROCESS select element_data=form.paymentaccounts ?></td> + </tr> + <tr> + <th align="right"><?lsmb text('Description') ?></th> + <td colspan="3"><?lsmb PROCESS input element_data={ + name => 'description', + size => '35', + } ?></td> + </tr> + <tr> + <th align="right"><?lsmb text('Source') ?></th> + <td colspan="3"><?lsmb PROCESS input element_data={name => 'source'} ?></td> + </tr> + <tr> + <th align="right"><?lsmb text('Memo') ?></th> + <td colspan="3"><?lsmb PROCESS input element_data={ + name => 'memo', + size => '30', + } ?></td> + </tr> + <tr> + <th align="right"><?lsmb text('From') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'fromdate', + size => '11', + title => user.dateformat, + value => form.fromdate, + } ?></td> + <th align="right"><?lsmb text('To') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'todate', + size => '11', + title => user.dateformat, + value => form.todate, + } ?></td> + </tr> +<?lsmb IF form.selectaccountingyear.defined ?> + <tr> + <th align="right"><?lsmb text('Period') ?></th> + <td colspan="3"> + <?lsmb PROCESS select element_data=form.selectaccountingmonth -?> + <?lsmb PROCESS select element_data=form.selectaccountingyear -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '0', + label => text('Current'), + checked => 'checked', + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '1', + label => text('Month'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '3', + label => text('Quarter'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '12', + label => text('Year'), + } -?> + </td> + </tr> +<?lsmb END ?> + <tr> + <td align="right"> +<?lsmb PROCESS input element_data={ + type => 'checkbox', + name => 'fx_transaction', + value => '1', + checked => 'checked', + } -?> + </td> + <td colspan="3"><?lsmb text('Include Exchange Rate Difference') ?></td> + </tr> + <tr> + <td align="right"> +<?lsmb PROCESS input element_data={ + type => 'checkbox', + name => 'l_subtotal', + value => 'Y', + } -?> + </td> + <td colspan="3"><?lsmb text('Subtotal') ?></td> + </tr> diff --git a/UI/rp-search-projects.html b/UI/rp-search-projects.html new file mode 100644 index 00000000..40ce0c32 --- /dev/null +++ b/UI/rp-search-projects.html @@ -0,0 +1,79 @@ + <tr> + <th align="right"><?lsmb text('Project') ?></th> + <td colspan="3"><?lsmb PROCESS select element_data=form.selectproject ?></td> + </tr> + <tr> + <th align="right"><?lsmb text('From') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'fromdate', + size => '11', + title => user.dateformat, + value => form.fromdate, + } ?></td> + <th align="right"><?lsmb text('To') ?></th> + <td><?lsmb PROCESS input element_data={ + class => 'date', + name => 'todate', + size => '11', + title => user.dateformat, + value => form.todate, + } ?></td> + </tr> +<?lsmb IF form.selectaccountingyear.defined ?> + <tr> + <th align="right"><?lsmb text('Period') ?></th> + <td colspan="3"> + <?lsmb PROCESS select element_data=form.selectaccountingmonth -?> + <?lsmb PROCESS select element_data=form.selectaccountingyear -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '0', + label => text('Current'), + checked => 'checked', + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '1', + label => text('Month'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '3', + label => text('Quarter'), + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'interval', + value => '12', + label => text('Year'), + } -?> + </td> + </tr> +<?lsmb END ?> + </table> + </td> +</tr> +<tr> + <td> + <table> + <tr> + <th align="right"><?lsmb text('Include in Report') ?></th> + <td> +<?lsmb PROCESS input element_data={ + name => 'l_heading', + type => 'checkbox', + value => 'Y', + label => text('Heading'), + } -?> +<?lsmb PROCESS input element_data={ + name => 'l_subtotal', + type => 'checkbox', + value => 'Y', + label => text('Subtotal'), + } -?> + </td> + </tr> diff --git a/UI/rp-search.html b/UI/rp-search.html new file mode 100644 index 00000000..097319dd --- /dev/null +++ b/UI/rp-search.html @@ -0,0 +1,53 @@ +<?lsmb INCLUDE 'ui-header.html' ?> +<?lsmb PROCESS elements.html ?> +<body> +<form method="post" action="<?lsmb form.script ?>"> +<table width="100%"> + <tr><th class="listtop"><?lsmb form.title ?></th></tr> + <tr><td> </td></tr> + <tr> + <td> + <table> +<?lsmb IF form.selectdepartment.defined ?> + <tr> + <th align="right"><?lsmb text('Department') ?></th> + <td colspan="3"><?lsmb PROCESS select element_data=form.selectdepartment ?></td> + </tr> +<?lsmb END ?> +<?lsmb INCLUDE "rp-search-${subform}.html" ?> +<?lsmb IF gifi ?> + <tr> + <th align="right"><?lsmb text('Accounts') ?></th> + <td> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'accounttype', + value => 'standard', + label => text('Standard'), + checked => 'checked', + } -?> + <?lsmb PROCESS input element_data={ + type => 'radio', + name => 'accounttype', + value => 'gifi', + label => text('GIFI'), + } -?> + </td> + </tr> +<?lsmb END ?> + </table> + </td> + </tr> + <tr><td><hr size="3" noshade="noshade" /></td></tr> +</table> +<br /> +<?lsmb FOREACH hidden IN hiddens.keys; + PROCESS input element_data={ + type => 'hidden', + name => hidden, + value => hiddens.item(hidden) + }; END ?> +<?lsmb FOREACH button IN buttons; PROCESS button element_data=button; END ?> +</form> +</body> +</html> @@ -96,7 +96,8 @@ use LedgerSMB::RP; sub report { - %report = ( + my %hiddens; + my %report = ( balance_sheet => { title => 'Balance Sheet' }, income_statement => { title => 'Income Statement' }, trial_balance => { title => 'Trial Balance' }, @@ -114,751 +115,224 @@ sub report { $form->{title} = $locale->text( $report{ $form->{report} }->{title} ); - $gifi = qq| -<tr> - <th align=right>| . $locale->text('Accounts') . qq|</th> - <td><input name=accounttype class=radio type=radio value=standard checked> | - . $locale->text('Standard') . qq| - - <input name=accounttype class=radio type=radio value=gifi> | - . $locale->text('GIFI') . qq| - </td> -</tr> -|; + my $gifi = 1; # get departments - $form->all_departments( \%myconfig, undef, - $report{ $form->{report} }->{vc} ); - if ( @{ $form->{all_department} } ) { - $form->{selectdepartment} = "<option>\n"; - - for ( @{ $form->{all_department} } ) { - $form->{selectdepartment} .= -qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|; - } + $form->all_departments(\%myconfig, undef, $report{$form->{report}}->{vc}); + if ( ref $form->{all_department} eq 'ARRAY' ) { + $form->{selectdepartment} = { + name => 'department', + options => [{value => '', text => ''}], + }; + push @{$form->{selectdepartment}{options}}, { + value => "$_->{description}--$_->{id}", + text => $_->{description}, + } foreach @{$form->{all_department}}; } - $department = qq| - <tr> - <th align=right nowrap>| . $locale->text('Department') . qq|</th> - <td colspan=3><select name=department>$form->{selectdepartment}</select></td> - </tr> -| if $form->{selectdepartment}; - - if ( @{ $form->{all_years} } ) { + if (ref $form->{all_years} eq 'ARRAY') { # accounting years - $form->{selectaccountingyear} = "<option>\n"; - for ( @{ $form->{all_years} } ) { - $form->{selectaccountingyear} .= qq|<option>$_\n|; - } - - $form->{selectaccountingmonth} = "<option>\n"; - for ( sort keys %{ $form->{all_month} } ) { - $form->{selectaccountingmonth} .= - qq|<option value=$_>| - . $locale->text( $form->{all_month}{$_} ) . qq|\n|; - } - - $selectfrom = qq| - <tr> - <th align=right>| . $locale->text('Period') . qq|</th> - <td colspan=3> - <select name=month>$form->{selectaccountingmonth}</select> - <select name=year>$form->{selectaccountingyear}</select> - <input name=interval class=radio type=radio value=0 checked> | - . $locale->text('Current') . qq| - <input name=interval class=radio type=radio value=1> | - . $locale->text('Month') . qq| - <input name=interval class=radio type=radio value=3> | - . $locale->text('Quarter') . qq| - <input name=interval class=radio type=radio value=12> | - . $locale->text('Year') . qq| - </td> - </tr> -|; - - $selectto = qq| - <tr> - <th align=right></th> - <td> - <select name=month>$form->{selectaccountingmonth}</select> - <select name=year>$form->{selectaccountingyear}</select> - </td> - </tr> -|; - } - - $summary = qq| - <tr> - <th></th> - <td><input name=summary type=radio class=radio value=1 checked> | - . $locale->text('Summary') . qq| - <input name=summary type=radio class=radio value=0> | - . $locale->text('Detail') . qq| - </td> - </tr> -|; + $form->{selectaccountingyear} = { + name => 'year', + options => [{text => '', value => ''}], + }; + push @{$form->{selectaccountingyear}{options}}, { + text => $_, + value => $_, + } foreach ( @{ $form->{all_years} } ); + + $form->{selectaccountingmonth} = { + name => 'month', + options => [{text => '', value => ''}], + }; + push @{$form->{selectaccountingmonth}{options}}, { + text => $locale->text( $form->{all_month}{$_} ), + value => $_, + } foreach ( sort keys %{ $form->{all_month} } ); + } # get projects $form->all_projects( \%myconfig ); - if ( @{ $form->{all_project} } ) { - $form->{selectproject} = "<option>\n"; - for ( @{ $form->{all_project} } ) { - $form->{selectproject} .= -qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n|; - } - - $project = qq| - <tr> - <th align=right nowrap>| . $locale->text('Project') . qq|</th> - <td colspan=3><select name=projectnumber>$form->{selectproject}</select></td> - </tr>|; - + if (ref $form->{all_project} eq 'ARRAY') { + $form->{selectproject} = { + name => 'projectnumber', + options => [{text => '', value => ''}], + }; + push @{$form->{selectproject}{options}}, { + text => $_->{projectnumber}, + value => "$_->{projectnumber}--$_->{id}", + } foreach ( @{ $form->{all_project} } ); } - $form->header; - - print qq| -<body> - -<form method=post action=$form->{script}> - -<input type=hidden name=title value="$form->{title}"> - -<table width=100%> - <tr> - <th class=listtop>$form->{title}</th> - </tr> - <tr height="5"></tr> - <tr> - <td> - <table> - $department -|; + $hiddens{title} = $form->{title}; + my $subform; if ( $form->{report} eq "projects" ) { - print qq| - $project - <input type=hidden name=nextsub value=generate_projects> - <tr> - <th align=right>| . $locale->text('From') . qq|</th> - <td><input class="date" name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td> - <th align=right>| . $locale->text('To') . qq|</th> - <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td> - </tr> - $selectfrom - </table> - </td> - </tr> - <tr> - <td> - <table> - <tr> - <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th> - <td><input name=l_heading class=checkbox type=checkbox value=Y> | - . $locale->text('Heading') . qq| - <input name=l_subtotal class=checkbox type=checkbox value=Y> | - . $locale->text('Subtotal') - . qq|</td> - </tr> -|; - } - - if ( $form->{report} eq "inv_activity" ) { - $gifi = ''; - print qq| - <input type=hidden name=nextsub value=generate_inv_activity> - <tr> - <th align=right>| . $locale->text('From') . qq|</th> - <td><input class="date" name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td> - <th align=right>| . $locale->text('To') . qq|</th> - <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td> - </tr> - <tr> - <th align=right>| . $locale->text('Period') . qq|</th> - <td colspan=3> - <select name=frommonth>$form->{selectaccountingmonth}</select> - <select name=fromyear>$form->{selectaccountingyear}</select> - <input name=interval class=radio type=radio value=0 checked>| - . $locale->text('Current') . qq| - <input name=interval class=radio type=radio value=1>| - . $locale->text('Month') . qq| - <input name=interval class=radio type=radio value=3>| - . $locale->text('Quarter') . qq| - <input name=interval class=radio type=radio value=12>| - . $locale->text('Year') . qq| - </td> - </tr> - </table> - <table> - <tr> - <th>| . $locale->text("Part Number") . qq|</th> - <td><input name=partnumber></td> - <th>| . $locale->text('Description') . qq|</th> - <td><input type=text name=description></td> - </tr>|; - } - if ( $form->{report} eq "income_statement" ) { - print qq| - $project - <input type=hidden name=nextsub value=generate_income_statement> - <tr> - <th align=right>| . $locale->text('From') . qq|</th> - <td><input class="date" name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td> - <th align=right>| . $locale->text('To') . qq|</th> - <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td> - </tr> -|; - - if ($selectfrom) { - print qq| - <tr> - <th align=right>| . $locale->text('Period') . qq|</th> - <td colspan=3> - <select name=frommonth>$form->{selectaccountingmonth}</select> - <select name=fromyear>$form->{selectaccountingyear}</select> - <input name=interval class=radio type=radio value=0 checked> | - . $locale->text('Current') . qq| - <input name=interval class=radio type=radio value=1> | - . $locale->text('Month') . qq| - <input name=interval class=radio type=radio value=3> | - . $locale->text('Quarter') . qq| - <input name=interval class=radio type=radio value=12> | - . $locale->text('Year') . qq| - </td> - </tr> -|; - } - - print qq| - - <tr> - <th align=right>| . $locale->text('Compare to') . qq|</th> - </tr> - <tr> - <th align=right>| . $locale->text('From') . qq|</th> - <td><input class="date" name=comparefromdate size=11 title="$myconfig{dateformat}"></td> - <th align=right>| . $locale->text('To') . qq|</th> - <td><input class="date" name=comparetodate size=11 title="$myconfig{dateformat}"></td> - </tr> -|; - - if ($selectto) { - print qq| - <tr> - <th align=right>| . $locale->text('Period') . qq|</th> - <td> - <select name=comparemonth>$form->{selectaccountingmonth}</select> - <select name=compareyear>$form->{selectaccountingyear}</select> - </td> - </tr> -|; - } - - print qq| - <tr> - <th align=right>| . $locale->text('Decimalplaces') . qq|</th> - <td><input name=decimalplaces size=3 value=2></td> - </tr> - </table> - </td> - </tr> - <tr> - <td> - <table> - <tr> - <th align=right>| . $locale->text('Method') . qq|</th> - <td colspan=3><input name=method class=radio type=radio value=accrual checked>| - . $locale->text('Accrual') . qq| - <input name=method class=radio type=radio value=cash>| - . $locale->text('Cash') - . qq|</td> - </tr> - - <tr> - <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th> - <td colspan=3><input name=l_heading class=checkbox type=checkbox value=Y> | - . $locale->text('Heading') . qq| - <input name=l_subtotal class=checkbox type=checkbox value=Y> | - . $locale->text('Subtotal') . qq| - <input name=l_accno class=checkbox type=checkbox value=Y> | - . $locale->text('Account Number') - . qq|</td> - </tr> -|; - } - - if ( $form->{report} eq "balance_sheet" ) { - print qq| - <input type=hidden name=nextsub value=generate_balance_sheet> - <tr> - <th align=right>| . $locale->text('as at') . qq|</th> - <td><input class="date" name=asofdate size=11 title="$myconfig{dateformat}" value=$form->{asofdate}></td> -|; - - if ($selectfrom) { - print qq| - <td> - <select name=asofmonth>$form->{selectaccountingmonth}</select> - <select name=asofyear>$form->{selectaccountingyear}</select> - </td> -|; - } - - print qq| - </tr> - - <th align=right nowrap>| . $locale->text('Compare to') . qq|</th> - <td><input class="date" name=compareasofdate size=11 title="$myconfig{dateformat}"></td> - <td> -|; - - if ($selectto) { - print qq| - <select name=compareasofmonth>$form->{selectaccountingmonth}</select> - <select name=compareasofyear>$form->{selectaccountingyear}</select> - </td> -|; - } - - print qq| - </tr> - <tr> - <th align=right>| . $locale->text('Decimalplaces') . qq|</th> - <td><input name=decimalplaces size=3 value=2></td> - </tr> - </table> - </td> - </tr> - <tr> - <td> - <table> - <tr> - <th align=right>| . $locale->text('Method') . qq|</th> - <td colspan=3><input name=method class=radio type=radio value=accrual checked>| - . $locale->text('Accrual') . qq| - <input name=method class=radio type=radio value=cash>| - . $locale->text('Cash') - . qq|</td> - </tr> - - <tr> - <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th> - <td><input name=l_heading class=checkbox type=checkbox value=Y> | - . $locale->text('Heading') . qq| - <input name=l_subtotal class=checkbox type=checkbox value=Y> | - . $locale->text('Subtotal') . qq| - <input name=l_accno class=checkbox type=checkbox value=Y> | - . $locale->text('Account Number') - . qq|</td> - </tr> -|; - } - - if ( $form->{report} eq "trial_balance" ) { - print qq| - <input type=hidden name=nextsub value=generate_trial_balance> - <tr> - <th align=right>| . $locale->text('From') . qq|</th> - <td><input class="date" name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td> - <th align=right>| . $locale->text('To') . qq|</th> - <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td> - </tr> - $selectfrom - </table> - </td> - </tr> - <tr> - <td> - <table> - <tr> - <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th> - <td><input name=l_heading class=checkbox type=checkbox value=Y> | - . $locale->text('Heading') . qq| - <input name=l_subtotal class=checkbox type=checkbox value=Y> | - . $locale->text('Subtotal') . qq| - <input name=all_accounts class=checkbox type=checkbox value=Y> | - . $locale->text('All Accounts') - . qq|</td> - </tr> -|; - } - - if ( $form->{report} =~ /^tax_/ ) { - $gifi = ""; + $hiddens{nextsub} = 'generate_projects'; + $subform = 'generate_projects'; + } elsif ( $form->{report} eq "inv_activity" ) { + $gifi = 0; + $hiddens{nextsub} = 'generate_inv_activity'; + $subform = 'generate_inv_activity'; + } elsif ( $form->{report} eq "income_statement" ) { + $hiddens{nextsub} = 'generate_income_statement'; + $subform = 'generate_income_statement'; + } elsif ( $form->{report} eq "balance_sheet" ) { + $hiddens{nextsub} = 'generate_balance_sheet'; + $subform = 'generate_balance_sheet'; + } elsif ( $form->{report} eq "trial_balance" ) { + $hiddens{nextsub} = 'generate_trial_balance'; + $subform = 'generate_trial_balance'; + } elsif ( $form->{report} =~ /^tax_/ ) { + $gifi = 0; $form->{db} = ( $form->{report} =~ /_collected/ ) ? "ar" : "ap"; RP->get_taxaccounts( \%myconfig, \%$form ); - print qq| - <input type=hidden name=nextsub value=generate_tax_report> - <tr> - <th align=right>| . $locale->text('From') . qq|</th> - <td><input class="date" name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td> - <th align=right>| . $locale->text('To') . qq|</th> - <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td> - </tr> - $selectfrom - $summary - <tr> - <th align=right>| . $locale->text('Report for') . qq|</th> - <td colspan=3> -|; - - $checked = "checked"; - foreach $ref ( @{ $form->{taxaccounts} } ) { - - print -qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description} - - <input name="$ref->{accno}_description" type=hidden value="$ref->{description}"> - <input name="$ref->{accno}_rate" type=hidden value="$ref->{rate}">|; - - $checked = ""; + $hiddens{nextsub} = 'generate_tax_report'; + $hiddens{db} = $form->{db}; + $hiddens{sort} = 'transdate'; + $subform = 'generate_tax_report'; + my $checked = "checked"; + $form->{taxaccountlist} = []; + foreach $ref ( @{ $form->{taxaccounts} } ) { + push @{$form->{taxaccountlist}}, { + name => 'accno', + type => 'radio', + value => $ref->{accno}, + label => $ref->{description}, + $checked => $checked, + }; + $hiddens{"$ref->{accno}_description"} = $ref->{description}; + $hiddens{"$ref->{accno}_rate"} = $ref->{rate}; + $checked = undef; } - print qq| - <input type=hidden name=db value=$form->{db}> - <input type=hidden name=sort value=transdate> - - </td> - </tr> -|; - - if ( @{ $form->{gifi_taxaccounts} } ) { - print qq| - <tr> - <th align=right>| . $locale->text('GIFI') . qq|</th> - <td colspan=3> -|; - + if (ref $form->{gifi_taxaccounts} eq 'ARRAY') { + $form->{gifitaxaccountlist} = []; foreach $ref ( @{ $form->{gifi_taxaccounts} } ) { - - print -qq|<input name=accno class=radio type=radio value="gifi_$ref->{accno}"> $ref->{description} - - <input name="gifi_$ref->{accno}_description" type=hidden value="$ref->{description}"> - <input name="gifi_$ref->{accno}_rate" type=hidden value="$ref->{rate}">|; - + push @{$form->{taxaccountlist}}, { + name => 'accno', + type => 'radio', + value => "gifi_$ref->{accno}", + label => $ref->{description}, + }; + $hiddens{"gifi_$ref->{accno}_description"} = $ref->{description}; + $hiddens{"gifi_$ref->{accno}_rate"} = $ref->{rate}; } - - print qq| - </td> - </tr> -|; - } - - print qq| - <tr> - <th align=right>| . $locale->text('Method') . qq|</th> - <td colspan=3><input name=method class=radio type=radio value=accrual checked>| - . $locale->text('Accrual') . qq| - <input name=method class=radio type=radio value=cash>| - . $locale->text('Cash') - . qq|</td> - </tr> - </table> - </td> - </tr> - <tr> - <td> - <table> - <tr> - <th align=right>| . $locale->text('Include in Report') . qq|</th> - <td> - <table> - <tr> - <td><input name="l_id" class=checkbox type=checkbox value=Y></td> - <td>| . $locale->text('ID') . qq|</td> - <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Invoice') . qq|</td> - <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Date') . qq|</td> - </tr> - <tr> - <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td> -|; - - if ( $form->{db} eq 'ar' ) { - print qq|<td>| . $locale->text('Customer') . qq|</td>|; } - if ( $form->{db} eq 'ap' ) { - print qq|<td>| . $locale->text('Vendor') . qq|</td>|; - } - - print qq| - <td><input name="l_description" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Description') . qq|</td> - <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Amount') . qq|</td> - - <td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Tax') . qq|</td> - - <td><input name="l_total" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Total') . qq|</td> - </tr> - <tr> - </tr> - <tr> - <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td> - <td>| . $locale->text('Subtotal') . qq|</td> - </tr> - </table> - </td> - </tr> -|; - - } - - if ( $form->{report} =~ /^nontaxable_/ ) { - $gifi = ""; + } elsif ( $form->{report} =~ /^nontaxable_/ ) { + $gifi = 0; $form->{db} = ( $form->{report} =~ /_sales/ ) ? "ar" : "ap"; - - print qq| - <input type=hidden name=nextsub value=generate_tax_report> - - <input type=hidden name=db value=$form->{db}> - <input type=hidden name=sort value=transdate> - <input type=hidden name=report value=$form->{report}> - - <tr> - <th align=right>| . $locale->text('From') . qq|</th> - <td><input class="date" name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td> - <th align=right>| . $locale->text('To') . qq|</th> - <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td> - </tr> - $selectfrom - $summary - <tr> - <th align=right>| . $locale->text('Method') . qq|</th> - <td colspan=3><input name=method class=radio type=radio value=accrual checked>| - . $locale->text('Accrual') . qq| - <input name=method class=radio type=radio value=cash>| - . $locale->text('Cash') - . qq|</td> - </tr> - <tr> - <th align=right>| . $locale->text('Include in Report') . qq|</th> - <td colspan=3> - <table> - <tr> - <td><input name="l_id" class=checkbox type=checkbox value=Y></td> - <td>| . $locale->text('ID') . qq|</td> - <td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Invoice') . qq|</td> - <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Date') . qq|</td> - </tr> - <tr> - <td><input name="l_name" class=checkbox type=checkbox value=Y checked></td> -|; - - if ( $form->{db} eq 'ar' ) { - print qq|<td>| . $locale->text('Customer') . qq|</td>|; - } - if ( $form->{db} eq 'ap' ) { - print qq|<td>| . $locale->text('Vendor') . qq|</td>|; - } - - print qq| - <td><input name="l_description" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Description') . qq|</td> - <td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td> - <td>| . $locale->text('Amount') . qq|</td> - </tr> - <tr> - <td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td> - <td>| . $locale->text('Subtotal') . qq|</td> - </tr> - </table> - </td> - </tr> -|; - - } - - if ( ( $form->{report} eq "ar_aging" ) - || ( $form->{report} eq "ap_aging" ) ) - { - $gifi = ""; + $hiddens{nextsub} = 'generate_tax_report'; + $hiddens{db} = $form->{db}; + $hiddens{sort} = 'transdate'; + $hiddens{report} = $form->{report}; + $subform = 'generate_tax_report'; + } elsif ( ( $form->{report} eq "ar_aging" ) + || ( $form->{report} eq "ap_aging" ) ) { + $gifi = 0; + $subform = 'aging'; if ( $form->{report} eq 'ar_aging' ) { $label = $locale->text('Customer'); $form->{vc} = 'customer'; + $form->{uvc} = 'Customer'; } else { $label = $locale->text('Vendor'); $form->{vc} = 'vendor'; + $form->{uvc} = 'Vendor'; } - $nextsub = "generate_$form->{report}"; - # setup vc selection $form->all_vc( \%myconfig, $form->{vc}, ( $form->{vc} eq 'customer' ) ? "AR" : "AP" ); - for ( @{ $form->{"all_$form->{vc}"} } ) { - $vc .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n|; + my $vc; + if (ref $form->{"all_$form->{vc}"} eq 'ARRAY') { + $vc = {name => $form->{vc}, options => [{text => '', value => ''}]}; + for ( @{ $form->{"all_$form->{vc}"} } ) { + push @{$vc->{options}}, { + text => "$_->{name}", + value => "$_->{name}--$_->{id}", + }; + } + $form->{vci} = {type => 'select', input => $vc}; + } else { + $vc = {name => $form->{vc}, size => 35}; + $form->{vci} = {type => 'input', input => $vc}; } - $vc = - ($vc) - ? qq|<select name=$form->{vc}><option>\n$vc</select>| - : qq|<input name=$form->{vc} size=35>|; - - $postscript = "ps" if $myconfig{printer}; - - print qq| - <tr> - <th align=right>| . $locale->text($label) . qq|</th> - <td>$vc</td> - </tr> - <tr> - <th align=right>| . $locale->text('To') . qq|</th> - <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td> - </tr> - $selectto - <input type=hidden name=type value=statement> - <input type=hidden name=format value=$postscript> - <input type=hidden name=media value="$myconfig{printer}"> - - <input type=hidden name=nextsub value=$nextsub> - <input type=hidden name=action value=$nextsub> - $summary - <tr> - <table> - <tr> - <th>| . $locale->text('Include in Report') . qq|</th> - - <td> - <table> - <tr> - <td nowrap><input name=overdue type=radio class=radio value=0 checked> | - . $locale->text('Aged') - . qq|</td> - <td nowrap><input name=overdue type=radio class=radio value=1> | - . $locale->text('Overdue') - . qq|</td> - </tr> - <tr> - <td nowrap width=70><input name=c0 type=checkbox class=checkbox value=1 checked> | - . $locale->text('Current') - . qq|</td> - <td nowrap width=70><input name=c30 type=checkbox class=checkbox value=1 checked> 30</td> - <td nowrap width=70><input name=c60 type=checkbox class=checkbox value=1 checked> 60</td> - <td nowrap width=70><input name=c90 type=checkbox class=checkbox value=1 checked> 90</td> - </td> - </tr> - </table> - </td> - </tr> - </table> - </tr> - -|; - } - - # above action can be removed if there is more than one input field - - if ( $form->{report} =~ /(receipts|payments)$/ ) { - $gifi = ""; + $hiddens{type} = 'statement'; + $hiddens{format} = 'ps' if $myconfig{printer}; + $hiddens{media} = $myconfig{printer}; + + my $nextsub = "generate_$form->{report}"; + $hiddens{nextsub} = $nextsub; + $hiddens{action} = $nextsub; + } elsif ( $form->{report} =~ /(receipts|payments)$/ ) { + $gifi = 0; + $subform = 'payments'; $form->{db} = ( $form->{report} =~ /payments$/ ) ? "ap" : "ar"; RP->paymentaccounts( \%myconfig, \%$form ); - $selection = "<option>\n"; + my $paymentaccounts = ''; + $form->{paymentaccounts} = { + name => 'account', + options => [{text => '', value => ''}], + }; foreach $ref ( @{ $form->{PR} } ) { $paymentaccounts .= "$ref->{accno} "; - $selection .= "<option>$ref->{accno}--$ref->{description}\n"; + push @{$form->{paymentaccounts}{options}}, { + text => "$ref->{accno}--$ref->{description}", + value => "$ref->{accno}--$ref->{description}", + }; } chop $paymentaccounts; - print qq| - <input type=hidden name=nextsub value=list_payments> - <tr> - <th align=right nowrap>| . $locale->text('Account') . qq|</th> - <td colspan=3><select name=account>$selection</select> - <input type=hidden name=paymentaccounts value="$paymentaccounts"> - </td> - </tr> - <tr> - <th align=right nowrap>| . $locale->text('Description') . qq|</th> - <td colspan=3><input name=description size=35></td> - </tr> - <tr> - <th align=right nowrap>| . $locale->text('Source') . qq|</th> - <td colspan=3><input name=source></td> - </tr> - <tr> - <th align=right nowrap>| . $locale->text('Memo') . qq|</th> - <td colspan=3><input name=memo size=30></td> - </tr> - <tr> - <th align=right>| . $locale->text('From') . qq|</th> - <td><input class="date" name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td> - <th align=right>| . $locale->text('To') . qq|</th> - <td><input class="date" name=todate size=11 title="$myconfig{dateformat}"></td> - </tr> - $selectfrom - <tr> - <td align=right><input type=checkbox class=checkbox name=fx_transaction value=1 checked></td> - <td colspan=3>| - . $locale->text('Include Exchange Rate Difference') - . qq|</td> - </tr> - <tr> - <td align=right><input name=l_subtotal class=checkbox type=checkbox value=Y></td> - <td align=left colspan=3>| . $locale->text('Subtotal') . qq|</th> - </tr> - - <input type=hidden name=db value=$form->{db}> - <input type=hidden name=sort value=transdate> -|; + $hiddens{nextsub} = 'list_payments'; + $hiddens{paymentaccounts} = $paymentaccounts; + $hiddens{db} = $form->{db}; + $hiddens{sort} = 'transdate'; } $form->{login} = 'test'; - print qq| - -$gifi - - </table> - </td> - </tr> - <tr> - <td><hr size=3 noshade></td> - </tr> -</table> - -<br> -<input type="hidden" name="path" value="$form->{path}"> -<input type="hidden" name="login" value="$form->{login}"> -<input type="hidden" name="sessionid" value="$form->{sessionid}"> - -<button type="submit" class="submit" name="action" value="continue">| - . $locale->text('Continue') - . qq|</button> - -</form> -|; - - if ( $form->{lynx} ) { - require "bin/menu.pl"; - &menubar; - } + $hiddens{$_} = $form->{$_} foreach qw(path login sessionid); - print qq| +##SC: Temporary commenting +## if ( $form->{lynx} ) { +## require "bin/menu.pl"; +## &menubar; +## } -</body> -</html> -|; + my @buttons = ({ + name => 'action', + value => 'continue', + text => $locale->text('Continue'), + }); + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'rp-search', + ); + $template->render({ + user => \%myconfig, + form => $form, + subform => $subform, + hiddens => \%hiddens, + options => \@options, + buttons => \@buttons, + gifi => $gifi, + }); } |