diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/aa.pl | 51 | ||||
-rw-r--r-- | bin/ir.pl | 24 | ||||
-rw-r--r-- | bin/is.pl | 25 |
3 files changed, 82 insertions, 18 deletions
@@ -92,6 +92,18 @@ sub add { $form->{callback} = "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback}; + if ($form->{type} eq "credit_note"){ + $form->{reverse} = 1; + $form->{subtype} = 'credit_note'; + $form->{type} = 'transaction'; + } elsif ($form->{type} eq 'debit_note'){ + $form->{reverse} = 1; + $form->{subtype} = 'debit_note'; + $form->{type} = 'transaction'; + } + else { + $form->{reverse} = 0; + } &create_links; @@ -103,6 +115,18 @@ sub add { sub edit { $form->{title} = "Edit"; + if ($form->{reverse}){ + if ($form->{ARAP} eq 'AR'){ + $form->{subtype} = 'credit_note'; + $form->{type} = 'transaction'; + } elsif ($form->{ARAP} eq 'AP'){ + $form->{subtype} = 'debit_note'; + $form->{type} = 'transaction'; + } else { + $form->error("Unknown AR/AP selection value: $form->{ARAP}"); + } + + } &create_links; &display_form; @@ -375,12 +399,29 @@ qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n|; sub form_header { $title = $form->{title}; - $form->{title} = $locale->text("$title $form->{ARAP} Transaction"); + if ($form->{reverse} == 0){ + $form->{title} = $locale->text("$title $form->{ARAP} Transaction"); + } + elsif($form->{reverse} == 1) { + if ($form->{subtype} eq 'credit_note'){ + $form->{title} = $locale->text("$title Credit Note"); + } elsif ($form->{subtype} eq 'debit_note'){ + $form->{title} = $locale->text("$title Debit Note"); + } else { + $form->error("Unknown subtype $form->{subtype} in $form->{ARAP} " + . "transaction."); + } + } + else { + $form->error('Reverse flag not true or false on AR/AP transaction'); + } $form->{taxincluded} = ( $form->{taxincluded} ) ? "checked" : ""; - # $locale->text('Add AR Transaction') - # $locale->text('Edit AR Transaction') + # $locale->text('Add Debit Note') + # $locale->text('Edit Debit Note') + # $locale->text('Add Credit Note') + # $locale->text('Edit Credit Note') # $locale->text('Add AP Transaction') # $locale->text('Edit AP Transaction') @@ -496,14 +537,14 @@ qq|<textarea name=notes rows=$rows cols=50 wrap=soft>$form->{notes}</textarea>|; <body onload="document.forms[0].${focus}.focus()" /> <form method=post action=$form->{script}> - <input type=hidden name=type value="$form->{formname}"> <input type=hidden name=title value="$title"> |; $form->hide_form( - qw(id printed emailed sort closedto locked oldtransdate audittrail recurring checktax) + qw(id printed emailed sort closedto locked oldtransdate audittrail + recurring checktax reverse batch_id subtype) ); if ( $form->{vc} eq 'customer' ) { @@ -50,8 +50,14 @@ require "bin/arap.pl"; # end of main sub add { - - $form->{title} = $locale->text('Add Vendor Invoice'); + if ($form->{type} eq 'debit_invoice'){ + $form->{title} = $locale->text('Add Debit Invoice'); + $form->{subtype} = 'debit_invoice'; + $form->{reverse} = 1; + } else { + $form->{title} = $locale->text('Add Vendor Invoice'); + $form->{reverse} = 0; + } $form->{callback} = "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}" @@ -63,8 +69,13 @@ sub add { } sub edit { - - $form->{title} = $locale->text('Edit Vendor Invoice'); + if ($form->{reverse}){ + $form->{title} = $locale->text('Add Debit Invoice'); + $form->{subtype} = 'debit_invoice'; + } else { + $form->{title} = $locale->text('Edit Vendor Invoice'); + } + &invoice_links; &prepare_invoice; @@ -367,7 +378,8 @@ sub form_header { $form->{vc} = "vendor"; $form->hide_form( - qw(id title vc type terms creditlimit creditremaining closedto locked shipped oldtransdate recurring) + qw(id title vc type terms creditlimit creditremaining closedto locked + shipped oldtransdate recurring reverse batch_id subtype) ); print qq| @@ -1139,4 +1151,4 @@ sub on_hold { #&invoice_links(); # is that it? &edit(); # it was already IN edit for this to be reached. } -}
\ No newline at end of file +} @@ -55,9 +55,14 @@ require "bin/io.pl"; # end of main sub add { - - $form->{title} = $locale->text('Add Sales Invoice'); - + if ($form->{type} eq 'credit_invoice'){ + $form->{title} = $locale->text('Add Credit Invoice'); + $form->{subtype} = 'credit_invoice'; + $form->{reverse} = 1; + } else { + $form->{title} = $locale->text('Add Sales Invoice'); + $form->{reverse} = 0; + } $form->{callback} = "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}" unless $form->{callback}; @@ -70,8 +75,12 @@ sub add { sub edit { - $form->{title} = $locale->text('Edit Sales Invoice'); - + if ($form->{reverse}) { + $form->{title} = $locale->text('Add Credit Invoice'); + $form->{subtype} = 'credit_invoice'; + } else { + $form->{title} = $locale->text('Add Sales Invoice'); + } &invoice_links; &prepare_invoice; &display_form; @@ -402,7 +411,9 @@ sub form_header { |; $form->hide_form( - qw(id type media format printed emailed queued title vc terms discount creditlimit creditremaining tradediscount business closedto locked shipped oldtransdate recurring) + qw(id type media format printed emailed queued title vc terms discount + creditlimit creditremaining tradediscount business closedto locked + shipped oldtransdate recurring reverse batch_id subtype) ); print qq| @@ -1198,4 +1209,4 @@ sub on_hold { #&invoice_links(); # is that it? &edit(); # it was already IN edit for this to be reached. } -}
\ No newline at end of file +} |