Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 102600f0

Von Sven Schöling vor mehr als 17 Jahren hinzugefügt

  • ID 102600f0d1e5fc7b3acb620bde45bfd34f31f1cc
  • Vorgänger 0ecb3198
  • Nachfolger 755dcace

Stornomoeglichkeit fuer Debitorenrechnungen
(plus die ueblichen Codekosmetika)

Unterschiede anzeigen:

bin/mozilla/ar.pl
869 869
  $transdate = $form->datetonum($form->{transdate}, \%myconfig);
870 870
  $closedto  = $form->datetonum($form->{closedto},  \%myconfig);
871 871

  
872
  print qq|<input class="submit" type="submit" name="action" id="update_button" value="|
873
    . $locale->text('Update') . qq|">
874
|;
872
  # ToDO: insert a global check for stornos, so that a storno is only possible a limited time after saving it
873
  print qq|<input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|">|;
874
    if $form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar');
875

  
876
  print qq|<input class="submit" type="submit" name="action" id="update_button" value="| . $locale->text('Update') . qq|">\n|;
875 877
  if ($form->{id}) {
876 878
    if ($form->{radier}) {
877 879
      print qq|
878
          <input class=submit type=submit name=action value="|
879
            . $locale->text('Post') . qq|">
880
          <input class=submit type=submit name=action value="|
881
            . $locale->text('Delete') . qq|">
882
  |;
880
        <input class=submit type=submit name=action value="| . $locale->text('Post') .            qq|">
881
        <input class=submit type=submit name=action value="| . $locale->text('Delete') .          qq|"> |;
883 882
    }
884 883
    if ($transdate > $closedto) {
885 884
      print qq|
886
  <input class=submit type=submit name=action value="|
887
          . $locale->text('Use As Template') . qq|">
888
  |;
885
        <input class=submit type=submit name=action value="| . $locale->text('Use As Template') . qq|"> |;
889 886
    }
890 887
    print qq|
891
  <input class=submit type=submit name=action value="|
892
    . $locale->text('Post Payment') . qq|">
893
  |;
888
        <input class=submit type=submit name=action value="| . $locale->text('Post Payment') .    qq|"> |;
894 889

  
895 890
  } else {
896 891
    if ($transdate > $closedto) {
897
      print qq|<input class=submit type=submit name=action value="|
898
        . $locale->text('Post') . qq|"> | .
899
        NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'),
900
                         '-class' => 'submit'));
892
      print qq|<input class=submit type=submit name=action value="| . $locale->text('Post') .     qq|"> | .
893
        NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit'));
901 894
    }
902 895
  }
903 896

  
......
907 900
  }
908 901
  # button for saving history
909 902
  if($form->{id} ne "") {
910
    print qq|
911
  	  <input type=button class=submit onclick=set_history_window(|
912
  	  . $form->{id} 
913
  	  . qq|); name=history id=history value=|
914
  	  . $locale->text('history') 
915
  	  . qq|>|;
903
    print qq|<input type=button class=submit onclick=set_history_window($form->{id}); name=history id=history value=| . $locale->text('history') . qq|>|;
916 904
  }
917 905
  # /button for saving history
918 906
  print "
......
1058 1046
  $transdate = $form->datetonum($form->{transdate}, \%myconfig);
1059 1047
  $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto);
1060 1048

  
1061
  my $zero_amount_posting = 1;
1062
  for $i (1 .. $form->{rowcount}) {
1063
    if ($form->parse_amount(\%myconfig, $form->{"amount_$i"})) {
1064
      $zero_amount_posting = 0;
1065
      last;
1066
    }
1067
  }
1068

  
1069
  $form->error($locale->text('Zero amount posting!')) if $zero_amount_posting;
1049
  $form->error($locale->text('Zero amount posting!')) 
1050
    unless grep $_*1, map $form->parse_amount(\%myconfig, $form->{"amount_$_"}), 1..$form->{rowcount};
1070 1051

  
1071 1052
  $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1072 1053
    if ($form->{currency} ne $form->{defaultcurrency});
......
1083 1064
        if ($datepaid <= $closedto);
