[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4412] trunk
- Subject: SF.net SVN: ledger-smb:[4412] trunk
- From: ..hidden..
- Date: Thu, 08 Mar 2012 09:44:16 +0000
Revision: 4412
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4412&view=rev
Author: einhverfr
Date: 2012-03-08 09:44:16 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
AP/AR transactions now save. There are some UI glitches and one cannot pull them back yet....
Modified Paths:
--------------
trunk/LedgerSMB/AA.pm
trunk/LedgerSMB/Form.pm
trunk/bin/aa.pl
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2012-03-08 09:25:20 UTC (rev 4411)
+++ trunk/LedgerSMB/AA.pm 2012-03-08 09:44:16 UTC (rev 4412)
@@ -60,6 +60,7 @@
use strict;
my ( $self, $myconfig, $form ) = @_;
+ $form->all_business_units;
my $exchangerate;
my $batch_class;
@@ -206,6 +207,7 @@
push @{ $form->{acc_trans}{lineitems} },
{
+ row_num => $i,
accno => $accno,
amount => $amount{fxamount}{$i},
project_id => $project_id,
@@ -219,6 +221,7 @@
$amount = $amount{amount}{$i} - $amount{fxamount}{$i};
push @{ $form->{acc_trans}{lineitems} },
{
+ row_num => $i,
accno => $accno,
amount => $amount,
project_id => $project_id,
@@ -381,7 +384,6 @@
curr = ?,
notes = ?,
intnotes = ?,
- department_id = ?,
ponumber = ?,
reverse = ?
WHERE id = ?
@@ -394,7 +396,7 @@
$form->{duedate}, $paid,
$datepaid, $invnetamount,
$form->{currency}, $form->{notes},
- $form->{intnotes}, $form->{department_id},
+ $form->{intnotes},
$form->{ponumber}, $form->{reverse},
$form->{id}
);
@@ -440,26 +442,40 @@
my $taxformfound=AA->taxform_exist($form,$form->{"$form->{vc}_id"});
+
+ my $b_unit_sth = $dbh->prepare(
+ "INSERT INTO business_unit_ac (entry_id, class_id, bu_id)
+ VALUES (currval('acc_trans_entry_id_seq'), ?, ?)"
+ );
+
foreach $ref ( @{ $form->{acc_trans}{lineitems} } ) {
# insert detail records in acc_trans
if ( $ref->{amount} ) {
$query = qq|
INSERT INTO acc_trans
(trans_id, chart_id, amount,
- transdate, project_id, memo,
+ transdate, memo,
fx_transaction, cleared)
VALUES (?, (SELECT id FROM chart
WHERE accno = ?),
- ?, ?, ?, ?, ?, ?)|;
+ ?, ?, ?, ?, ?)|;
@queryargs = (
$form->{id}, $ref->{accno},
$ref->{amount} * $ml, $form->{transdate},
- $ref->{project_id}, $ref->{description},
+ $ref->{description},
$ref->{fx_transaction}, $ref->{cleared}
);
$dbh->prepare($query)->execute(@queryargs)
|| $form->dberror($query);
+ if ($ref->{row_num} and !$ref->{fx_transaction}){
+ my $i = $ref->{row_num};
+ for my $cls(@{$form->{bu_class}}){
+ if ($form->{"b_unit_$cls->{id}_$i"}){
+ $b_unit_sth->execute($cls->{id}, $form->{"b_unit_$cls->{id}_$i"});
+ }
+ }
+ }
if($taxformfound)
{
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2012-03-08 09:25:20 UTC (rev 4411)
+++ trunk/LedgerSMB/Form.pm 2012-03-08 09:44:16 UTC (rev 4412)
@@ -2075,15 +2075,15 @@
sub all_business_units {
- my ( $self, $transdate, $credit_id ) = @_;
+ my ( $self, $transdate, $credit_id, $module_name) = @_;
$self->{bu_class} = [];
$self->{b_units} = {};
my $dbh = $self->{dbh};
my $class_sth = $dbh->prepare(
- q|SELECT * FROM business_unit__list_classes('1')|
+ q|SELECT * FROM business_unit__list_classes('1', ?)|
);
- $class_sth->execute;
+ $class_sth->execute($module_name);
my $bu_sth = $dbh->prepare(
q|SELECT *
@@ -2092,7 +2092,7 @@
while (my $classref = $class_sth->fetchrow_hashref('NAME_lc')){
push @{$self->{bu_class}}, $classref;
- $bu_sth->execute($classref->{id}, $transdate, $credit_id, '0');
+ $bu_sth->execute($classref->{id}, $transdate, $credit_id);
$self->{b_units}->{$classref->{id}} = [];
while (my $buref = $bu_sth->fetchrow_hashref('NAME_lc')){
push @{$self->{b_units}->{$classref->{id}}}, $buref;
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2012-03-08 09:25:20 UTC (rev 4411)
+++ trunk/bin/aa.pl 2012-03-08 09:44:16 UTC (rev 4412)
@@ -222,20 +222,6 @@
}
}
- # departments
- if ( @{ $form->{all_department} } ) {
- $form->{selectdepartment} = "<option>\n";
- $form->{department} = "$form->{department}--$form->{department_id}"
- if $form->{department_id};
-
- for ( @{ $form->{all_department} } ) {
- $form->{selectdepartment} .=
-qq|<option value="$_->{description}--$_->{id}">$_->{description}\n|;
- }
- }
-
- $form->{employee} = "$form->{employee}--$form->{employee_id}";
-
# sales staff
if ( @{ $form->{all_employee} } ) {
$form->{selectemployee} = "";
@@ -429,6 +415,7 @@
sub form_header {
$title = $form->{title};
+ $form->all_business_units($transdate, $form->{"$form->{vc}_id"}, $form->{ARAP});
if($form->{batch_id})
{
@@ -722,21 +709,26 @@
<table>
|;
- $project = qq|
- <th>| . $locale->text('Project') . qq|</th>
-| if $form->{selectprojectnumber};
-
print qq|
<tr>
<th>| . $locale->text('Amount') . qq|</th>
<th></th>
<th>| . $locale->text('Account') . qq|</th>
<th>| . $locale->text('Description') . qq|</th>
- <th>| . $locale->text('Tax Form Applied') . qq|</th>
- $project
+ <th>| . $locale->text('Tax Form Applied') . qq|</th>|;
+ for my $cls (@{$form->{bu_class}}){
+ if (scalar @{$form->{b_units}->{"$cls->{id}"}}){
+ print qq|<th>| . $locale->text($cls->{label}) . qq|</th>|;
+ }
+ }
+ print qq|
</tr>
|;
+ # Building buisness unit dropdowns
+
+ # Display rows
+
for $i ( 1 .. $form->{rowcount} ) {
$selectamount = $form->{"select$form->{ARAP}_amount"};
@@ -781,7 +773,22 @@
<td><select name="$form->{ARAP}_amount_$i">$selectamount</select></td>
$description
$taxformcheck
- $project
+ $project|;
+
+ for my $cls (@{$form->{bu_class}}){
+ if (scalar @{$form->{b_units}->{"$cls->{id}"}}){
+ print qq|<td><select name="b_unit_$cls->{id}_$i">
+ <option></option>|;
+ for my $bu (@{$form->{b_units}->{"$cls->{id}"}}){
+ print qq| <option value="$bu->{id}">$bu->{control_code}
+ </option>|;
+ }
+ print qq|
+ </select>
+ </th>|;
+ }
+ }
+ print qq|
</tr>
|;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.