web.
summaryrefslogtreecommitdiff
path: root/bin/mozilla/rp.pl
blob: 393f17eea15bc9bec78c7b10335cb7d2af7ea61d (plain)
  1. #=====================================================================
  2. # LedgerSMB Small Medium Business Accounting
  3. # http://www.ledgersmb.org/
  4. #
  5. # Copyright (C) 2006
  6. # This work contains copyrighted information from a number of sources all used
  7. # with permission.
  8. #
  9. # This file contains source code included with or based on SQL-Ledger which
  10. # is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
  11. # under the GNU General Public License version 2 or, at your option, any later
  12. # version. For a full list including contact information of contributors,
  13. # maintainers, and copyright holders, see the CONTRIBUTORS file.
  14. #
  15. # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
  16. # Copyright (c) 2001
  17. #
  18. # Author: DWS Systems Inc.
  19. # Web: http://www.sql-ledger.org
  20. #
  21. # Contributors: Antonio Gallardo <agssa@ibw.com.ni>
  22. # Benjamin Lee <benjaminlee@consultant.com>
  23. #
  24. #
  25. # This program is free software; you can redistribute it and/or modify
  26. # it under the terms of the GNU General Public License as published by
  27. # the Free Software Foundation; either version 2 of the License, or
  28. # (at your option) any later version.
  29. #
  30. # This program is distributed in the hope that it will be useful,
  31. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  32. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  33. # GNU General Public License for more details.
  34. # You should have received a copy of the GNU General Public License
  35. # along with this program; if not, write to the Free Software
  36. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  37. #======================================================================
  38. #
  39. # module for preparing Income Statement and Balance Sheet
  40. #
  41. #======================================================================
  42. require "$form->{path}/arap.pl";
  43. use LedgerSMB::PE;
  44. use LedgerSMB::RP;
  45. 1;
  46. # end of main
  47. # this is for our long dates
  48. # $locale->text('January')
  49. # $locale->text('February')
  50. # $locale->text('March')
  51. # $locale->text('April')
  52. # $locale->text('May ')
  53. # $locale->text('June')
  54. # $locale->text('July')
  55. # $locale->text('August')
  56. # $locale->text('September')
  57. # $locale->text('October')
  58. # $locale->text('November')
  59. # $locale->text('December')
  60. # this is for our short month
  61. # $locale->text('Jan')
  62. # $locale->text('Feb')
  63. # $locale->text('Mar')
  64. # $locale->text('Apr')
  65. # $locale->text('May')
  66. # $locale->text('Jun')
  67. # $locale->text('Jul')
  68. # $locale->text('Aug')
  69. # $locale->text('Sep')
  70. # $locale->text('Oct')
  71. # $locale->text('Nov')
  72. # $locale->text('Dec')
  73. # $locale->text('Balance Sheet')
  74. # $locale->text('Income Statement')
  75. # $locale->text('Trial Balance')
  76. # $locale->text('AR Aging')
  77. # $locale->text('AP Aging')
  78. # $locale->text('Tax collected')
  79. # $locale->text('Tax paid')
  80. # $locale->text('Receipts')
  81. # $locale->text('Payments')
  82. # $locale->text('Project Transactions')
  83. # $locale->text('Non-taxable Sales')
  84. # $locale->text('Non-taxable Purchases')
  85. sub report {
  86. %report = ( balance_sheet => { title => 'Balance Sheet' },
  87. income_statement => { title => 'Income Statement' },
  88. trial_balance => { title => 'Trial Balance' },
  89. ar_aging => { title => 'AR Aging', vc => 'customer' },
  90. ap_aging => { title => 'AP Aging', vc => 'vendor' },
  91. tax_collected => { title => 'Tax collected', vc => 'customer' },
  92. tax_paid => { title => 'Tax paid' },
  93. nontaxable_sales => { title => 'Non-taxable Sales', vc => 'customer' },
  94. nontaxable_purchases => { title => 'Non-taxable Purchases' },
  95. receipts => { title => 'Receipts', vc => 'customer' },
  96. payments => { title => 'Payments' },
  97. projects => { title => 'Project Transactions' },
  98. inv_activity => { title => 'Inventory Activity'},
  99. );
  100. $form->{title} = $locale->text($report{$form->{report}}->{title});
  101. $gifi = qq|
  102. <tr>
  103. <th align=right>|.$locale->text('Accounts').qq|</th>
  104. <td><input name=accounttype class=radio type=radio value=standard checked> |.$locale->text('Standard').qq|
  105. <input name=accounttype class=radio type=radio value=gifi> |.$locale->text('GIFI').qq|
  106. </td>
  107. </tr>
  108. |;
  109. # get departments
  110. $form->all_departments(\%myconfig, undef, $report{$form->{report}}->{vc});
  111. if (@{ $form->{all_department} }) {
  112. $form->{selectdepartment} = "<option>\n";
  113. for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
  114. }
  115. $department = qq|
  116. <tr>
  117. <th align=right nowrap>|.$locale->text('Department').qq|</th>
  118. <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
  119. </tr>
  120. | if $form->{selectdepartment};
  121. if (@{ $form->{all_years} }) {
  122. # accounting years
  123. $form->{selectaccountingyear} = "<option>\n";
  124. for (@{ $form->{all_years} }) { $form->{selectaccountingyear} .= qq|<option>$_\n| }
  125. $form->{selectaccountingmonth} = "<option>\n";
  126. for (sort keys %{ $form->{all_month} }) { $form->{selectaccountingmonth} .= qq|<option value=$_>|.$locale->text($form->{all_month}{$_}).qq|\n| }
  127. $selectfrom = qq|
  128. <tr>
  129. <th align=right>|.$locale->text('Period').qq|</th>
  130. <td colspan=3>
  131. <select name=month>$form->{selectaccountingmonth}</select>
  132. <select name=year>$form->{selectaccountingyear}</select>
  133. <input name=interval class=radio type=radio value=0 checked>&nbsp;|.$locale->text('Current').qq|
  134. <input name=interval class=radio type=radio value=1>&nbsp;|.$locale->text('Month').qq|
  135. <input name=interval class=radio type=radio value=3>&nbsp;|.$locale->text('Quarter').qq|
  136. <input name=interval class=radio type=radio value=12>&nbsp;|.$locale->text('Year').qq|
  137. </td>
  138. </tr>
  139. |;
  140. $selectto = qq|
  141. <tr>
  142. <th align=right></th>
  143. <td>
  144. <select name=month>$form->{selectaccountingmonth}</select>
  145. <select name=year>$form->{selectaccountingyear}</select>
  146. </td>
  147. </tr>
  148. |;
  149. }
  150. $summary = qq|
  151. <tr>
  152. <th></th>
  153. <td><input name=summary type=radio class=radio value=1 checked> |.$locale->text('Summary').qq|
  154. <input name=summary type=radio class=radio value=0> |.$locale->text('Detail').qq|
  155. </td>
  156. </tr>
  157. |;
  158. # get projects
  159. $form->all_projects(\%myconfig);
  160. if (@{ $form->{all_project} }) {
  161. $form->{selectproject} = "<option>\n";
  162. for (@{ $form->{all_project} }) { $form->{selectproject} .= qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n| }
  163. $project = qq|
  164. <tr>
  165. <th align=right nowrap>|.$locale->text('Project').qq|</th>
  166. <td colspan=3><select name=projectnumber>$form->{selectproject}</select></td>
  167. </tr>|;
  168. }
  169. $form->header;
  170. print qq|
  171. <body>
  172. <form method=post action=$form->{script}>
  173. <input type=hidden name=title value="$form->{title}">
  174. <table width=100%>
  175. <tr>
  176. <th class=listtop>$form->{title}</th>
  177. </tr>
  178. <tr height="5"></tr>
  179. <tr>
  180. <td>
  181. <table>
  182. $department
  183. |;
  184. if ($form->{report} eq "projects") {
  185. print qq|
  186. $project
  187. <input type=hidden name=nextsub value=generate_projects>
  188. <tr>
  189. <th align=right>|.$locale->text('From').qq|</th>
  190. <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
  191. <th align=right>|.$locale->text('To').qq|</th>
  192. <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
  193. </tr>
  194. $selectfrom
  195. </table>
  196. </td>
  197. </tr>
  198. <tr>
  199. <td>
  200. <table>
  201. <tr>
  202. <th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
  203. <td><input name=l_heading class=checkbox type=checkbox value=Y>&nbsp;|.$locale->text('Heading').qq|
  204. <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|.$locale->text('Subtotal').qq|</td>
  205. </tr>
  206. |;
  207. }
  208. if ($form->{report} eq "inv_activity"){
  209. $gifi = '';
  210. print qq|
  211. <input type=hidden name=nextsub value=generate_inv_activity>
  212. <tr>
  213. <th align=right>|.$locale->text('From').qq|</th>
  214. <td><input name=fromdate size=11 title="$myconfig{dateformat}" value=$form->{fromdate}></td>
  215. <th align=right>|.$locale->text('To').qq|</th>
  216. <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
  217. </tr>
  218. <tr>
  219. <th align=right>|.$locale->text('Period').qq|</th>
  220. <td colspan=3>
  221. <select name=frommonth>$form->{selectaccountingmonth}</select>
  222. <select name=fromyear>$form->{selectaccountingyear}</select>
  223. <input name=interval class=radio type=radio value=0 checked>|.$locale->text('Current').qq|