1084 1065

  
1085 1066
      if ($form->{currency} ne $form->{defaultcurrency}) {
1086
        $form->{"exchangerate_$i"} = $form->{exchangerate}
1087
          if ($transdate == $datepaid);
1088
        $form->isblank("exchangerate_$i",
1089
                       $locale->text('Exchangerate for payment missing!'));
1067
        $form->{"exchangerate_$i"} = $form->{exchangerate} if ($transdate == $datepaid);
1068
        $form->isblank("exchangerate_$i", $locale->text('Exchangerate for payment missing!'));
1090 1069
      }
1091 1070
    }
1092 1071
  }
......
1104 1083
  if (AR->post_transaction(\%myconfig, \%$form)) {
1105 1084
    # saving the history
1106 1085
    if(!exists $form->{addition} && $form->{id} ne "") {
1107
      $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
1108
  	  $form->{addition} = "POSTED";
1109
  	  $form->save_history($form->dbconnect(\%myconfig));
1086
      $form->{snumbers} = "invnumber_$form->{invnumber}";
1087
      $form->{addition} = "POSTED";
1088
      $form->save_history($form->dbconnect(\%myconfig));
1110 1089
    }
1111 1090
    # /saving the history 
1112 1091
    remove_draft() if $form->{remove_draft};
......
1671 1650
    $column_data{invnumber} =
1672 1651
      "<td><a href=$module?action=edit&id=$ar->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}</a></td>";
1673 1652

  
1674
    my $is_storno  = $ar->{storno} && ($ar->{invnumber} =~ /^Storno zu/);
1653
    my $is_storno  = $ar->{storno} && IS->is_storno(\%myconfig, $form, 'ar'); #($ar->{invnumber} =~ /^Storno zu/); # ToDO: fix this
1675 1654
    my $has_storno = $ar->{storno} && !$is_storno;
1676 1655

  
1677 1656
    $column_data{type} = "<td>" .
......
1805 1784

  
1806 1785
  $lxdebug->leave_sub();
1807 1786
}
1787

  
1788

  
1789
sub storno {
1790
  $lxdebug->enter_sub();
1791

  
1792
  if (IS->has_storno(\%myconfig, $form, 'ar')) {
1793
    $form->{title} = $locale->text("Cancel Accounts Receivables Transaction");
1794
    $form->error($locale->text("Transaction has already been cancelled!"));
1795
  }
1796

  
1797
  # ToDO: 
1798
  #       - nicht anzeigen wenn neue rechnung
1799
  #       - nicht anzeigen wenn schons toniert
1800
  #       - nicht anziegen wenn zahlungen da
1801

  
1802

  
1803
#  my %keep_keys = map { $_, 1 } qw(login password id stylesheet);
1804
#  map { delete $form->{$_} unless $keep_keys{$_} } keys %{ $form };
1805
#  prepare_transaction();
1806

  
1807
  # negate amount/taxes
1808
  for my $i (1 .. $form->{rowcount}) {
1809
    $form->{"amount_$i"} *= -1;
1810
    $form->{"tax_$i"}    *= -1; 
1811
  }
1812

  
1813
  # format things
1814
  for my $i (1 .. $form->{rowcount}) {
1815
    for (qw(amount tax)) {
1816
      $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) if $form->{"${_}_$i"};
1817
    }
1818
  }
1819

  
1820
  $form->{storno}      = 1;
1821
  $form->{storno_id}   = $form->{id};
1822
  $form->{id}          = 0;
1823

  
1824
  $form->{invnumber}   = "Storno-" . $form->{invnumber};
1825

  
1826
  post();
1827

  
1828
  # saving the history
1829
  if(!exists $form->{addition} && $form->{id} ne "") {
1830
    $form->{snumbers} = "ordnumber_$form->{ordnumber}";
1831
    $form->{addition} = "STORNO";
1832
    $form->save_history($form->dbconnect(\%myconfig));
1833
  }
1834
  # /saving the history 
1835

  
1836
  $lxdebug->leave_sub();
1837

  
1838
}
locale/de/all
210 210
  'C'                           => 'G',
