Skip to content

Commit

Permalink
Mostly read-only interface for transaction reversal entry
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuelsmann committed Oct 13, 2022
1 parent 0d734f6 commit 682b80c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
45 changes: 24 additions & 21 deletions old/bin/aa.pl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ sub reverse {
}
}

&display_form;
&display_form( readonly => 1 );
}

sub post_reversing {
Expand Down Expand Up @@ -233,6 +233,7 @@ sub post_reversing {
}

sub display_form {
my %args = @_;
my $invnumber = "sinumber";
if ( $form->{vc} eq 'vendor' ) {
$invnumber = "vinumber";
Expand All @@ -244,8 +245,8 @@ sub display_form {
$form->generate_selects(\%myconfig);
$form->open_form;
AA->get_files($form, $locale);
&form_header;
&form_footer;
&form_header( readonly => $args{readonly} );
&form_footer( readonly => $args{readonly} );

}

Expand Down Expand Up @@ -435,7 +436,9 @@ sub create_links {
}

sub form_header {
my $min_lines = $form->get_setting('min_empty') // 0;
my %args = @_;
my $min_lines = $form->get_setting('min_empty') // 0;
my $readonly = $args{readonly} ? 'readonly' : '';

$form->generate_selects(\%myconfig) unless $form->{"select$form->{ARAP}"};
$title = $form->{title};
Expand Down Expand Up @@ -501,14 +504,14 @@ sub form_header {
$exchangerate = qq|<tr>|;
$exchangerate .= qq|
<th align=right nowrap><label for="currency">| . $locale->text('Currency') . qq|</label></th>
<td><select data-dojo-type="dijit/form/Select" id=currency name=currency>$form->{selectcurrency}</select></td> |
<td><select data-dojo-type="dijit/form/Select" id=currency name=currency $readonly>$form->{selectcurrency}</select></td> |
if $form->{defaultcurrency};
if ( $form->{defaultcurrency}
&& $form->{currency} ne $form->{defaultcurrency} )
{
$exchangerate .= qq|
<th align=right><label for="exchangerate">| . $locale->text('Exchange Rate') . qq|</label></th>
<td><input data-dojo-type="dijit/form/TextBox" name=exchangerate id=exchangerate size=10 value=$formatted_exchangerate></td>
<td><input data-dojo-type="dijit/form/TextBox" name=exchangerate id=exchangerate size=10 value=$formatted_exchangerate $readonly></td>
|;
}
else {
Expand All @@ -531,7 +534,7 @@ sub form_header {
$department = qq|
<tr>
<th align="right" nowrap>| . $locale->text('Department') . qq|</th>
<td colspan=3><select data-dojo-type="dijit/form/Select" id=department name=department>$form->{selectdepartment}</select>
<td colspan=3><select data-dojo-type="dijit/form/Select" id=department name=department $readonly>$form->{selectdepartment}</select>
<input type=hidden name=selectdepartment value="|
. $form->escape( $form->{selectdepartment}, 1 ) . qq|">
</td>
Expand All @@ -543,8 +546,8 @@ sub form_header {

$name =
( $form->{"select$form->{vc}"} )
? qq|<select data-dojo-type="lsmb/FilteringSelect" id="$form->{vc}" name="$form->{vc}"><option></option>$form->{"select$form->{vc}"}</select>|
: qq|<input data-dojo-type="dijit/form/TextBox" id="$form->{vc}" name="$form->{vc}" value="$form->{$form->{vc}}" size=35>
? qq|<select data-dojo-type="lsmb/FilteringSelect" id="$form->{vc}" name="$form->{vc}" $readonly><option></option>$form->{"select$form->{vc}"}</select>|
: qq|<input data-dojo-type="dijit/form/TextBox" id="$form->{vc}" name="$form->{vc}" value="$form->{$form->{vc}}" size=35 $readonly>
<a href="erp.pl?action=root#contact.pl?action=add&entity_class=$eclass"
id="new-contact" target="_blank">[|
. $locale->text('New') . qq|]</a>|;
Expand All @@ -562,7 +565,7 @@ sub form_header {
$employee = qq|
<tr>
<th align=right nowrap><label for="employee">$label</label></th>
<td><select data-dojo-type="dijit/form/Select" id=employee name=employee>$form->{selectemployee}</select></td>
<td><select data-dojo-type="dijit/form/Select" id=employee name=employee $readonly>$form->{selectemployee}</select></td>
<input type=hidden name=selectemployee value="|
. $form->escape( $form->{selectemployee}, 1 ) . qq|">
</tr>
Expand Down Expand Up @@ -717,7 +720,7 @@ sub form_header {
</tr>
<tr>
<th align=right nowrap><label for="ordnum">| . $locale->text('Order Number') . qq|</label></th>
<td><input data-dojo-type="dijit/form/TextBox" name=ordnumber id=ordnum size=20 value="$form->{ordnumber}"></td>
<td><input data-dojo-type="dijit/form/TextBox" name=ordnumber id=ordnum size=20 value="$form->{ordnumber}" $readonly></td>
</tr>
<tr>
<th align=right nowrap><label for="crdate">| . $locale->text('Invoice Created') . qq|</label></th>
Expand All @@ -733,7 +736,7 @@ sub form_header {
</tr>
<tr>
<th align=right nowrap><label for="ponum">| . $locale->text('PO Number') . qq|</label></th>
<td><input data-dojo-type="dijit/form/TextBox" name=ponumber id=ponum size=20 value="$form->{ponumber}"></td>
<td><input data-dojo-type="dijit/form/TextBox" name=ponumber id=ponum size=20 value="$form->{ponumber}" $readonly></td>
</tr>
</table>
</td>
Expand Down Expand Up @@ -774,7 +777,7 @@ sub form_header {
$form->format_amount( \%myconfig,$form->{"amount_$i"}, LedgerSMB::Setting->new(%$form)->get('decimal_places') );

$project = qq|
<td align=right><select data-dojo-type="dijit/form/Select" id="projectnumber_$i" name="projectnumber_$i">$form->{"selectprojectnumber_$i"}</select></td>
<td align=right><select data-dojo-type="dijit/form/Select" id="projectnumber_$i" name="projectnumber_$i" $readonly>$form->{"selectprojectnumber_$i"}</select></td>
| if $form->{selectprojectnumber};
$project //= '';

Expand All @@ -783,36 +786,36 @@ sub form_header {
1 )
{
$description =
qq|<td><textarea data-dojo-type="dijit/form/Textarea" name="description_$i" rows=$rows cols=40>$form->{"description_$i"}</textarea></td>|;
qq|<td><textarea data-dojo-type="dijit/form/Textarea" name="description_$i" rows=$rows cols=40 $readonly>$form->{"description_$i"}</textarea></td>|;
}
else {
$description =
qq|<td><input data-dojo-type="dijit/form/TextBox" name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
qq|<td><input data-dojo-type="dijit/form/TextBox" name="description_$i" size=40 value="$form->{"description_$i"}" $readonly></td>|;
}

$taxchecked="";
if($form->{"taxformcheck_$i"} or ($form->{default_reportable} and ($i == $form->{rowcount})))
{
$taxchecked=qq|CHECKED="CHECKED"|;

$taxchecked.=q| disabled="disabled"| if $readonly;
}

$taxformcheck=qq|<td><input type="checkbox" data-dojo-type="dijit/form/CheckBox" name="taxformcheck_$i" value="1" $taxchecked></td>|;
print qq|
<tr valign=top class="transaction-line $form->{ARAP}" id="line-$i">
<td><input data-dojo-type="dijit/form/TextBox" name="amount_$i" size=10 value="$form->{"amount_$i"}"></td>
<td><input data-dojo-type="dijit/form/TextBox" name="amount_$i" size=10 value="$form->{"amount_$i"}" $readonly></td>
<td>| . (($form->{currency} ne $form->{defaultcurrency})
? $form->format_amount(\%myconfig, $form->parse_amount( \%myconfig, $form->{"amount_$i"} )
* $form->{exchangerate}, LedgerSMB::Setting->new(%$form)->get('decimal_places'))
: '') . qq|</td>
<td><select data-dojo-type="lsmb/FilteringSelect" id="$form->{ARAP}_amount_$i" name="$form->{ARAP}_amount_$i"><option></option>$form->{"select$form->{ARAP}_amount_$i"}</select></td>
<td><select data-dojo-type="lsmb/FilteringSelect" id="$form->{ARAP}_amount_$i" name="$form->{ARAP}_amount_$i" $readonly><option></option>$form->{"select$form->{ARAP}_amount_$i"}</select></td>
$description
$taxformcheck
$project|;

for my $cls (@{$form->{bu_class}}){
if (scalar @{$form->{b_units}->{"$cls->{id}"}}){
print qq|<td><select data-dojo-type="dijit/form/Select" id="b_unit_$cls->{id}_$i" name="b_unit_$cls->{id}_$i">
print qq|<td><select data-dojo-type="dijit/form/Select" id="b_unit_$cls->{id}_$i" name="b_unit_$cls->{id}_$i" $readonly>
<option>&nbsp;</option>|;
for my $bu (@{$form->{b_units}->{"$cls->{id}"}}){
my $selected = '';
Expand Down Expand Up @@ -844,7 +847,7 @@ sub form_header {
print qq|
<tr class="transaction-row $form->{ARAP} tax" id="taxrow_$item">
<td><input data-dojo-type="dijit/form/TextBox" name="tax_$item" id="tax_$item"
size=10 value=$form->{"tax_$item"} /></td>
size=10 value=$form->{"tax_$item"} $readonly /></td>
<td align=right><input id="calctax_$item" name="calctax_$item"
class="checkbox" type="checkbox" data-dojo-type="dijit/form/CheckBox" value=1
$form->{"calctax_$item"}
Expand Down Expand Up @@ -879,7 +882,7 @@ sub form_header {
\%myconfig,
$form->{invtotal} * $form->{exchangerate},
LedgerSMB::Setting->new(%$form)->get('decimal_places')) : '') . qq|</td>
<td><select data-dojo-type="dijit/form/Select" name="$form->{ARAP}" id="$form->{ARAP}">
<td><select data-dojo-type="dijit/form/Select" name="$form->{ARAP}" id="$form->{ARAP}" $readonly>
$selectARAP
</select></td>
</tr>
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion sql/changes/LOADORDER
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,5 @@ mc/delete-migration-validation-data.sql
1.10/unique-transaction-reconciliation.sql
1.10/missing-fkeys.sql
1.10/file-tranaction-cascade-delete.sql
1.10/reversed-transactions.sql
# 1.11 changes
1.11/reversed-transactions.sql

0 comments on commit 682b80c

Please sign in to comment.