$locale->text('Subtotal'), $form->{"subtotal_$i"} ? 'checked' : '' };
# begin marge calculations
- my $marge_color;
- my $real_sellprice = ($form->{"sellprice_$i"} - $discount) / $price_factor;
- my $marge_price_factor = $form->{"marge_price_factor_$i"} * 1 || 1;
-
- $form->{"lastcost_$i"} *= 1;
+ $form->{"lastcost_$i"} *= 1;
$form->{"marge_percent_$i"} = 0;
- if ($real_sellprice && ($form->{"qty_$i"} * 1)) {
- $form->{"marge_percent_$i"} = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * 100 / $real_sellprice;
- $myconfig{marge_percent_warn} ||= 15;
- $marge_color = 'color="#ff0000"' if $form->{"id_$i"} && ($form->{"marge_percent_$i"} < (1 * $myconfig{marge_percent_warn}));
+ my $marge_color;
+ my $real_sellprice = $linetotal;
+ my $real_lastcost = $form->{"lastcost_$i"} * $form->{"qty_$i"} / ( $form->{"marge_price_factor_$i"} || 1 );
+ my $marge_percent_warn = $myconfig{marge_percent_warn} * 1 || 15;
+ my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1;
+
+ if ($real_sellprice * 1 && ($form->{"qty_$i"} * 1)) {
+ $form->{"marge_percent_$i"} = ($real_sellprice - $real_lastcost) * 100 / $real_sellprice;
+ $marge_color = 'color="#ff0000"' if $form->{"id_$i"} && $form->{"marge_percent_$i"} < $marge_percent_warn;
}
- my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1;
- $form->{"marge_absolut_$i"} = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * $form->{"qty_$i"} * $marge_adjust_credit_note;
+ $form->{"marge_absolut_$i"} = ($real_sellprice - $real_lastcost) * $marge_adjust_credit_note;
$form->{"marge_total"} += $form->{"marge_absolut_$i"};
- $form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$i"} / $marge_price_factor;
- $form->{"sellprice_total"} += $real_sellprice * $form->{"qty_$i"};
+ $form->{"lastcost_total"} += $real_lastcost;
+ $form->{"sellprice_total"} += $real_sellprice;
map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_absolut marge_percent);
#($form->{"sellprice_$i"},$form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"};
# fuer assemblies auskommentiert. siehe oben
- # $form->{sellprice} += ($form->{"qty_$i"} * $form->{"sellprice_$i"} / ($form->{"price_factor_$i"} || 1));
+ # $form->{sellprice} += ($form->{"qty_$i"} * $form->{"sellprice_$i"} / ($form->{"price_factor_$i"} || 1));
$form->{weight} += ($form->{"qty_$i"} * $form->{"weight_$i"} / ($form->{"price_factor_$i"} || 1));
$count++;
}
);
my %template_vars = (
- display_copies => scalar @{ $form->{printers} } && $main::latex_templates && $form->{media} ne 'email',
+ display_copies => scalar @{ $form->{printers} || [] } && $main::latex_templates && $form->{media} ne 'email',
display_remove_draft => (!$form->{id} && $form->{draft_id}),
display_groupitems => !$dont_display_groupitems{$form->{type}},
groupitems_checked => $form->{groupitems} ? "checked" : '',
call_sub($display_form);
# saving the history
- if(!exists $form->{addition}) {
+ if(!exists $form->{addition}) {
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
- $form->{addition} = "PRINTED";
- $form->save_history($form->dbconnect(\%myconfig));
+ $form->{addition} = "PRINTED";
+ $form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
exit;
if(!exists $form->{addition}) {
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
if($form->{media} =~ /printer/) {
- $form->{addition} = "PRINTED";
+ $form->{addition} = "PRINTED";
}
elsif($form->{media} =~ /email/) {
- $form->{addition} = "MAILED";
+ $form->{addition} = "MAILED";
}
elsif($form->{media} =~ /queue/) {
- $form->{addition} = "QUEUED";
+ $form->{addition} = "QUEUED";
}
elsif($form->{media} =~ /screen/) {
- $form->{addition} = "SCREENED";
+ $form->{addition} = "SCREENED";
}
$form->save_history($form->dbconnect(\%myconfig));
}
<tr>
<td>
<table>
- <tr class="listheading">
- <th class="listheading" colspan="2" width="50%">|
+ <tr class="listheading">
+ <th class="listheading" colspan="2" width="50%">|
. $locale->text('Billing Address') . qq|</th>
- <th class="listheading" width="50%">|
+ <th class="listheading" width="50%">|
. $locale->text('Shipping Address') . qq|</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align="right" nowrap>$number</th>
- <td>$form->{"$form->{vc}number"}</td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Company Name') . qq|</th>
- <td>$form->{name}</td>
- <td><input name="shiptoname" size="35" value="$form->{shiptoname}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
- <td>$form->{department_1}</td>
- <td><input name="shiptodepartment_1" size="35" value="$form->{shiptodepartment_1}"></td>
- </tr>
- <tr>
- <th align="right" nowrap> </th>
- <td>$form->{department_2}</td>
- <td><input name="shiptodepartment_2" size="35" value="$form->{shiptodepartment_2}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Street') . qq|</th>
- <td>$form->{street}</td>
- <td><input name="shiptostreet" size="35" value="$form->{shiptostreet}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Zipcode') . qq|</th>
- <td>$form->{zipcode}</td>
- <td><input name="shiptozipcode" size="35" value="$form->{shiptozipcode}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('City') . qq|</th>
- <td>$form->{city}</td>
- <td><input name="shiptocity" size="35" value="$form->{shiptocity}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Country') . qq|</th>
- <td>$form->{country}</td>
- <td><input name="shiptocountry" size="35" value="$form->{shiptocountry}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Contact') . qq|</th>
- <td>$form->{contact}</td>
- <td><input name="shiptocontact" size="35" value="$form->{shiptocontact}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Phone') . qq|</th>
- <td>$form->{phone}</td>
- <td><input name="shiptophone" size="20" value="$form->{shiptophone}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('Fax') . qq|</th>
- <td>$form->{fax}</td>
- <td><input name="shiptofax" size="20" value="$form->{shiptofax}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>| . $locale->text('E-mail') . qq|</th>
- <td>$form->{email}</td>
- <td><input name="shiptoemail" size="35" value="$form->{shiptoemail}"></td>
- </tr>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <th align="right" nowrap>$number</th>
+ <td>$form->{"$form->{vc}number"}</td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Company Name') . qq|</th>
+ <td>$form->{name}</td>
+ <td><input name="shiptoname" size="35" value="$form->{shiptoname}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
+ <td>$form->{department_1}</td>
+ <td><input name="shiptodepartment_1" size="35" value="$form->{shiptodepartment_1}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap> </th>
+ <td>$form->{department_2}</td>
+ <td><input name="shiptodepartment_2" size="35" value="$form->{shiptodepartment_2}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Street') . qq|</th>
+ <td>$form->{street}</td>
+ <td><input name="shiptostreet" size="35" value="$form->{shiptostreet}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Zipcode') . qq|</th>
+ <td>$form->{zipcode}</td>
+ <td><input name="shiptozipcode" size="35" value="$form->{shiptozipcode}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('City') . qq|</th>
+ <td>$form->{city}</td>
+ <td><input name="shiptocity" size="35" value="$form->{shiptocity}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Country') . qq|</th>
+ <td>$form->{country}</td>
+ <td><input name="shiptocountry" size="35" value="$form->{shiptocountry}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Contact') . qq|</th>
+ <td>$form->{contact}</td>
+ <td><input name="shiptocontact" size="35" value="$form->{shiptocontact}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Phone') . qq|</th>
+ <td>$form->{phone}</td>
+ <td><input name="shiptophone" size="20" value="$form->{shiptophone}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Fax') . qq|</th>
+ <td>$form->{fax}</td>
+ <td><input name="shiptofax" size="20" value="$form->{shiptofax}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('E-mail') . qq|</th>
+ <td>$form->{email}</td>
+ <td><input name="shiptoemail" size="35" value="$form->{shiptoemail}"></td>
+ </tr>
</table>
</td>
</tr>
}
sub _render_custom_variables_inputs {
- $main::lxdebug->enter_sub();
+ $main::lxdebug->enter_sub(2);
my $form = $main::form;
};
}
- $main::lxdebug->leave_sub();
+ $main::lxdebug->leave_sub(2);
}