X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/367a5674dc94bc2b5a8bfdcf4fcccc7668f219b3..b8741ec3:/bin/mozilla/ic.pl
diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl
index eeb738001..2aae5cdd5 100644
--- a/bin/mozilla/ic.pl
+++ b/bin/mozilla/ic.pl
@@ -24,3079 +24,571 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1335, USA.
#======================================================================
#
# Inventory Control module
#
#======================================================================
-#$locale->text('ea');
use POSIX qw(strftime);
+use List::Util qw(first max);
+use List::MoreUtils qw(any);
+use SL::AM;
+use SL::CVar;
use SL::IC;
+use SL::Helper::Flash qw(flash);
+use SL::HTML::Util;
use SL::ReportGenerator;
#use SL::PE;
-# use strict;
+use strict;
#use warnings;
# global imports
-our ($form, $locale, %myconfig, $lxdebug);
+our ($form, $locale, %myconfig, $lxdebug, $auth);
require "bin/mozilla/io.pl";
-require "bin/mozilla/invoice_io.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
1;
+# Parserhappy(R):
+# type=submit $locale->text('Add Part')
+# type=submit $locale->text('Add Service')
+# type=submit $locale->text('Add Assembly')
+# type=submit $locale->text('Edit Part')
+# type=submit $locale->text('Edit Service')
+# type=submit $locale->text('Edit Assembly')
+# $locale->text('Parts')
+# $locale->text('Services')
+# $locale->text('Inventory quantity must be zero before you can set this part obsolete!')
+# $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!')
+# $locale->text('Part Number missing!')
+# $locale->text('Service Number missing!')
+# $locale->text('Assembly Number missing!')
+# $locale->text('ea');
+
# end of main
-sub add {
+sub search {
$lxdebug->enter_sub();
- $form->{title} = $locale->text('Add ' . ucfirst $form->{item});
+ $auth->assert('part_service_assembly_details');
+
+ $form->{revers} = 0; # switch for backward sorting
+ $form->{lastsort} = ""; # memory for which table was sort at last time
+ $form->{ndxs_counter} = 0; # counter for added entries to top100
+
+ $form->{title} = (ucfirst $form->{searchitems}) . "s";
+ $form->{title} =~ s/ys$/ies/;
+ $form->{title} = $locale->text($form->{title});
- $form->{callback} =
- "$form->{script}?action=add&item=$form->{item}&login=$form->{login}&password=$form->{password}"
- unless $form->{callback};
+ $form->{CUSTOM_VARIABLES} = CVar->get_configs('module' => 'IC');
+ ($form->{CUSTOM_VARIABLES_FILTER_CODE},
+ $form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables' => $form->{CUSTOM_VARIABLES},
+ 'include_prefix' => 'l_',
+ 'include_value' => 'Y');
- $form->{"unit_changeable"} = 1;
+ $form->header;
- IC->get_pricegroups(\%myconfig, \%$form);
- &link_part;
- &display_form;
+ $form->get_lists('partsgroup' => 'ALL_PARTSGROUPS');
+ print $form->parse_html_template('ic/search');
$lxdebug->leave_sub();
-}
+} #end search()
-sub search {
- $lxdebug->enter_sub();
+sub top100 {
+ $::lxdebug->enter_sub();
- my ($button1, $button2, $onhand, $makemodel, $serialnumber, $l_serialnumber, $toplevel, $bought);
+ $::auth->assert('part_service_assembly_edit');
- $form->{title} = (ucfirst $form->{searchitems}) . "s";
- $form->{title} = $locale->text($form->{title});
+ $::form->{l_soldtotal} = "Y";
+ $::form->{sort} = "soldtotal";
+ $::form->{lastsort} = "soldtotal";
- # switch for backward sorting
- $form->{revers} = 0;
-
- # memory for which table was sort at last time
- $form->{lastsort} = "";
-
- # counter for added entries to top100
- $form->{ndxs_counter} = 0;
-
- # $locale->text('Parts')
- # $locale->text('Services')
-
- # use JavaScript Calendar or not
- $form->{jsscript} = 1;
- my $jsscript = "";
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
-
|
- text('button') . qq|> |
- |;
- $button2 = qq|
- |
- text('button') . qq|> |
- |;
-
- #write Trigger
- $jsscript = Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1", "transdateto", "BL", "trigger2");
- } else {
+ $::form->{l_qty} = undef;
+ $::form->{l_linetotal} = undef;
+ $::form->{l_number} = "Y";
+ $::form->{number} = "position";
- # without JavaScript Calendar
- $button1 = qq| | |;
- $button2 = qq| | |;
+ unless ( $::form->{bought}
+ || $::form->{sold}
+ || $::form->{rfq}
+ || $::form->{quoted}) {
+ $::form->{bought} = $::form->{sold} = 1;
}
- unless ($form->{searchitems} eq 'service') {
+ generate_report();
- $onhand = qq| | . $locale->text('On Hand') . qq|
- | . $locale->text('Short') . qq|
-|;
+ $lxdebug->leave_sub();
+}
- $makemodel = qq|
-
- | | . $locale->text('Make') . qq| | |
- | . $locale->text('Model') . qq| | |
-
-|;
+#
+# Report for Wares.
+# Warning, deep magic ahead.
+# This function parses the requested details, sanity checks them, and converts them into a format thats usable for IC->all_parts
+#
+# flags coming from the form:
+# hardcoded:
+# searchitems=part revers=0 lastsort=''
+#
+# filter:
+# partnumber ean description partsgroup classification serialnumber make model drawing microfiche
+# transdatefrom transdateto
+#
+# radio:
+# itemstatus = active | onhand | short | obsolete | orphaned
+# action = continue | top100
+#
+# checkboxes:
+# bought sold onorder ordered rfq quoted
+# l_partnumber l_description l_serialnumber l_unit l_listprice l_sellprice l_lastcost
+# l_linetotal l_priceupdate l_bin l_rop l_weight l_image l_drawing l_microfiche
+# l_partsgroup l_subtotal l_soldtotal l_deliverydate l_pricegroups
+#
+# hiddens:
+# nextsub revers lastsort sort ndxs_counter
+#
+sub generate_report {
+ $lxdebug->enter_sub();
- $serialnumber = qq|
- | . $locale->text('Serial Number') . qq| | |
-|;
+ $auth->assert('part_service_assembly_details');
- $l_serialnumber = qq|
- | . $locale->text('Serial Number') . qq| |
-|;
+ my ($revers, $lastsort, $description);
- }
+ my $cvar_configs = CVar->get_configs('module' => 'IC');
- if ($form->{searchitems} eq 'assembly') {
-
- $form->{title} = $locale->text('Assemblies');
-
- $toplevel = qq|
-
- |
-
- |
- . $locale->text('Top Level') . qq|
- |
- . $locale->text('Individual Items') . qq|
- |
-
-|;
-
- $bought = qq|
-
- |
-
-
-
- |
-
- |
- |
- | . $locale->text('From') . qq| |
- $button1
- | . $locale->text('To (time)') . qq| |
- $button2
-
-
- |
-
-|;
+ $form->{title} = $locale->text('Articles');
- } else {
+ my %column_defs = (
+ 'bin' => { 'text' => $locale->text('Bin'), },
+ 'deliverydate' => { 'text' => $locale->text('deliverydate'), },
+ 'description' => { 'text' => $locale->text('Part Description'), },
+ 'notes' => { 'text' => $locale->text('Notes'), },
+ 'drawing' => { 'text' => $locale->text('Drawing'), },
+ 'ean' => { 'text' => $locale->text('EAN'), },
+ 'image' => { 'text' => $locale->text('Image'), },
+ 'insertdate' => { 'text' => $locale->text('Insert Date'), },
+ 'invnumber' => { 'text' => $locale->text('Invoice Number'), },
+ 'lastcost' => { 'text' => $locale->text('Last Cost'), },
+ 'linetotallastcost' => { 'text' => $locale->text('Extended'), },
+ 'linetotallistprice' => { 'text' => $locale->text('Extended'), },
+ 'linetotalsellprice' => { 'text' => $locale->text('Extended'), },
+ 'listprice' => { 'text' => $locale->text('List Price'), },
+ 'microfiche' => { 'text' => $locale->text('Microfiche'), },
+ 'name' => { 'text' => $locale->text('Name'), },
+ 'onhand' => { 'text' => $locale->text('Stocked Qty'), },
+ 'ordnumber' => { 'text' => $locale->text('Order Number'), },
+ 'partnumber' => { 'text' => $locale->text('Part Number'), },
+ 'partsgroup' => { 'text' => $locale->text('Partsgroup'), },
+ 'priceupdate' => { 'text' => $locale->text('Updated'), },
+ 'quonumber' => { 'text' => $locale->text('Quotation'), },
+ 'rop' => { 'text' => $locale->text('ROP'), },
+ 'sellprice' => { 'text' => $locale->text('Sell Price'), },
+ 'serialnumber' => { 'text' => $locale->text('Serial Number'), },
+ 'soldtotal' => { 'text' => $locale->text('Qty in Selected Records'), },
+ 'name' => { 'text' => $locale->text('Name in Selected Records'), },
+ 'transdate' => { 'text' => $locale->text('Transdate'), },
+ 'unit' => { 'text' => $locale->text('Unit'), },
+ 'weight' => { 'text' => $locale->text('Weight'), },
+ 'shop' => { 'text' => $locale->text('Shop article'), },
+ 'type_and_classific' => { 'text' => $locale->text('Type'), },
+ 'projectnumber' => { 'text' => $locale->text('Project Number'), },
+ 'projectdescription' => { 'text' => $locale->text('Project Description'), },
+ );
- $bought = qq|
-
- |
-
-
-
- |
-
- |
- |
-
-
-
- | | . $locale->text('From') . qq| |
- $button1
- | . $locale->text('To (time)') . qq| |
- $button2
-
-
- |
-
-
- |
-
-|;
- }
+ $revers = $form->{revers};
+ $lastsort = $form->{lastsort};
- $form->header;
+ # sorting and direction of sorting
+ # ToDO: change this to the simpler field+direction method
+ if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
+ $form->{revers} = 0;
+ $form->{lastsort} = "partnumber";
+ $form->{sort} = "partnumber";
+ } else {
+ if ($form->{lastsort} eq $form->{sort}) {
+ $form->{revers} = 1 - $form->{revers};
+ } else {
+ $form->{revers} = 0;
+ $form->{lastsort} = $form->{sort};
+ } #fi
+ } #fi
- print qq|
-
-
-
-
-
-