Merge von 599-602,605,614,615 aus unstable: Preisgruppen Teil 1
[kivitendo-erp.git] / bin / mozilla / ic.pl
index 6d49eab..0e7fdf5 100644 (file)
@@ -32,6 +32,7 @@
 #======================================================================
 
 use SL::IC;
+#use SL::PE;
 
 require "$form->{path}/io.pl";
 
@@ -50,7 +51,7 @@ sub add {
 
   $form->{unit} =
     ($form->{item} eq 'service') ? $locale->text('hr') : $locale->text('ea');
-
+  IC->get_pricegroups(\%myconfig, \%$form);
   &link_part;
   &display_form;
 
@@ -84,14 +85,12 @@ sub search {
     $button1 = qq|
        <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>
        <td><input type=button name=transdatefrom id="trigger1" value=|
-      . $locale->text('button')
-      . qq|></td>
+      . $locale->text('button') . qq|></td>
       |;
     $button2 = qq|
        <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>
        <td><input type=button name=transdateto name=transdateto id="trigger2" value=|
-      . $locale->text('button')
-      . qq|></td>
+      . $locale->text('button') . qq|></td>
      |;
 
     #write Trigger
@@ -132,8 +131,7 @@ sub search {
 
     $l_serialnumber = qq|
         <td><input name=l_serialnumber class=checkbox type=checkbox value=Y>&nbsp;|
-      . $locale->text('Serial Number')
-      . qq|</td>
+      . $locale->text('Serial Number') . qq|</td>
 |;
 
   }
@@ -272,8 +270,7 @@ sub search {
         </tr>
         <tr>
           <th align=right nowrap>|
-    . $locale->text('Part Description')
-    . qq|</th>
+    . $locale->text('Part Description') . qq|</th>
           <td colspan=3><input name=description size=40></td>
         </tr>
        <tr>
@@ -310,71 +307,53 @@ sub search {
        </tr>
        <tr>
           <th align=right nowrap>|
-    . $locale->text('Include in Report')
-    . qq|</th>
+    . $locale->text('Include in Report') . qq|</th>
           <td colspan=3>
             <table>
               <tr>
                 <td><input name=l_partnumber class=checkbox type=checkbox value=Y checked>&nbsp;|
-    . $locale->text('Part Number')
-    . qq|</td>
+    . $locale->text('Part Number') . qq|</td>
                <td><input name=l_description class=checkbox type=checkbox value=Y checked>&nbsp;|
-    . $locale->text('Part Description')
-    . qq|</td>
+    . $locale->text('Part Description') . qq|</td>
                $l_serialnumber
                <td><input name=l_unit class=checkbox type=checkbox value=Y checked>&nbsp;|
-    . $locale->text('Unit of measure')
-    . qq|</td>
+    . $locale->text('Unit of measure') . qq|</td>
              </tr>
              <tr>
                 <td><input name=l_listprice class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('List Price')
-    . qq|</td>
+    . $locale->text('List Price') . qq|</td>
                <td><input name=l_sellprice class=checkbox type=checkbox value=Y checked>&nbsp;|
-    . $locale->text('Sell Price')
-    . qq|</td>
+    . $locale->text('Sell Price') . qq|</td>
                <td><input name=l_lastcost class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('Last Cost')
-    . qq|</td>
+    . $locale->text('Last Cost') . qq|</td>
                <td><input name=l_linetotal class=checkbox type=checkbox value=Y checked>&nbsp;|
-    . $locale->text('Line Total')
-    . qq|</td>
+    . $locale->text('Line Total') . qq|</td>
              </tr>
              <tr>
                 <td><input name=l_priceupdate class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('Updated')
-    . qq|</td>
+    . $locale->text('Updated') . qq|</td>
                <td><input name=l_bin class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('Bin')
-    . qq|</td>
+    . $locale->text('Bin') . qq|</td>
                <td><input name=l_rop class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('ROP')
-    . qq|</td>
+    . $locale->text('ROP') . qq|</td>
                <td><input name=l_weight class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('Weight')
-    . qq|</td>
+    . $locale->text('Weight') . qq|</td>
               </tr>
              <tr>
                 <td><input name=l_image class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('Image')
-    . qq|</td>
+    . $locale->text('Image') . qq|</td>
                <td><input name=l_drawing class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('Drawing')
-    . qq|</td>
+    . $locale->text('Drawing') . qq|</td>
                <td><input name=l_microfiche class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('Microfiche')
-    . qq|</td>
+    . $locale->text('Microfiche') . qq|</td>
                <td><input name=l_partsgroup class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('Group')
-    . qq|</td>
+    . $locale->text('Group') . qq|</td>
               </tr>
              <tr>
                 <td><input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('Subtotal')
-    . qq|</td>
+    . $locale->text('Subtotal') . qq|</td>
                <td><input name=l_soldtotal class=checkbox type=checkbox value=Y>&nbsp;|
-    . $locale->text('soldtotal')
-    . qq|</td>
+    . $locale->text('soldtotal') . qq|</td>
              </tr>
             </table>
           </td>
@@ -433,11 +412,9 @@ sub choice {
       <table>
        <tr class=listheading>
          <th class=listheading nowrap>|
-    . $locale->text('Part Number')
-    . qq|</th>
+    . $locale->text('Part Number') . qq|</th>
          <th class=listheading nowrap>|
-    . $locale->text('Part Description')
-    . qq|</th>
+    . $locale->text('Part Description') . qq|</th>
         </tr>
         <tr valign=top>
          <td><input type=text name=partnumber size=20 value=></td>
@@ -858,10 +835,9 @@ sub addtop100 {
     $option   .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
   }
 
-  @columns =
-    $form->sort_columns(
+  @columns = $form->sort_columns(
     qw(number partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal)
-    );
+  );
 
   if ($form->{l_linetotal}) {
     $form->{l_onhand} = "Y";
@@ -1441,10 +1417,9 @@ sub generate_report {
     $option   .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
   }
 
-  @columns =
-    $form->sort_columns(
+  @columns = $form->sort_columns(
     qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal)
-    );
+  );
 
   if ($form->{l_linetotal}) {
     $form->{l_onhand} = "Y";
@@ -1921,7 +1896,9 @@ sub link_part {
   delete $form->{amount};
 
   $form->get_partsgroup(\%myconfig, { all => 1 });
+
   $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}";
+
   if (@{ $form->{all_partsgroup} }) {
     $form->{selectpartsgroup} = qq|<option>\n|;
     map {
@@ -2018,6 +1995,7 @@ sub form_header {
       }
     }
   }
+
   if ($form->{selectpartsgroup}) {
     $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup});
     $partsgroup =
@@ -2044,8 +2022,7 @@ sub form_header {
   $lastcost = qq|
              <tr>
                 <th align="right" nowrap="true">|
-    . $locale->text('Last Cost')
-    . qq|</th>
+    . $locale->text('Last Cost') . qq|</th>
                 <td><input name=lastcost size=11 value=$form->{lastcost}></td>
               </tr>
 |;
@@ -2153,8 +2130,7 @@ sub form_header {
              <tr>
                <th align="right" nowrap>| . $locale->text('On Hand') . qq|</th>
                <th align=left nowrap class="plus$n">&nbsp;|
-      . $form->format_amount(\%myconfig, $form->{onhand})
-      . qq|</th>
+      . $form->format_amount(\%myconfig, $form->{onhand}) . qq|</th>
              </tr>
 |;
 
@@ -2183,14 +2159,12 @@ sub form_header {
     $vegv = qq|
              <tr>
                <th align="right" nowrap="true">|
-      . $locale->text('Verrechnungseinheit')
-      . qq|</th>
+      . $locale->text('Verrechnungseinheit') . qq|</th>
                <td><input name=ve size=10 value=$form->{ve}></td>
              </tr>
               <tr>
                <th align="right" nowrap="true">|
-      . $locale->text('Geschäftsvolumen')
-      . qq|</th>
+      . $locale->text('Geschäftsvolumen') . qq|</th>
                <td><input name=gv size=10 value=$form->{gv}></td>
              </tr>
 |;
@@ -2227,8 +2201,7 @@ sub form_header {
   $obsolete .= qq|
               <tr>
                 <th align=right nowrap>|
-    . $locale->text('Shopartikel')
-    . qq|</th>
+    . $locale->text('Shopartikel') . qq|</th>
                 <td><input class=checkbox type=checkbox name=shop value=1 $shopok></td>
              </tr>
 |;
@@ -2249,8 +2222,7 @@ sub form_header {
     $button1 = qq|
        <td width="13"><input name=priceupdate id=priceupdate size=11  title="$myconfig{dateformat}" value="$form->{priceupdate}"></td>
        <td width="4" align="left"><input type=button name=priceupdate id="trigger1" value=|
-      . $locale->text('button')
-      . qq|></td>
+      . $locale->text('button') . qq|></td>
       |;
 
     #write Trigger
@@ -2314,8 +2286,7 @@ sub form_header {
             <table width="100%" height="100%">
               <tr class="listheading">
                 <th class="listheading" align="center" colspan=2>|
-    . $locale->text('Link Accounts')
-    . qq|</th>
+    . $locale->text('Link Accounts') . qq|</th>
               </tr>
               $linkaccounts
               <tr>
@@ -2332,8 +2303,7 @@ sub form_header {
            <table width="100%">
              <tr>
                 <th align="right" nowrap="true">|
-    . $locale->text('Updated')
-    . qq|</th>
+    . $locale->text('Updated') . qq|</th>
                 $button1
               </tr>
              <tr>
@@ -2378,11 +2348,9 @@ sub form_footer {
             <table width="100%">
               <tr>
                 <th colspan=2 align=right>|
-      . $locale->text('Total')
-      . qq|&nbsp;</th>
+      . $locale->text('Total') . qq|&nbsp;</th>
                 <th align=right>|
-      . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2)
-      . qq|</th>
+      . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) . qq|</th>
               </tr>
             </table>
           </td>
@@ -2415,6 +2383,9 @@ sub form_footer {
     |;
   }
 
+  print qq|
+     <input type=hidden name=price_rows value=$form->{price_rows}>|;
+
   print qq|
       <input class=submit type=submit name=action value="|
     . $locale->text('Save') . qq|">|;
@@ -2718,7 +2689,6 @@ sub update {
   if ($form->{item} eq 'service') {
     map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
       qw(sellprice listprice);
-
     &form_header;
     &form_footer;
   }
@@ -2898,15 +2868,13 @@ sub stock_assembly {
       <table>
         <tr>
           <th align="right" nowrap="true">|
-    . $locale->text('Part Number')
-    . qq|</th>
+    . $locale->text('Part Number') . qq|</th>
           <td><input name=partnumber size=20></td>
           <td>&nbsp;</td>
         </tr>
         <tr>
           <th align="right" nowrap="true">|
-    . $locale->text('Part Description')
-    . qq|</th>
+    . $locale->text('Part Description') . qq|</th>
           <td><input name=description size=40></td>
         </tr>
       </table>
@@ -3053,4 +3021,37 @@ sub restock_assemblies {
   $lxdebug->leave_sub();
 }
 
+sub price_row {
+  $lxdebug->enter_sub();
+
+  my ($numrows) = @_;
+
+  print qq|
+  <tr>
+    <td>
+      <table width=100%>
+        <tr>
+          <th class="listheading">| . $locale->text('Preisklasse') . qq|</th>
+          <th class="listheading">| . $locale->text('Preis') . qq|</th>
+        </tr>
+|;
+  for $i (1 .. $numrows) {
+    print qq|
+        <tr>
+          <td width=50%><input type=hidden name="pricegroup_$i" size=30  value=$form->{"pricegroup_$i"}>$form->{"pricegroup_$i"}</td>
+          <td width=50%><input name="price_$i" size=11 value="$form->{"price_$i"}"></td>
+          <input type=hidden name="pricegroup_id_$i" value="$form->{"pricegroup_id_$i"}">
+        </tr>
+|;
+  }
+
+  print qq|
+      </table>
+    </td>
+  </tr>
+|;
+
+  $lxdebug->leave_sub();
+}
+
 sub continue { &{ $form->{nextsub} } }