Revision 58b14f96
Von Stephan Köhler vor mehr als 19 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
$taxbase{$item} += $taxbase;
|
||
}
|
||
}
|
||
$tax_rate = $taxrate*100;
|
||
$tax_rate = $taxrate * 100;
|
||
push(@{ $form->{tax_rate} }, qq|$tax_rate|);
|
||
if ($form->{"assembly_$i"}) {
|
||
$sameitem = "";
|
||
... | ... | |
|
||
sub post_invoice {
|
||
$main::lxdebug->enter_sub();
|
||
print STDERR "IS.pm-post_invoice\n";
|
||
|
||
my ($self, $myconfig, $form) = @_;
|
||
|
||
# connect to database, turn off autocommit
|
||
... | ... | |
? qq|'$form->{"deliverydate_$i"}'|
|
||
: "NULL";
|
||
|
||
|
||
# get pricegroup_id and save ist
|
||
($null, my $pricegroup_id) = split /--/, $form->{"sellprice_drag_$i"};
|
||
$pricegroup_id *= 1;
|
||
... | ... | |
|
||
sub retrieve_invoice {
|
||
$main::lxdebug->enter_sub();
|
||
print STDERR "IS.pm-retrieve_invoice\n";
|
||
|
||
my ($self, $myconfig, $form) = @_;
|
||
|
||
# connect to database
|
||
... | ... | |
##########################
|
||
# get pricegroups from database
|
||
# build up selected pricegroup
|
||
# if an exchange rate - change price
|
||
# if an exchange rate - change price
|
||
# for each part
|
||
#
|
||
sub get_pricegroups_for_parts {
|
||
print STDERR "IS.pm - get_pricegroups_for_parts\n";
|
||
|
||
$main::lxdebug->enter_sub();
|
||
|
||
my ($self, $myconfig, $form) = @_;
|
||
... | ... | |
$id = $form->{"new_id_$i"};
|
||
}
|
||
|
||
($price, $selectedpricegroup_id) = split /--/, $form->{"sellprice_drag_$i"};
|
||
# print (STDERR "sellprice_drag_$i", Dumper($form->{"sellprice_drag_$i"}));
|
||
($price, $selectedpricegroup_id) = split /--/,
|
||
$form->{"sellprice_drag_$i"};
|
||
|
||
$pricegroup_old = $form->{"pricegroup_old_$i"};
|
||
# print (STDERR "pricegroup_old_i-$i", Dumper($pricegroup_old));
|
||
|
||
$price_new = $form->{"price_new_$i"};
|
||
|
||
$price_old = $form->{"price_old_$i"};
|
||
|
||
|
||
$query = qq|SELECT pricegroup_id, (SELECT p.sellprice from parts p where p.id = $id) as default_sellprice,(SELECT pg.pricegroup FROM pricegroup pg WHERE id=pricegroup_id) AS pricegroup, price, '' AS selected FROM prices WHERE parts_id = $id UNION SELECT 0 as pricegroup_id,(SELECT sellprice FROM parts WHERE id=$id) as default_sellprice,'' as pricegroup, (SELECT DISTINCT sellprice from parts where id=$id) as price, 'selected' AS selected from prices ORDER BY pricegroup|;
|
||
$query =
|
||
qq|SELECT pricegroup_id, (SELECT p.sellprice from parts p where p.id = $id) as default_sellprice,(SELECT pg.pricegroup FROM pricegroup pg WHERE id=pricegroup_id) AS pricegroup, price, '' AS selected FROM prices WHERE parts_id = $id UNION SELECT 0 as pricegroup_id,(SELECT sellprice FROM parts WHERE id=$id) as default_sellprice,'' as pricegroup, (SELECT DISTINCT sellprice from parts where id=$id) as price, 'selected' AS selected from prices ORDER BY pricegroup|;
|
||
|
||
$pkq = $dbh->prepare($query);
|
||
$pkq->execute || $form->dberror($query);
|
||
while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
|
||
# push @{ $form->{PRICES}{$id} }, $pkr;
|
||
push @{ $form->{PRICES}{$i} }, $pkr;
|
||
$pkr->{id} = $id;
|
||
$pkr->{selected} = '';
|
||
|
||
# if there is an exchange rate change price
|
||
# push @{ $form->{PRICES}{$id} }, $pkr;
|
||
push @{ $form->{PRICES}{$i} }, $pkr;
|
||
$pkr->{id} = $id;
|
||
$pkr->{selected} = '';
|
||
|
||
# if there is an exchange rate change price
|
||
if (($form->{exchangerate} * 1) != 0) {
|
||
# print STDERR "WECHSELKURS?-$form->{exchangerate}\n";
|
||
|
||
$pkr->{price} /= $form->{exchangerate};
|
||
}
|
||
$pkr->{price} = $form->format_amount($myconfig,$pkr->{price},5);
|
||
|
||
$pkr->{price} = $form->format_amount($myconfig, $pkr->{price}, 5);
|
||
|
||
if ($selectedpricegroup_id eq undef) {
|
||
if ($pkr->{pricegroup_id} eq $form->{customer_klass}) {
|
||
print STDERR " INIT ROW \n";
|
||
#print (STDERR " PREIS", Dumper($pkr->{price}));
|
||
|
||
$pkr->{selected} = ' selected';
|
||
$last->{selected} = '';
|
||
# print (STDERR " SELLPRICE", Dumper($form->{"sellprice_$i"}));
|
||
|
||
# no customer pricesgroup set
|
||
# no customer pricesgroup set
|
||
if ($pkr->{price} == $pkr->{default_sellprice}) {
|
||
print (STDERR " PREIS IST DEFAULT-SELLPRICE", Dumper($form->{"sellprice_$i"}));
|
||
$pkr->{price} = $form->{"sellprice_$i"};
|
||
|
||
# if ($form->{tradediscount}){
|
||
# print (STDERR "TRADE--", Dumper($pkr->{price}));
|
||
# $pkr->{price} =$pkr->{price} * (1 - $form->{tradediscount});
|
||
# $pkr->{price} = $form->format_amount($myconfig,$pkr->{price},5);
|
||
# print (STDERR "TRADE--", Dumper($pkr->{price}));
|
||
# }
|
||
$pkr->{price} = $form->{"sellprice_$i"};
|
||
|
||
} else {
|
||
print STDERR " PREIS IST NICHT NULL\n";
|
||
$form->{"sellprice_$i"} = $pkr->{price};
|
||
|
||
$form->{"sellprice_$i"} = $pkr->{price};
|
||
}
|
||
# print (STDERR " PRICE", Dumper($pkr->{price}));
|
||
|
||
} else {
|
||
print STDERR " INIT ROW but what\n";
|
||
print (STDERR " PREIS -", Dumper($pkr->{price}), "Default", Dumper($pkr->{default_sellprice}));
|
||
if ($pkr->{price} == $pkr->{default_sellprice}) {
|
||
print (STDERR " PREIS IST DEFAULT-", Dumper($form->{"sellprice_$i"}));
|
||
$pkr->{price} = $form->{"sellprice_$i"};
|
||
$pkr->{selected} = ' selected';
|
||
|
||
$pkr->{price} = $form->{"sellprice_$i"};
|
||
$pkr->{selected} = ' selected';
|
||
}
|
||
}
|
||
}
|
||
if ($selectedpricegroup_id or $selectedpricegroup_id == 0){
|
||
if ($selectedpricegroup_id or $selectedpricegroup_id == 0) {
|
||
if ($selectedpricegroup_id ne $pricegroup_old) {
|
||
if ($pkr->{pricegroup_id} eq $selectedpricegroup_id) {
|
||
if ($price_new != $form->{"sellprice_$i"}) {
|
||
print STDERR " MANUELLEN PREIS W?HLEN\n";
|
||
} else {
|
||
print STDERR " UPDATE CHANGE PRICEGROUP\n";
|
||
$pkr->{selected} = ' selected';
|
||
$last->{selected} = '';
|
||
#$form->{"pricegroup_old_$i"} = $pkr->{$pricegroup_id};
|
||
$pkr->{selected} = ' selected';
|
||
$last->{selected} = '';
|
||
}
|
||
}
|
||
} else {
|
||
} else {
|
||
if (($price_new != $form->{"sellprice_$i"}) and ($price_new ne 0)) {
|
||
if ($pkr->{pricegroup_id} == 0) {
|
||
print STDERR " UPDATE CHANGE PRICEGROUP with price manuelly\n";
|
||
print (STDERR " SELLPRICE??? ---", Dumper($form->{"sellprice_$i"}));
|
||
print (STDERR " NEWPRICE??? ---", Dumper($price_new));
|
||
$pkr->{price} = $form->{"sellprice_$i"};
|
||
$pkr->{selected} = ' selected';
|
||
$last->{selected} = '';
|
||
#$form->{"sellprice_$i"} = $form->format_amount($myconfig, $price_new, 2);
|
||
# print (STDERR "----5555---", Dumper($pkr));
|
||
$pkr->{price} = $form->{"sellprice_$i"};
|
||
$pkr->{selected} = ' selected';
|
||
$last->{selected} = '';
|
||
}
|
||
} else {
|
||
if ($pkr->{pricegroup_id} eq $selectedpricegroup_id) {
|
||
print STDERR " UPDATE NO CHANGE\n";
|
||
$pkr->{selected} = ' selected';
|
||
$last->{selected} = '';
|
||
print STDERR " DEFAULTPRICE??? ---$pkr->{default_sellprice}\n";
|
||
print (STDERR " SELLPRICE??? ---", Dumper($form->{"sellprice_$i"}));
|
||
# print (STDERR " HIER DER SELLPRICE DEFAULT??? ---", Dumper($form));
|
||
print STDERR " NEWPRICE??? ---$price_new_\n";
|
||
if (($pkr->{pricegroup_id} == 0) and ($pkr->{price} == $form->{"sellprice_$i"})) {
|
||
print (STDERR " UPDATE NO CHANGE BUT PRICE MANUELLY SET", Dumper($pkr->{price}));
|
||
$pkr->{selected} = ' selected';
|
||
$last->{selected} = '';
|
||
if ( ($pkr->{pricegroup_id} == 0)
|
||
and ($pkr->{price} == $form->{"sellprice_$i"})) {
|
||
|
||
# $pkr->{price} = $form->{"sellprice_$i"};
|
||
} else {
|
||
} else {
|
||
$pkr->{price} = $form->{"sellprice_$i"};
|
||
}
|
||
#print (STDERR " FEHLER", Dumper($form->{"sellprice_$i"}));
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
|
||
$dbh->disconnect;
|
||
|
||
# print (STDERR "TEST", Dumper($form->{PRICES}));
|
||
# print (STDERR "TEST id_$i", Dumper($form->{"id_$i"}));
|
||
$main::lxdebug->leave_sub();
|
||
}
|
||
|
SL/PE.pm | ||
---|---|---|
WHERE $where
|
||
ORDER BY $sortorder|;
|
||
}
|
||
print STDERR "asdfasdf-$query\n";
|
||
|
||
$sth = $dbh->prepare($query);
|
||
$sth->execute || $form->dberror($query);
|
||
... | ... | |
#
|
||
sub get_pricegroup {
|
||
$main::lxdebug->enter_sub();
|
||
print STDERR "PE.pm-get_pricegroup\n";
|
||
|
||
my ($self, $myconfig, $form) = @_;
|
||
|
||
# connect to database
|
||
... | ... | |
$sth->finish;
|
||
|
||
$dbh->disconnect;
|
||
#print (STDERR " ", Dumper($form));
|
||
|
||
$main::lxdebug->leave_sub();
|
||
}
|
||
|
bin/mozilla/io.pl | ||
---|---|---|
qq|<td><input name="description_$i" size=30 value="$form->{"description_$i"}"></td>|;
|
||
}
|
||
|
||
(my $qty_dec) = ($form->{"qty_$i"} =~ /\.(\d+)/);
|
||
$qty_dec = length $qty_dec;
|
||
(my $qty_dec) = ($form->{"qty_$i"} =~ /\.(\d+)/);
|
||
$qty_dec = length $qty_dec;
|
||
|
||
$column_data{qty} =
|
||
qq|<td align=right><input name="qty_$i" size=5 value=|.
|
||
$form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec)
|
||
.qq|></td>|;
|
||
qq|<td align=right><input name="qty_$i" size=5 value=|
|
||
. $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec)
|
||
. qq|></td>|;
|
||
$column_data{ship} =
|
||
qq|<td align=right><input name="ship_$i" size=5 value=|
|
||
. $form->format_amount(\%myconfig, $form->{"ship_$i"})
|
||
... | ... | |
}
|
||
}
|
||
|
||
#print (STDERR "HIER", Dumper($prices) );
|
||
$lxdebug->leave_sub();
|
||
}
|
||
|
bin/mozilla/ir.pl | ||
---|---|---|
|
||
sub add {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "ir.pl-add\n";
|
||
|
||
$form->{title} = $locale->text('Add Vendor Invoice');
|
||
|
||
&invoice_links;
|
||
... | ... | |
|
||
sub invoice_links {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "ir.pl-invoice_links\n";
|
||
|
||
# create links
|
||
$form->{webdav} = $webdav;
|
||
|
||
... | ... | |
|
||
sub prepare_invoice {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "ir.pl-prepare_invoice\n";
|
||
|
||
if ($form->{id}) {
|
||
|
||
map { $form->{$_} =~ s/\"/"/g } qw(invnumber ordnumber quonumber);
|
||
... | ... | |
$form->{"sellprice_$i"} =
|
||
$form->format_amount(\%myconfig, $form->{"sellprice_$i"},
|
||
$decimalplaces);
|
||
|
||
|
||
(my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
|
||
$dec_qty = length $dec_qty;
|
||
|
||
$dec_qty = length $dec_qty;
|
||
|
||
$form->{"qty_$i"} =
|
||
$form->format_amount(\%myconfig, ($form->{"qty_$i"} * -1), $dec_qty);
|
||
|
||
... | ... | |
|
||
sub form_header {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "ir.pl-form_header\n";
|
||
|
||
# set option selected
|
||
foreach $item (qw(AP vendor currency department contact)) {
|
||
$form->{"select$item"} =~ s/ selected//;
|
||
... | ... | |
if ($form->{forex}) {
|
||
$exchangerate .= qq|
|
||
<th align=right nowrap>|
|
||
. $locale->text('Exchangerate')
|
||
. qq|</th>
|
||
. $locale->text('Exchangerate') . qq|</th>
|
||
<td>$form->{exchangerate}<input type=hidden name=exchangerate value=$form->{exchangerate}></td>
|
||
|;
|
||
} else {
|
||
$exchangerate .= qq|
|
||
<th align=right nowrap>|
|
||
. $locale->text('Exchangerate')
|
||
. qq|</th>
|
||
. $locale->text('Exchangerate') . qq|</th>
|
||
<td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
|
||
|;
|
||
}
|
||
... | ... | |
$button1 = qq|
|
||
<td><input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>
|
||
<td><input type=button name=invdate id="trigger1" value=|
|
||
. $locale->text('button')
|
||
. qq|></td>
|
||
. $locale->text('button') . qq|></td>
|
||
|;
|
||
$button2 = qq|
|
||
<td width="13"><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
|
||
<td width="4"><input type=button name=duedate id="trigger2" value=|
|
||
. $locale->text('button')
|
||
. qq|></td></td>
|
||
. $locale->text('button') . qq|></td></td>
|
||
|;
|
||
|
||
#write Trigger
|
||
... | ... | |
<td colspan=3>$vendor</td>
|
||
|
||
<th align=richt nowrap>|
|
||
. $locale->text('Contact Person')
|
||
. qq|</th>
|
||
. $locale->text('Contact Person') . qq|</th>
|
||
<td colspan=3>$contact</td>
|
||
|
||
<input type=hidden name=vendor_id value=$form->{vendor_id}>
|
||
... | ... | |
|
||
sub form_footer {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "ir.pl-form_footer\n";
|
||
|
||
$form->{invtotal} = $form->{invsubtotal};
|
||
|
||
if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
|
bin/mozilla/is.pl | ||
---|---|---|
|
||
sub edit {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "is.pl-edit\n";
|
||
|
||
$form->{title} = $locale->text('Edit Sales Invoice');
|
||
|
||
if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR")
|
||
... | ... | |
|
||
sub invoice_links {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "is.pl-invoice_links\n";
|
||
|
||
$form->{vc} = 'customer';
|
||
|
||
# create links
|
||
... | ... | |
|
||
sub prepare_invoice {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "is.pl-prepare_invoice\n";
|
||
|
||
$form->{type} = "invoice";
|
||
$form->{formname} = "invoice";
|
||
$form->{format} = "html";
|
||
... | ... | |
$form->{"sellprice_$i"} =
|
||
$form->format_amount(\%myconfig, $form->{"sellprice_$i"},
|
||
$decimalplaces);
|
||
|
||
|
||
(my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
|
||
$dec_qty = length $dec_qty;
|
||
|
||
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"},
|
||
$dec_qty);
|
||
$dec_qty = length $dec_qty;
|
||
|
||
$form->{"qty_$i"} =
|
||
$form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
|
||
|
||
map { $form->{"${_}_$i"} =~ s/\"/"/g }
|
||
qw(partnumber description unit partnotes);
|
||
... | ... | |
|
||
sub form_header {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "is.pl-form_header\n";
|
||
|
||
# set option selected
|
||
foreach $item (qw(AR customer currency department employee contact)) {
|
||
... | ... | |
|
||
sub form_footer {
|
||
$lxdebug->enter_sub();
|
||
print STDERR "is.pl-form_footer\n";
|
||
|
||
$form->{invtotal} = $form->{invsubtotal};
|
||
|
||
if (($rows = $form->numtextrows($form->{notes}, 26, 8)) < 2) {
|
||
... | ... | |
|
||
$sellprice = $form->format_amount(\%myconfig, $form->{"sellprice_$i"});
|
||
|
||
#print STDERR " SELLPRICE-111- $sellprice\n";
|
||
map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
|
||
qw(partnumber description unit);
|
||
map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
|
Auch abrufbar als: Unified diff
Preisgruppen Kommentar entfernt, nach Perltidy formatiert