summaryrefslogtreecommitdiff
path: root/doc/templating
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-09-03 18:15:41 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-09-03 18:15:41 +0000
commit9b24d1041b7c8e96962d1aa95dd4efba39f912b2 (patch)
tree219d12b0d005eefd19b46e12e1be3f3b836a2a9f /doc/templating
parent26e09a22f9226776ed00998ad77712808c8fdb67 (diff)
Adding button to generate entity control code
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2310 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'doc/templating')
0 files changed, 0 insertions, 0 deletions
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.
  • #======================================================================
  • #
  • # Genereal Ledger
  • #
  • #======================================================================
  • use LedgerSMB::GL;
  • use LedgerSMB::PE;
  • require "bin/arap.pl";
  • 1;
  • # end of main
  • # this is for our long dates
  • # $locale->text('January')
  • # $locale->text('February')
  • # $locale->text('March')
  • # $locale->text('April')
  • # $locale->text('May ')
  • # $locale->text('June')
  • # $locale->text('July')
  • # $locale->text('August')
  • # $locale->text('September')
  • # $locale->text('October')
  • # $locale->text('November')
  • # $locale->text('December')
  • # this is for our short month
  • # $locale->text('Jan')
  • # $locale->text('Feb')
  • # $locale->text('Mar')
  • # $locale->text('Apr')
  • # $locale->text('May')
  • # $locale->text('Jun')
  • # $locale->text('Jul')
  • # $locale->text('Aug')
  • # $locale->text('Sep')
  • # $locale->text('Oct')
  • # $locale->text('Nov')
  • # $locale->text('Dec')
  • sub pos_adjust {
  • $form->{rowcount} = 3;
  • require "pos.conf.pl";
  • $form->{accno_1} = $pos_config{'close_cash_accno'};
  • $form->{accno_2} = $pos_config{'coa_prefix'};
  • $form->{accno_3} = $pos_config{'coa_prefix'};
  • }
  • sub add_pos_adjust {
  • $form->{pos_adjust} = 1;
  • $form->{reference} = $locale->text("Adjusting Till: (till) Source: (source)");
  • $form->{description} =
  • $locale->text("Adjusting till due to data entry error.");
  • $form->{callback} = "$form->{script}?action=add_pos_adjust&transfer=$form->{transfer}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
  • &add;
  • }
  • sub add {
  • $form->{title} = "Add";
  • $form->{callback} = "$form->{script}?action=add&transfer=$form->{transfer}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
  • &create_links;
  • $form->{rowcount} = ($form->{transfer}) ? 3 : 9;
  • if ($form->{pos_adjust}){
  • &pos_adjust;
  • }
  • $form->{oldtransdate} = $form->{transdate};
  • $form->{focus} = "reference";
  • # departments
  • if (@{ $form->{all_department} }) {
  • $form->{selectdepartment} = "<option>\n";
  • for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
  • }
  • &display_form(1);
  • }
  • sub edit {
  • &create_links;
  • $form->{locked} = ($form->{revtrans}) ? '1' : ($form->datetonum(\%myconfig, $form->{transdate}) <= $form->datetonum(\%myconfig, $form->{closedto}));
  • # readonly
  • if (! $form->{readonly}) {
  • $form->{readonly} = 1 if $myconfig{acs} =~ /General Ledger--Add Transaction/;
  • }
  • $form->{title} = "Edit";
  • $i = 1;
  • foreach $ref (@{ $form->{GL} }) {
  • $form->{"accno_$i"} = "$ref->{accno}--$ref->{description}";
  • $form->{"projectnumber_$i"} = "$ref->{projectnumber}--$ref->{project_id}";
  • for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} }
  • if ($ref->{amount} < 0) {
  • $form->{totaldebit} -= $ref->{amount};
  • $form->{"debit_$i"} = $ref->{amount} * -1;
  • } else {
  • $form->{totalcredit} += $ref->{amount};
  • $form->{"credit_$i"} = $ref->{amount};
  • }
  • $i++;
  • }
  • $form->{rowcount} = $i;
  • $form->{focus} = "debit_$i";
  • &form_header;
  • &display_rows;
  • &form_footer;
  • }
  • sub create_links {
  • GL->transaction(\%myconfig, \%$form);
  • for (@{ $form->{all_accno} }) { $form->{selectaccno} .= "<option>$_->{accno}--$_->{description}\n" }
  • # projects
  • if (@{ $form->{all_project} }) {
  • $form->{selectprojectnumber} = "<option>\n";
  • for (@{ $form->{all_project} }) { $form->{selectprojectnumber} .= qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n| }
  • }
  • # departments
  • if (@{ $form->{all_department} }) {
  • $form->{department} = "$form->{department}--$form->{department_id}";
  • $form->{selectdepartment} = "<option>\n";
  • for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
  • }
  • }
  • sub search {
  • $form->{title} = $locale->text('General Ledger Reports');
  • $colspan = 5;
  • $form->all_departments(\%myconfig);
  • # departments
  • if (@{ $form->{all_department} }) {
  • $form->{selectdepartment} = "<option>\n";
  • for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
  • $l_department = qq|<input name="l_department" class=checkbox type=checkbox value=Y> |.$locale->text('Department');
  • $department = qq|
  • <tr>
  • <th align=right nowrap>|.$locale->text('Department').qq|</th>
  • <td colspan=$colspan><select name=department>$form->{selectdepartment}</select></td>
  • </tr>
  • |;
  • }
  • if (@{ $form->{all_years} }) {
  • # 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=$colspan>
  • <select name=month>$form->{selectaccountingmonth}</select>
  • <select name=year>$form->{selectaccountingyear}</select>
  • <input name=interval class=radio type=radio value=0 checked>&nbsp;|.$locale->text('Current').qq|
  • <input name=interval class=radio type=radio value=1>&nbsp;|.$locale->text('Month').qq|
  • <input name=interval class=radio type=radio value=3>&nbsp;|.$locale->text('Quarter').qq|
  • <input name=interval class=radio type=radio value=12>&nbsp;|.$locale->text('Year').qq|
  • </td>
  • </tr>
  • |;
  • }
  • @a = ();
  • push @a, qq|<input name="l_id" class=checkbox type=checkbox value=Y> |.$locale->text('ID');
  • push @a, qq|<input name="l_transdate" class=checkbox type=checkbox value=Y checked> |.$locale->text('Date');
  • push @a, qq|<input name="l_reference" class=checkbox type=checkbox value=Y checked> |.$locale->text('Reference');
  • push @a, qq|<input name="l_description" class=checkbox type=checkbox value=Y checked> |.$locale->text('Description');
  • push @a, qq|<input name="l_notes" class=checkbox type=checkbox value=Y> |.$locale->text('Notes');
  • push @a, $l_department if $l_department;
  • push @a, qq|<input name="l_debit" class=checkbox type=checkbox value=Y checked> |.$locale->text('Debit');
  • push @a, qq|<input name="l_credit" class=checkbox type=checkbox value=Y checked> |.$locale->text('Credit');
  • push @a, qq|<input name="l_source" class=checkbox type=checkbox value=Y checked> |.$locale->text('Source');
  • push @a, qq|<input name="l_memo" class=checkbox type=checkbox value=Y> |.$locale->text('Memo');
  • push @a, qq|<input name="l_accno" class=checkbox type=checkbox value=Y checked> |.$locale->text('Account');
  • push @a, qq|<input name="l_gifi_accno" class=checkbox type=checkbox value=Y> |.$locale->text('GIFI');
  • $form->header;
  • print qq|
  • <body>
  • <form method=post action=$form->{script}>
  • <input type=hidden name=sort value=transdate>
  • <table width=100%>
  • <tr>
  • <th class=listtop>$form->{title}</th>
  • </tr>
  • <tr height="5"></tr>
  • <tr>
  • <td>
  • <table>
  • <tr>
  • <th align=right>|.$locale->text('Reference').qq|</th>
  • <td><input name=reference size=20></td>
  • </tr>
  • <tr>
  • <th align=right>|.$locale->text('Source').qq|</th>
  • <td><input name=source size=20></td>
  • <th align=right>|.$locale->text('Memo').qq|</th>
  • <td><input name=memo size=20></td>
  • </tr>
  • $department
  • <tr>
  • <th align=right>|.$locale->text('Description').qq|</th>
  • <td colspan=$colspan><input name=description size=60></td>
  • </tr>
  • <tr>
  • <th align=right>|.$locale->text('Notes').qq|</th>
  • <td colspan=$colspan><input name=notes size=60></td>
  • </tr>
  • <tr>
  • <th align=right>|.$locale->text('From').qq|</th>
  • <td><input name=datefrom size=11 title="$myconfig{dateformat}"></td>
  • <th align=right>|.$locale->text('To').qq|</th>
  • <td><input name=dateto size=11 title="$myconfig{dateformat}"></td>
  • </tr>
  • $selectfrom
  • <tr>
  • <th align=right>|.$locale->text('Amount').qq| >=</th>
  • <td><input name=amountfrom size=11></td>
  • <th align=right>|.$locale->text('Amount').qq| <=</th>
  • <td><input name=amountto size=11></td>
  • </tr>
  • <tr>
  • <th align=right>|.$locale->text('Include in Report').qq|</th>
  • <td colspan=$colspan>
  • <table>
  • <tr>
  • <td>
  • <input name="category" class=radio type=radio value=X checked>&nbsp;|.$locale->text('All').qq|
  • <input name="category" class=radio type=radio value=A>&nbsp;|.$locale->text('Asset').qq|
  • <input name="category" class=radio type=radio value=L>&nbsp;|.$locale->text('Liability').qq|
  • <input name="category" class=radio type=radio value=Q>&nbsp;|.$locale->text('Equity').qq|
  • <input name="category" class=radio type=radio value=I>&nbsp;|.$locale->text('Income').qq|
  • <input name="category" class=radio type=radio value=E>&nbsp;|.$locale->text('Expense').qq|
  • </td>
  • </tr>
  • <tr>
  • <table>
  • |;
  • while (@a) {
  • print qq|<tr>\n|;
  • for (1 .. 5) {
  • print qq|<td nowrap>|. shift @a;
  • print qq|</td>\n|;
  • }
  • print qq|</tr>\n|;
  • }
  • print qq|
  • <tr>
  • <td nowrap><input name="l_subtotal" class=checkbox type=checkbox value=Y> |.$locale->text('Subtotal').qq|</td>
  • </tr>
  • </table>
  • </tr>
  • </table>
  • </tr>
  • </table>
  • </td>
  • </tr>
  • <tr>
  • <td><hr size=3 noshade></td>
  • </tr>
  • </table>
  • <input type=hidden name=nextsub value=generate_report>
  • |;
  • $form->hide_form(qw(path login sessionid));
  • print qq|
  • <br>
  • <button class="submit" type="submit" name="action" value="continue">|.$locale->text('Continue').qq|</button>
  • </form>
  • |;
  • if ($form->{lynx}) {
  • require "bin/menu.pl";
  • &menubar;
  • }
  • print qq|
  • </body>
  • </html>
  • |;
  • }
  • sub generate_report {
  • $form->{sort} = "transdate" unless $form->{sort};
  • GL->all_transactions(\%myconfig, \%$form);
  • $href = "$form->{script}?action=generate_report&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
  • $form->sort_order();
  • $callback = "$form->{script}?action=generate_report&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
  • %acctype = ( 'A' => $locale->text('Asset'),
  • 'L' => $locale->text('Liability'),
  • 'Q' => $locale->text('Equity'),
  • 'I' => $locale->text('Income'),
  • 'E' => $locale->text('Expense'),
  • );
  • $form->{title} = $locale->text('General Ledger');
  • $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1;
  • unless ($form->{category} eq 'X') {
  • $form->{title} .= " : ".$locale->text($acctype{$form->{category}});
  • }
  • if ($form->{accno}) {
  • $href .= "&accno=".$form->escape($form->{accno});
  • $callback .= "&accno=".$form->escape($form->{accno},1);
  • $option = $locale->text('Account')." : $form->{accno} $form->{account_description}";
  • }
  • if ($form->{gifi_accno}) {
  • $href .= "&gifi_accno=".$form->escape($form->{gifi_accno});
  • $callback .= "&gifi_accno=".$form->escape($form->{gifi_accno},1);
  • $option .= "\n<br>" if $option;
  • $option .= $locale->text('GIFI')." : $form->{gifi_accno} $form->{gifi_account_description}";
  • }
  • if ($form->{source}) {
  • $href .= "&source=".$form->escape($form->{source});
  • $callback .= "&source=".$form->escape($form->{source},1);
  • $option .= "\n<br>" if $option;