Revision 028a4707
Von Sven Schöling vor etwa 19 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
561 | 561 |
# save detail record in invoice table |
562 | 562 |
$query = qq|INSERT INTO invoice (trans_id, parts_id, description, qty, |
563 | 563 |
sellprice, fxsellprice, discount, allocated, assemblyitem, |
564 |
unit, deliverydate, project_id, serialnumber, pricegroup_id) |
|
564 |
unit, deliverydate, project_id, serialnumber, pricegroup_id, |
|
565 |
ordnumber, transdate, cusordnumber) |
|
565 | 566 |
VALUES ($form->{id}, $form->{"id_$i"}, |
566 | 567 |
'$form->{"description_$i"}', $form->{"qty_$i"}, |
567 | 568 |
$form->{"sellprice_$i"}, $fxsellprice, |
568 | 569 |
$form->{"discount_$i"}, $allocated, 'f', |
569 | 570 |
'$form->{"unit_$i"}', $deliverydate, (SELECT id from project where projectnumber = '$project_id'), |
570 |
'$form->{"serialnumber_$i"}', |
|
571 |
'$pricegroup_id')|;
|
|
571 |
'$form->{"serialnumber_$i"}', '$pricegroup_id',
|
|
572 |
'$form->{"ordnumber_$i"}', '$form->{"transdate_$i"}', '$form->{"cusordnumber_$i"}')|;
|
|
572 | 573 |
$dbh->do($query) || $form->dberror($query); |
573 | 574 |
|
574 | 575 |
if ($form->{lizenzen}) { |
... | ... | |
1221 | 1222 |
i.discount, i.parts_id AS id, i.unit, i.deliverydate, |
1222 | 1223 |
i.project_id, pr.projectnumber, i.serialnumber, |
1223 | 1224 |
p.partnumber, p.assembly, p.bin, p.notes AS partnotes, i.id AS invoice_pos, |
1224 |
pg.partsgroup, i.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=i.pricegroup_id) as pricegroup |
|
1225 |
pg.partsgroup, i.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=i.pricegroup_id) as pricegroup, |
|
1226 |
i.ordnumber, i.transdate, i.cusordnumber |
|
1225 | 1227 |
FROM invoice i |
1226 | 1228 |
JOIN parts p ON (i.parts_id = p.id) |
1227 | 1229 |
LEFT JOIN project pr ON (i.project_id = pr.id) |
SL/OE.pm | ||
---|---|---|
324 | 324 |
$query = qq|INSERT INTO orderitems (|; |
325 | 325 |
$query .= "id, " if $form->{"orderitems_id_$i"}; |
326 | 326 |
$query .= qq|trans_id, parts_id, description, qty, sellprice, discount, |
327 |
unit, reqdate, project_id, serialnumber, ship, pricegroup_id) |
|
327 |
unit, reqdate, project_id, serialnumber, ship, pricegroup_id, |
|
328 |
ordnumber, transdate, cusordnumber) |
|
328 | 329 |
VALUES (|; |
329 | 330 |
$query .= qq|$form->{"orderitems_id_$i"},| |
330 | 331 |
if $form->{"orderitems_id_$i"}; |
... | ... | |
332 | 333 |
'$form->{"description_$i"}', $form->{"qty_$i"}, |
333 | 334 |
$fxsellprice, $form->{"discount_$i"}, |
334 | 335 |
'$form->{"unit_$i"}', $reqdate, (SELECT id from project where projectnumber = '$project_id'), |
335 |
'$form->{"serialnumber_$i"}', $form->{"ship_$i"}, |
|
336 |
'$pricegroup_id')|;
|
|
336 |
'$form->{"serialnumber_$i"}', $form->{"ship_$i"}, '$pricegroup_id',
|
|
337 |
'$form->{"ordnumber_$i"}', '$form->{"transdate_$i"}', '$form->{"cusordnumber_$i"}')|;
|
|
337 | 338 |
$dbh->do($query) || $form->dberror($query); |
338 | 339 |
|
339 | 340 |
$form->{"sellprice_$i"} = $fxsellprice; |
... | ... | |
582 | 583 |
# connect to database |
583 | 584 |
my $dbh = $form->dbconnect_noauto($myconfig); |
584 | 585 |
|
585 |
my $query; |
|
586 |
my $query, @ids;
|
|
586 | 587 |
|
587 | 588 |
# translate the ids (given by id_# and trans_id_#) into one array of ids, so we can join them later |
588 | 589 |
map { push @ids, $form->{"trans_id_$_"} if ($form->{"id_$_"}) } (1 .. $form->{"rowcount"}); |
... | ... | |
708 | 709 |
c1.accno AS inventory_accno, |
709 | 710 |
c2.accno AS income_accno, |
710 | 711 |
c3.accno AS expense_accno, |
711 |
oe.ordnumber, oe.transdate, oe.cusordnumber,
|
|
712 |
oe.ordnumber AS ordnumber_oe, oe.transdate AS transdate_oe, oe.cusordnumber AS cusordnumber_oe,
|
|
712 | 713 |
p.partnumber, p.assembly, o.description, o.qty, |
713 | 714 |
o.sellprice, o.parts_id AS id, o.unit, o.discount, p.bin, p.notes AS partnotes, |
714 | 715 |
o.reqdate, o.project_id, o.serialnumber, o.ship, |
716 |
o.ordnumber, o.transdate, o.cusordnumber, |
|
715 | 717 |
pr.projectnumber, |
716 | 718 |
pg.partsgroup, o.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=o.pricegroup_id) as pricegroup |
717 | 719 |
FROM orderitems o |
... | ... | |
732 | 734 |
$sth->execute || $form->dberror($query); |
733 | 735 |
|
734 | 736 |
while ($ref = $sth->fetchrow_hashref(NAME_lc)) { |
737 |
|
|
738 |
# in collective order, copy global ordnumber, transdate, cusordnumber into item scope |
|
739 |
# unless already present there |
|
740 |
# remove _oe entries afterwards |
|
741 |
map { $ref->{$_} = $ref->{"${_}_oe"} if ($ref->{$_} eq '') } |
|
742 |
qw|ordnumber transdate cusordnumber| if (@ids); |
|
743 |
map{ delete $ref->{$_} } |
|
744 |
qw|ordnumber_oe transdate_oe cusordnumber_oe|; |
|
735 | 745 |
|
736 | 746 |
#set expense_accno=inventory_accno if they are different => bilanz |
737 | 747 |
$vendor_accno = |
sql/Pg-upgrade-2.1.1-2.1.2.sql | ||
---|---|---|
67 | 67 |
update invoice set fxsellprice=fxsellpriceold; |
68 | 68 |
alter table invoice drop column fxsellpriceold; |
69 | 69 |
-- |
70 |
alter table invoice add column ordnumber text; |
|
71 |
alter table invoice add column transdate text; |
|
72 |
alter table invoice add column cusordnumber text; |
|
73 |
-- |
|
70 | 74 |
--TABLE oe |
71 | 75 |
alter table oe rename column amount to amountold; |
72 | 76 |
alter table oe add column amount numeric(15,5); |
... | ... | |
84 | 88 |
update orderitems set sellprice=sellpriceold; |
85 | 89 |
alter table orderitems drop column sellpriceold; |
86 | 90 |
-- |
91 |
alter table orderitems add column ordnumber text; |
|
92 |
alter table orderitems add column transdate text; |
|
93 |
alter table orderitems add column cusordnumber text; |
|
94 |
-- |
|
87 | 95 |
--TABLE parts |
88 | 96 |
alter table parts rename column listprice to listpriceold; |
89 | 97 |
alter table parts add column listprice numeric(15,5); |
sql/lx-office.sql | ||
---|---|---|
161 | 161 |
"serialnumber" text, |
162 | 162 |
"itime" timestamp DEFAULT now(), |
163 | 163 |
"mtime" timestamp, |
164 |
"pricegroup_id" integer |
|
164 |
"pricegroup_id" integer, |
|
165 |
"ordnumber" text, |
|
166 |
"transdate" text, |
|
167 |
"cusordnumber" text |
|
165 | 168 |
); |
166 | 169 |
|
167 | 170 |
CREATE TABLE "vendor" ( |
... | ... | |
397 | 400 |
"id" integer DEFAULT nextval('orderitemsid'::text) PRIMARY KEY, |
398 | 401 |
"itime" timestamp DEFAULT now(), |
399 | 402 |
"mtime" timestamp, |
400 |
"pricegroup_id" integer |
|
403 |
"pricegroup_id" integer, |
|
404 |
"ordnumber" text, |
|
405 |
"transdate" text, |
|
406 |
"cusordnumber" text |
|
401 | 407 |
); |
402 | 408 |
|
403 | 409 |
CREATE TABLE "exchangerate" ( |
Auch abrufbar als: Unified diff
DB-Schema geaendert um in invoice und orderitems die Variablen ordnumber_$i, transdate_$i, cusordnumber_$i zu speichern.
Speichern/Laden von Auftraegen und Buchen/Laden von Rechnungen modifiziert um diese Variablen zu halten.