Revision 464f44ac
Von Moritz Bunkus vor mehr als 9 Jahren hinzugefügt
SL/AR.pm | ||
---|---|---|
458 | 458 |
my $query = |
459 | 459 |
qq|SELECT DISTINCT a.id, a.invnumber, a.ordnumber, a.cusordnumber, a.transdate, | . |
460 | 460 |
qq| a.duedate, a.netamount, a.amount, a.paid, | . |
461 |
qq| a.invoice, a.datepaid, a.terms, a.notes, a.shipvia, | .
|
|
461 |
qq| a.invoice, a.datepaid, a.notes, a.shipvia, | . |
|
462 | 462 |
qq| a.shippingpoint, a.storno, a.storno_id, a.globalproject_id, | . |
463 | 463 |
qq| a.marge_total, a.marge_percent, | . |
464 | 464 |
qq| a.transaction_description, | . |
SL/DB/DeliveryOrder.pm | ||
---|---|---|
50 | 50 |
|
51 | 51 |
sub items { goto &orderitems; } |
52 | 52 |
sub add_items { goto &add_orderitems; } |
53 |
sub payment_terms { goto &payment; } |
|
53 | 54 |
|
54 | 55 |
sub sales_order { |
55 | 56 |
my $self = shift; |
... | ... | |
104 | 105 |
$item_parent_column = 'order'; |
105 | 106 |
} |
106 | 107 |
|
107 |
my $terms = $source->can('payment_id') && $source->payment_id ? $source->payment_terms->terms_netto : 0; |
|
108 |
|
|
109 | 108 |
my %args = ( map({ ( $_ => $source->$_ ) } qw(cp_id currency_id customer_id cusordnumber department_id employee_id globalproject_id intnotes language_id notes |
110 |
ordnumber reqdate salesman_id shippingpoint shipvia taxincluded taxzone_id transaction_description vendor_id |
|
109 |
ordnumber payment_id reqdate salesman_id shippingpoint shipvia taxincluded taxzone_id transaction_description vendor_id
|
|
111 | 110 |
)), |
112 | 111 |
closed => 0, |
113 | 112 |
is_sales => !!$source->customer_id, |
114 | 113 |
delivered => 0, |
115 |
terms => $terms, |
|
116 | 114 |
transdate => DateTime->today_local, |
117 | 115 |
); |
118 | 116 |
|
SL/DB/Helper/FlattenToForm.pm | ||
---|---|---|
16 | 16 |
|
17 | 17 |
_copy($self, $form, '', '', 0, qw(id type taxzone_id ordnumber quonumber invnumber donumber cusordnumber taxincluded shippingpoint shipvia notes intnotes cp_id |
18 | 18 |
employee_id salesman_id closed department_id language_id payment_id delivery_customer_id delivery_vendor_id shipto_id proforma |
19 |
globalproject_id delivered transaction_description container_type accepted_by_customer invoice terms storno storno_id dunning_config_id
|
|
19 |
globalproject_id delivered transaction_description container_type accepted_by_customer invoice storno storno_id dunning_config_id |
|
20 | 20 |
orddate quodate reqdate gldate duedate deliverydate datepaid transdate delivery_term_id)); |
21 | 21 |
$form->{currency} = $form->{curr} = $self->currency_id ? $self->currency->name || '' : ''; |
22 | 22 |
|
SL/DB/Invoice.pm | ||
---|---|---|
138 | 138 |
|
139 | 139 |
require SL::DB::Employee; |
140 | 140 |
|
141 |
my $terms = $source->can('payment_id') && $source->payment_id ? $source->payment_terms |
|
142 |
: $source->customer_id ? $source ->customer->payment_terms |
|
143 |
: undef; |
|
144 |
|
|
145 | 141 |
my (@columns, @item_columns, $item_parent_id_column, $item_parent_column); |
146 | 142 |
|
147 | 143 |
if (ref($source) eq 'SL::DB::Order') { |
148 |
@columns = qw(quonumber payment_id delivery_customer_id delivery_vendor_id);
|
|
144 |
@columns = qw(quonumber delivery_customer_id delivery_vendor_id); |
|
149 | 145 |
@item_columns = qw(subtotal); |
150 | 146 |
|
151 | 147 |
$item_parent_id_column = 'trans_id'; |
... | ... | |
158 | 154 |
$item_parent_column = 'delivery_order'; |
159 | 155 |
} |
160 | 156 |
|
157 |
my $terms = $source->can('payment_id') ? $source->payment_terms : undef; |
|
158 |
|
|
161 | 159 |
my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes salesman_id cusordnumber ordnumber department_id |
162 |
cp_id language_id taxzone_id shipto_id globalproject_id transaction_description currency_id delivery_term_id), @columns), |
|
160 |
cp_id language_id taxzone_id shipto_id globalproject_id transaction_description currency_id delivery_term_id payment_id), @columns),
|
|
163 | 161 |
transdate => DateTime->today_local, |
164 | 162 |
gldate => DateTime->today_local, |
165 |
duedate => DateTime->today_local->add(days => ($terms ? $terms->terms_netto * 1 : 1)), |
|
166 |
payment_id => $terms ? $terms->id : undef, |
|
163 |
duedate => $terms ? $terms->calc_date(reference_date => DateTime->today_local) : DateTime->today_local, |
|
167 | 164 |
invoice => 1, |
168 | 165 |
type => 'invoice', |
169 | 166 |
storno => 0, |
SL/DB/MetaSetup/Customer.pm | ||
---|---|---|
54 | 54 |
taxincluded_checked => { type => 'boolean' }, |
55 | 55 |
taxnumber => { type => 'text' }, |
56 | 56 |
taxzone_id => { type => 'integer', not_null => 1 }, |
57 |
terms => { type => 'integer', default => '0' }, |
|
58 | 57 |
user_password => { type => 'text' }, |
59 | 58 |
username => { type => 'text' }, |
60 | 59 |
ustid => { type => 'text' }, |
SL/DB/MetaSetup/DeliveryOrder.pm | ||
---|---|---|
29 | 29 |
notes => { type => 'text' }, |
30 | 30 |
ordnumber => { type => 'text' }, |
31 | 31 |
oreqnumber => { type => 'text' }, |
32 |
payment_id => { type => 'integer' }, |
|
32 | 33 |
reqdate => { type => 'date' }, |
33 | 34 |
salesman_id => { type => 'integer' }, |
34 | 35 |
shippingpoint => { type => 'text' }, |
... | ... | |
36 | 37 |
shipvia => { type => 'text' }, |
37 | 38 |
taxincluded => { type => 'boolean' }, |
38 | 39 |
taxzone_id => { type => 'integer', not_null => 1 }, |
39 |
terms => { type => 'integer' }, |
|
40 | 40 |
transaction_description => { type => 'text' }, |
41 | 41 |
transdate => { type => 'date', default => 'now()' }, |
42 | 42 |
vendor_id => { type => 'integer' }, |
... | ... | |
87 | 87 |
key_columns => { language_id => 'id' }, |
88 | 88 |
}, |
89 | 89 |
|
90 |
payment => { |
|
91 |
class => 'SL::DB::PaymentTerm', |
|
92 |
key_columns => { payment_id => 'id' }, |
|
93 |
}, |
|
94 |
|
|
90 | 95 |
salesman => { |
91 | 96 |
class => 'SL::DB::Employee', |
92 | 97 |
key_columns => { salesman_id => 'id' }, |
SL/DB/MetaSetup/Invoice.pm | ||
---|---|---|
53 | 53 |
storno_id => { type => 'integer' }, |
54 | 54 |
taxincluded => { type => 'boolean' }, |
55 | 55 |
taxzone_id => { type => 'integer', not_null => 1 }, |
56 |
terms => { type => 'integer', default => '0' }, |
|
57 | 56 |
transaction_description => { type => 'text' }, |
58 | 57 |
transdate => { type => 'date', default => 'now' }, |
59 | 58 |
type => { type => 'text' }, |
SL/DB/MetaSetup/Vendor.pm | ||
---|---|---|
26 | 26 |
department_2 => { type => 'text' }, |
27 | 27 |
depositor => { type => 'text' }, |
28 | 28 |
direct_debit => { type => 'boolean', default => 'false' }, |
29 |
discount => { type => 'float', scale => 4 }, |
|
29 |
discount => { type => 'float', precision => 4, scale => 4 },
|
|
30 | 30 |
email => { type => 'text' }, |
31 | 31 |
fax => { type => 'text' }, |
32 | 32 |
greeting => { type => 'text' }, |
... | ... | |
47 | 47 |
taxincluded => { type => 'boolean' }, |
48 | 48 |
taxnumber => { type => 'text' }, |
49 | 49 |
taxzone_id => { type => 'integer', not_null => 1 }, |
50 |
terms => { type => 'integer', default => '0' }, |
|
51 | 50 |
user_password => { type => 'text' }, |
52 | 51 |
username => { type => 'text' }, |
53 | 52 |
ustid => { type => 'text' }, |
SL/DO.pm | ||
---|---|---|
460 | 460 |
shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, closed = ?, |
461 | 461 |
delivered = ?, department_id = ?, language_id = ?, shipto_id = ?, |
462 | 462 |
globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?, |
463 |
is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, currency_id = (SELECT id FROM currencies WHERE name = ?),
|
|
463 |
is_sales = ?, taxzone_id = ?, taxincluded = ?, payment_id = ?, currency_id = (SELECT id FROM currencies WHERE name = ?),
|
|
464 | 464 |
delivery_term_id = ? |
465 | 465 |
WHERE id = ?|; |
466 | 466 |
|
... | ... | |
475 | 475 |
conv_i($form->{salesman_id}), conv_i($form->{cp_id}), |
476 | 476 |
$form->{transaction_description}, |
477 | 477 |
$form->{type} =~ /^sales/ ? 't' : 'f', |
478 |
conv_i($form->{taxzone_id}), $form->{taxincluded} ? 't' : 'f', conv_i($form->{terms}), $form->{currency},
|
|
478 |
conv_i($form->{taxzone_id}), $form->{taxincluded} ? 't' : 'f', conv_i($form->{payment_id}), $form->{currency},
|
|
479 | 479 |
conv_i($form->{delivery_term_id}), |
480 | 480 |
conv_i($form->{id})); |
481 | 481 |
do_query($form, $dbh, $query, @values); |
... | ... | |
689 | 689 |
d.description AS department, dord.language_id, |
690 | 690 |
dord.shipto_id, |
691 | 691 |
dord.globalproject_id, dord.delivered, dord.transaction_description, |
692 |
dord.taxzone_id, dord.taxincluded, dord.terms, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency,
|
|
692 |
dord.taxzone_id, dord.taxincluded, dord.payment_id, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency,
|
|
693 | 693 |
dord.delivery_term_id, dord.itime::DATE AS insertdate |
694 | 694 |
FROM delivery_orders dord |
695 | 695 |
JOIN ${vc} cv ON (dord.${vc}_id = cv.id) |
SL/Form.pm | ||
---|---|---|
2919 | 2919 |
"d.description" => "department", |
2920 | 2920 |
"ct.name" => $table, |
2921 | 2921 |
"cu.name" => "currency", |
2922 |
"current_date + ct.terms" => "duedate", |
|
2923 | 2922 |
); |
2924 | 2923 |
|
2925 | 2924 |
if ($self->{type} =~ /delivery_order/) { |
SL/IR.pm | ||
---|---|---|
1129 | 1129 |
my $query = |
1130 | 1130 |
qq|SELECT |
1131 | 1131 |
v.id AS vendor_id, v.name AS vendor, v.discount as vendor_discount, |
1132 |
v.creditlimit, v.terms, v.notes AS intnotes,
|
|
1132 |
v.creditlimit, v.notes AS intnotes, |
|
1133 | 1133 |
v.email, v.cc, v.bcc, v.language_id, v.payment_id, v.delivery_term_id, |
1134 | 1134 |
v.street, v.zipcode, v.city, v.country, v.taxzone_id, cu.name AS curr, v.direct_debit, |
1135 | 1135 |
$duedate + COALESCE(pt.terms_netto, 0) AS duedate, |
SL/IS.pm | ||
---|---|---|
68 | 68 |
my $dbh = $form->get_standard_dbh; |
69 | 69 |
my $sth; |
70 | 70 |
|
71 |
my $query = qq|SELECT date | . conv_dateq($form->{duedate}) . qq| - date | . conv_dateq($form->{invdate}) . qq| AS terms|; |
|
72 |
($form->{terms}) = selectrow_query($form, $dbh, $query); |
|
73 |
|
|
74 | 71 |
my (@project_ids); |
75 | 72 |
$form->{TEMPLATE_ARRAYS} = {}; |
76 | 73 |
|
... | ... | |
354 | 351 |
$sortorder = qq|ORDER BY a.oid|; |
355 | 352 |
} |
356 | 353 |
|
357 |
$query = |
|
354 |
my $query =
|
|
358 | 355 |
qq|SELECT p.partnumber, p.description, p.unit, a.qty, pg.partsgroup |
359 | 356 |
FROM assembly a |
360 | 357 |
JOIN parts p ON (a.parts_id = p.id) |
... | ... | |
1170 | 1167 |
transdate = ?, orddate = ?, quodate = ?, customer_id = ?, |
1171 | 1168 |
amount = ?, netamount = ?, paid = ?, |
1172 | 1169 |
duedate = ?, deliverydate = ?, invoice = ?, shippingpoint = ?, |
1173 |
shipvia = ?, terms = ?, notes = ?, intnotes = ?,
|
|
1170 |
shipvia = ?, notes = ?, intnotes = ?,
|
|
1174 | 1171 |
currency_id = (SELECT id FROM currencies WHERE name = ?), |
1175 | 1172 |
department_id = ?, payment_id = ?, taxincluded = ?, |
1176 | 1173 |
type = ?, language_id = ?, taxzone_id = ?, shipto_id = ?, |
... | ... | |
1185 | 1182 |
conv_date($form->{"invdate"}), conv_date($form->{"orddate"}), conv_date($form->{"quodate"}), conv_i($form->{"customer_id"}), |
1186 | 1183 |
$amount, $netamount, $form->{"paid"}, |
1187 | 1184 |
conv_date($form->{"duedate"}), conv_date($form->{"deliverydate"}), '1', $form->{"shippingpoint"}, |
1188 |
$form->{"shipvia"}, conv_i($form->{"terms"}), $restricter->process($form->{"notes"}), $form->{"intnotes"},
|
|
1185 |
$form->{"shipvia"}, $restricter->process($form->{"notes"}), $form->{"intnotes"},
|
|
1189 | 1186 |
$form->{"currency"}, conv_i($form->{"department_id"}), conv_i($form->{"payment_id"}), $form->{"taxincluded"} ? 't' : 'f', |
1190 | 1187 |
$form->{"type"}, conv_i($form->{"language_id"}), conv_i($form->{"taxzone_id"}), conv_i($form->{"shipto_id"}), |
1191 | 1188 |
conv_i($form->{"employee_id"}), conv_i($form->{"salesman_id"}), conv_i($form->{storno_id}), $form->{"storno"} ? 't' : 'f', |
... | ... | |
1816 | 1813 |
a.invnumber, a.ordnumber, a.quonumber, a.cusordnumber, |
1817 | 1814 |
a.orddate, a.quodate, a.globalproject_id, |
1818 | 1815 |
a.transdate AS invdate, a.deliverydate, a.paid, a.storno, a.gldate, |
1819 |
a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes, a.taxzone_id,
|
|
1816 |
a.shippingpoint, a.shipvia, a.notes, a.intnotes, a.taxzone_id, |
|
1820 | 1817 |
a.duedate, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.shipto_id, a.cp_id, |
1821 | 1818 |
a.employee_id, a.salesman_id, a.payment_id, |
1822 | 1819 |
a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type, |
... | ... | |
1983 | 1980 |
# get customer |
1984 | 1981 |
$query = |
1985 | 1982 |
qq|SELECT |
1986 |
c.id AS customer_id, c.name AS customer, c.discount as customer_discount, c.creditlimit, c.terms,
|
|
1983 |
c.id AS customer_id, c.name AS customer, c.discount as customer_discount, c.creditlimit, |
|
1987 | 1984 |
c.email, c.cc, c.bcc, c.language_id, c.payment_id, c.delivery_term_id, |
1988 | 1985 |
c.street, c.zipcode, c.city, c.country, |
1989 | 1986 |
c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id, cu.name AS curr, |
bin/mozilla/do.pl | ||
---|---|---|
836 | 836 |
my $currency = $form->{currency}; |
837 | 837 |
invoice_links(); |
838 | 838 |
|
839 |
if ($form->{ordnumber}) { |
|
840 |
require SL::DB::Order; |
|
841 |
if (my $order = SL::DB::Manager::Order->find_by(ordnumber => $form->{ordnumber})) { |
|
842 |
$order->load; |
|
843 |
$form->{orddate} = $order->transdate_as_date; |
|
844 |
$form->{$_} = $order->$_ for qw(payment_id salesman_id taxzone_id quonumber); |
|
845 |
} |
|
846 |
} |
|
847 |
|
|
848 | 839 |
$form->{currency} = $currency; |
849 | 840 |
$form->{exchangerate} = ""; |
850 | 841 |
$form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, $buysell); |
sql/Pg-upgrade2/remove_terms_add_payment_id.sql | ||
---|---|---|
1 |
-- @tag: remove_terms_add_payment_id |
|
2 |
-- @description: In betroffenen Tabellen die veraltete Spalte »terms« löschen und dort, wo sie fehlt, payment_id ergänzen |
|
3 |
-- @depends: release_3_2_0 |
|
4 |
|
|
5 |
ALTER TABLE delivery_orders ADD COLUMN payment_id INTEGER; |
|
6 |
ALTER TABLE delivery_orders ADD FOREIGN KEY (payment_id) REFERENCES payment_terms (id); |
|
7 |
|
|
8 |
UPDATE delivery_orders |
|
9 |
SET payment_id = ( |
|
10 |
SELECT oe.payment_id |
|
11 |
FROM record_links rl |
|
12 |
LEFT JOIN oe ON rl.from_id = oe.id |
|
13 |
WHERE (rl.from_table = 'oe') |
|
14 |
AND (rl.to_table = 'delivery_orders') |
|
15 |
AND (rl.to_id = delivery_orders.id) |
|
16 |
ORDER BY rl.itime DESC |
|
17 |
LIMIT 1 |
|
18 |
); |
|
19 |
|
|
20 |
ALTER TABLE ar DROP COLUMN terms; |
|
21 |
ALTER TABLE customer DROP COLUMN terms; |
|
22 |
ALTER TABLE delivery_orders DROP COLUMN terms; |
|
23 |
ALTER TABLE vendor DROP COLUMN terms; |
templates/webpages/do/form_header.html | ||
---|---|---|
84 | 84 |
<input type="hidden" name="max_dunning_level" value="[% HTML.escape(max_dunning_level) %]"> |
85 | 85 |
<input type="hidden" name="media" value="[% HTML.escape(media) %]"> |
86 | 86 |
<input type="hidden" name="message" value="[% HTML.escape(message) %]"> |
87 |
<input type="hidden" name="payment_id" value="[% HTML.escape(payment_id) %]"> |
|
87 | 88 |
<input type="hidden" name="printed" value="[% HTML.escape(printed) %]"> |
88 | 89 |
<input type="hidden" name="proforma" value="[% HTML.escape(proforma) %]"> |
89 | 90 |
<input type="hidden" name="queued" value="[% HTML.escape(queued) %]"> |
... | ... | |
105 | 106 |
<input type="hidden" name="subject" value="[% HTML.escape(subject) %]"> |
106 | 107 |
<input type="hidden" name="taxincluded" value="[% HTML.escape(taxincluded) %]"> |
107 | 108 |
<input type="hidden" name="taxzone_id" value="[% HTML.escape(taxzone_id) %]"> |
108 |
<input type="hidden" name="terms" value="[% HTML.escape(terms) %]"> |
|
109 | 109 |
<input type="hidden" name="title" value="[% HTML.escape(title) %]"> |
110 | 110 |
<input type="hidden" name="type" value="[% HTML.escape(type) %]"> |
111 | 111 |
<input type="hidden" name="vc" value="[% HTML.escape(vc) %]"> |
Auch abrufbar als: Unified diff
Zahlungsbedingungen bei Lieferscheinen; veraltete Spalte »terms« entfernt