#===================================================================== # LedgerSMB # Small Medium Business Accounting software # # See COPYRIGHT file for copyright information #====================================================================== # # This file has NOT undergone whitespace cleanup. # #====================================================================== # # Genereal Ledger # #====================================================================== use LedgerSMB::GL; use LedgerSMB::PE; require "$form->{path}/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 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; $form->{oldtransdate} = $form->{transdate}; $form->{focus} = "reference"; # departments if (@{ $form->{all_department} }) { $form->{selectdepartment} = "\n"; for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|$_->{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} .= "$_->{accno}--$_->{description}\n" } # projects if (@{ $form->{all_project} }) { $form->{selectprojectnumber} = "\n"; for (@{ $form->{all_project} }) { $form->{selectprojectnumber} .= qq|$_->{projectnumber}\n| } } # departments if (@{ $form->{all_department} }) { $form->{department} = "$form->{department}--$form->{department_id}"; $form->{selectdepartment} = "\n"; for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|$_->{description}\n| } } } sub search { $form->{title} = $locale->text('General Ledger')." ".$locale->text('Reports'); $colspan = 5; $form->all_departments(\%myconfig); # departments if (@{ $form->{all_department} }) { $form->{selectdepartment} = "\n"; for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|$_->{description}\n| } $l_department = qq| |.$locale->text('Department'); $department = qq| |.$locale->text('Department').qq| $form->{selectdepartment} |; } if (@{ $form->{all_years} }) { # accounting years $form->{selectaccountingyear} = "\n"; for (@{ $form->{all_years} }) { $form->{selectaccountingyear} .= qq|$_\n| } $form->{selectaccountingmonth} = "\n"; for (sort keys %{ $form->{all_month} }) { $form->{selectaccountingmonth} .= qq||.$locale->text($form->{all_month}{$_}).qq|\n| } $selectfrom = qq| |.$locale->text('Period').qq| $form->{selectaccountingmonth} $form->{selectaccountingyear} |.$locale->text('Current').qq| |.$locale->text('Month').qq| |.$locale->text('Quarter').qq| |.$locale->text('Year').qq| |; } @a = (); push @a, qq| |.$locale->text('ID'); push @a, qq| |.$locale->text('Date'); push @a, qq| |.$locale->text('Reference'); push @a, qq| |.$locale->text('Description'); push @a, qq| |.$locale->text('Notes'); push @a, $l_department if $l_department; push @a, qq| |.$locale->text('Debit'); push @a, qq| |.$locale->text('Credit'); push @a, qq| |.$locale->text('Source'); push @a, qq| |.$locale->text('Memo'); push @a, qq| |.$locale->text('Account'); push @a, qq| |.$locale->text('GIFI'); $form->header; print qq| {script}> $form->{title} |.$locale->text('Reference').qq| |.$locale->text('Source').qq| |.$locale->text('Memo').qq| $department |.$locale->text('Description').qq| |.$locale->text('Notes').qq| |.$locale->text('From').qq| |.$locale->text('To').qq| $selectfrom |.$locale->text('Amount').qq| >= |.$locale->text('Amount').qq| <= |.$locale->text('Include in Report').qq| |.$locale->text('All').qq| |.$locale->text('Asset').qq| |.$locale->text('Liability').qq| |.$locale->text('Equity').qq| |.$locale->text('Income').qq| |.$locale->text('Expense').qq| |; while (@a) { print qq|\n|; for (1 .. 5) { print qq||. shift @a; print qq|\n|; } print qq|\n|; } print qq| |.$locale->text('Subtotal').qq| |; $form->hide_form(qw(path login sessionid)); print qq| |; if ($form->{menubar}) { require "$form->{path}/menu.pl"; &menubar; } print qq|