Revision d38be021
Von Udo Spallek vor etwa 17 Jahren hinzugefügt
bin/mozilla/am.pl | ||
---|---|---|
3137 | 3137 |
|
3138 | 3138 |
$lxdebug->leave_sub(); |
3139 | 3139 |
} |
3140 |
|
|
3141 |
sub add_tax { |
|
3142 |
$lxdebug->enter_sub(); |
|
3143 |
|
|
3144 |
$form->{title} = $locale->text('Add'); |
|
3145 |
|
|
3146 |
$form->{callback} = |
|
3147 |
"$form->{script}?action=add_tax&login=$form->{login}&password=$form->{password}" |
|
3148 |
unless $form->{callback}; |
|
3149 |
|
|
3150 |
_get_taxaccount_selection(); |
|
3151 |
|
|
3152 |
$form->header(); |
|
3153 |
|
|
3154 |
my $parameters_ref = { |
|
3155 |
# ChartTypeIsAccount => $ChartTypeIsAccount, |
|
3156 |
}; |
|
3157 |
|
|
3158 |
# Ausgabe des Templates |
|
3159 |
print($form->parse_html_template('am/edit_tax', $parameters_ref)); |
|
3160 |
|
|
3161 |
$lxdebug->leave_sub(); |
|
3162 |
} |
|
3163 |
|
|
3164 |
sub edit_tax { |
|
3165 |
$lxdebug->enter_sub(); |
|
3166 |
|
|
3167 |
$form->{title} = $locale->text('Edit'); |
|
3168 |
|
|
3169 |
AM->get_tax(\%myconfig, \%$form); |
|
3170 |
_get_taxaccount_selection(); |
|
3171 |
|
|
3172 |
$form->header(); |
|
3173 |
|
|
3174 |
my $parameters_ref = { |
|
3175 |
}; |
|
3176 |
|
|
3177 |
# Ausgabe des Templates |
|
3178 |
print($form->parse_html_template('am/edit_tax', $parameters_ref)); |
|
3179 |
|
|
3180 |
$lxdebug->leave_sub(); |
|
3181 |
} |
|
3182 |
|
|
3183 |
sub list_tax { |
|
3184 |
$lxdebug->enter_sub(); |
|
3185 |
|
|
3186 |
AM->taxes(\%myconfig, \%$form); |
|
3187 |
|
|
3188 |
$form->{callback} = |
|
3189 |
"$form->{script}?action=list_tax&login=$form->{login}&password=$form->{password}"; |
|
3190 |
|
|
3191 |
$form->{title} = $locale->text('Tax-O-Matic'); |
|
3192 |
|
|
3193 |
$form->header(); |
|
3194 |
|
|
3195 |
# Ausgabe des Templates |
|
3196 |
print($form->parse_html_template('am/list_tax', $parameters_ref)); |
|
3197 |
|
|
3198 |
$lxdebug->leave_sub(); |
|
3199 |
} |
|
3200 |
|
|
3201 |
sub _get_taxaccount_selection{ |
|
3202 |
$lxdebug->enter_sub(); |
|
3203 |
|
|
3204 |
AM->get_tax_accounts(\%myconfig, \%$form); |
|
3205 |
|
|
3206 |
my $i = 0; |
|
3207 |
foreach my $taxaccount (@{ $form->{ACCOUNTS} } ) { |
|
3208 |
|
|
3209 |
# Fill in the Taxaxxounts as select options |
|
3210 |
if ($form->{chart_id} == $taxaccount->{id}) { |
|
3211 |
$form->{ACCOUNTS}[$i]{select_taxaccount} .= |
|
3212 |
qq|<option value="$taxaccount->{id}" selected="selected"> |
|
3213 |
$form->{ACCOUNTS}[$i]{_taxaccount}\n|; |
|
3214 |
} |
|
3215 |
else { |
|
3216 |
$form->{ACCOUNTS}[$i]{select_taxaccount} .= |
|
3217 |
qq|<option value="$taxaccount->{id}"> |
|
3218 |
$form->{ACCOUNTS}[$i]{_taxaccount}<!-- hallo-->\n|; |
|
3219 |
} |
|
3220 |
$i++; |
|
3221 |
} |
|
3222 |
return; |
|
3223 |
|
|
3224 |
$lxdebug->leave_sub(); |
|
3225 |
} |
|
3226 |
|
|
3227 |
sub save_tax { |
|
3228 |
$lxdebug->enter_sub(); |
|
3229 |
|
|
3230 |
$form->isblank("chart_id", $locale->text('Tax-O-Matic account missing!')); |
|
3231 |
$form->isblank("rate", $locale->text('Taxrate missing!')); |
|
3232 |
$form->isblank("taxdescription", $locale->text('Taxdescription missing!')); |
|
3233 |
$form->isblank("taxkey", $locale->text('Taxkey missing!')); |
|
3234 |
|
|
3235 |
if ( $form->{rate} <= 0 || $form->{rate} >= 100 ) { |
|
3236 |
$form->error($locale->text('Tax Percent is a number between 0 and 100')); |
|
3237 |
} |
|
3238 |
|
|
3239 |
if ( $form->{rate} <= 0.99 && $form->{rate} >= 0 ) { |
|
3240 |
$form->error($locale->text('Tax Percent is a number between 0 and 100')); |
|
3241 |
} |
|
3242 |
|
|
3243 |
AM->save_tax(\%myconfig, \%$form); |
|
3244 |
$form->redirect($locale->text('Tax saved!')); |
|
3245 |
|
|
3246 |
$lxdebug->leave_sub(); |
|
3247 |
} |
|
3248 |
|
|
3249 |
sub delete_tax { |
|
3250 |
$lxdebug->enter_sub(); |
|
3251 |
|
|
3252 |
AM->delete_tax(\%myconfig, \%$form); |
|
3253 |
$form->redirect($locale->text('Tax deleted!')); |
|
3254 |
|
|
3255 |
$lxdebug->leave_sub(); |
|
3256 |
} |
Auch abrufbar als: Unified diff
Neues Modul 'Steuern Bearbeiten'. Mit diesem Modul ist es moeglich, die Eintraege der Tabelle tax, bzw. _tax anpassen zu koennen.