211 211
  'CANCELED'                    => 'Storniert',
212 212
  'Calculate'                   => 'Berechnen',
213
  'Cancel Accounts Receivables Transaction' => 'Debitorenbuchung stornieren',
213 214
  'Cancel General Ledger Transaction' => 'Buchung stornieren',
214 215
  'Cannot create Lock!'         => 'System kann nicht gesperrt werden!',
215 216
  'Cannot delete account!'      => 'Konto kann nicht gel?scht werden!',
......
823 824
  'Port'                        => 'Port',
824 825
  'Post'                        => 'Buchen',
825 826
  'Post Payment'                => 'Zahlung buchen',
826
  'Post as new'                 => 'Neu buchen',
827 827
  'Postscript'                  => 'Postscript',
828 828
  'Posustva_coa'                => 'USTVA Kennz.',
829 829
  'Preferences'                 => 'Benutzereinstellungen',
locale/de/ar
19 19
  'Bin List'                    => 'Lagerliste',
20 20
  'Bis'                         => 'bis',
21 21
  'CANCELED'                    => 'Storniert',
22
  'Cancel Accounts Receivables Transaction' => 'Debitorenbuchung stornieren',
22 23
  'Cannot delete transaction!'  => 'Buchung kann nicht gel?scht werden!',
23 24
  'Cannot post payment for a closed period!' => 'Es k?nnen keine Zahlungen f?r abgeschlossene B?cher gebucht werden!',
24 25
  'Cannot post payment!'        => 'Zahlung kann nicht gebucht werden!',
......
149 150
  'Shipping Point'              => 'Versandort',
150 151
  'Skip'                        => '?berspringen',
151 152
  'Source'                      => 'Beleg',
153
  'Storno'                      => 'Storno',
152 154
  'Storno (one letter abbreviation)' => 'S',
153 155
  'Storno Invoice'              => 'Stornorechnung',
154 156
  'Storno Packing List'         => 'Stornolieferschein',
......
160 162
  'Total'                       => 'Summe',
161 163
  'Transaction deleted!'        => 'Buchung gel?scht!',
162 164
  'Transaction description'     => 'Vorgangsbezeichnung',
165
  'Transaction has already been cancelled!' => 'Diese Buchung wurde bereits storniert.',
163 166
  'Transaction posted!'         => 'Buchung verbucht!',
164 167
  'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
165 168
  'Type'                        => 'Typ',
......
244 247
  'set_longdescription'         => 'set_longdescription',
245 248
  'show_history'                => 'show_history',
246 249
  'show_vc_details'             => 'show_vc_details',
250
  'storno'                      => 'storno',
247 251
  'update'                      => 'update',
248 252
  'use_as_template'             => 'use_as_template',
249 253
  'vendor_invoice'              => 'vendor_invoice',
......
258 262
  'rechnung'                    => 'sales_invoice',
259 263
  'entwurf_speichern'           => 'save_draft',
260 264
  '?berspringen'                => 'skip',
265
  'storno'                      => 'storno',
261 266
  'erneuern'                    => 'update',
262 267
  'als_vorlage_verwenden'       => 'use_as_template',
263 268
  'ja'                          => 'yes',
locale/de/gl
118 118
  'Pick List'                   => 'Sammelliste',
119 119
  'Please enter values'         => 'Bitte Werte eingeben',
120 120
  'Post'                        => 'Buchen',
121
  'Post as new'                 => 'Neu buchen',
122 121
  'Previous transdate text'     => 'wurde gespeichert am',
123 122
  'Previous transnumber text'   => 'Letzte Buchung mit der Buchungsnummer',
124 123
  'Proforma Invoice'            => 'Proformarechnung',
......
239 238
  'l?schen'                     => 'delete',
240 239
  'dialogbuchung'               => 'gl_transaction',
241 240
  'buchen'                      => 'post',
242
  'neu_buchen'                  => 'post_as_new',
243 241
  'rechnung'                    => 'sales_invoice',
244 242
  'storno'                      => 'storno',
245 243
  'erneuern'                    => 'update',

Auch abrufbar als: Unified diff