Hinweis von Moritz bzgl. Rechnungsnummer für Gutschrift:
authorJan Büren <jan@lx-office-hosting.de>
Fri, 4 Mar 2011 09:51:57 +0000 (10:51 +0100)
committerJan Büren <jan@lx-office-hosting.de>
Fri, 4 Mar 2011 09:51:57 +0000 (10:51 +0100)
> so, wie du das Feature implementiert hast, funktioniert es aber nur
> genau in dem Moment, in dem du die Gutschrift direkt nach der Umwandlung
> aus der Rechnung heraus ausdruckst. Wenn du sie später via Verkauf ->
> Berichte aufrufst, so wird das Feld invnumber_for_credit_note leer
> sein, weil du es nicht in der Datenbank speicherst.
Indeed. Das hatte ich in meinem ersten Enthusiasmus übersehen. Gleich mehr
...

SL/IS.pm
sql/Pg-upgrade2/ar_add_invnumber_for_credit_note.sql [new file with mode: 0644]

index 3936e92..a940355 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -1009,7 +1009,7 @@ sub post_invoice {
                 cp_id       = ?, marge_total   = ?, marge_percent = ?,
                 globalproject_id               = ?, delivery_customer_id             = ?,
                 transaction_description        = ?, delivery_vendor_id               = ?,
-                donumber    = ?
+                donumber    = ?, invnumber_for_credit_note = ?
               WHERE id = ?|;
   @values = (          $form->{"invnumber"},           $form->{"ordnumber"},             $form->{"quonumber"},          $form->{"cusordnumber"},
              conv_date($form->{"invdate"}),  conv_date($form->{"orddate"}),    conv_date($form->{"quodate"}),    conv_i($form->{"customer_id"}),
@@ -1022,7 +1022,7 @@ sub post_invoice {
                 conv_i($form->{"cp_id"}),            1 * $form->{marge_total} ,      1 * $form->{marge_percent},
                 conv_i($form->{"globalproject_id"}),                              conv_i($form->{"delivery_customer_id"}),
                        $form->{transaction_description},                          conv_i($form->{"delivery_vendor_id"}),
-                       $form->{"donumber"}, #das entsprechende feld lieferscheinnummer aus der html-form 12.02.09 jb
+                       $form->{"donumber"}, $form->{"invnumber_for_credit_note"},
                 conv_i($form->{"id"}));
   do_query($form, $dbh, $query, @values);
 
@@ -1452,9 +1452,9 @@ sub retrieve_invoice {
            a.duedate, a.taxincluded, a.curr AS currency, a.shipto_id, a.cp_id,
            a.employee_id, a.salesman_id, a.payment_id,
            a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type,
-           a.transaction_description,
+           a.transaction_description, a.donumber, a.invnumber_for_credit_note,
            a.marge_total, a.marge_percent,
-           e.name AS employee, a.donumber
+           e.name AS employee
          FROM ar a
          LEFT JOIN employee e ON (e.id = a.employee_id)
          WHERE a.id = ?|;
diff --git a/sql/Pg-upgrade2/ar_add_invnumber_for_credit_note.sql b/sql/Pg-upgrade2/ar_add_invnumber_for_credit_note.sql
new file mode 100644 (file)
index 0000000..0eaeade
--- /dev/null
@@ -0,0 +1,5 @@
+-- @tag: ar_add_invnumber_for_credit_note
+-- @description: Die Rechnungsnummer wird bei Gutschriften bisher nicht uebernommen. Das aendert sich mit diesem Update. Hierfuer muss allerdings die Rechnungstabelle ar um einen entsprechenden Eintrag erweitert werden. (invnumber_for_credit_note in ar)
+-- @depends: delivery_orders
+alter table ar add column invnumber_for_credit_note text;
+