[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[5766] trunk
- Subject: SF.net SVN: ledger-smb:[5766] trunk
- From: ..hidden..
- Date: Sat, 11 May 2013 08:26:04 +0000
Revision: 5766
http://sourceforge.net/p/ledger-smb/code/5766
Author: einhverfr
Date: 2013-05-11 08:26:01 +0000 (Sat, 11 May 2013)
Log Message:
-----------
Removing requirements report as it is broken by design. New reports can be addons.
Modified Paths:
--------------
trunk/LedgerSMB/IC.pm
trunk/bin/ic.pl
trunk/sql/Pg-database.sql
trunk/sql/modules/menu_rebuild.sql
Modified: trunk/LedgerSMB/IC.pm
===================================================================
--- trunk/LedgerSMB/IC.pm 2013-05-11 08:20:45 UTC (rev 5765)
+++ trunk/LedgerSMB/IC.pm 2013-05-11 08:26:01 UTC (rev 5766)
@@ -964,162 +964,6 @@
}
-sub requirements {
- my ( $self, $myconfig, $form ) = @_;
- my $dbh = $form->{dbh};
-
- my $null;
- my $var;
- my $ref;
-
- my $where = qq|p.obsolete = '0'|;
- my $dwhere;
-
- for (qw(partnumber description)) {
- if ( $form->{$_} ne "" ) {
- $var = $dbh->quote( $form->like( lc $form->{$_} ) );
- $where .= qq| AND lower(p.$_) LIKE $var|;
- }
- }
-
- if ( $form->{partsgroup} ne "" ) {
- ( $null, $var ) = split /--/, $form->{partsgroup};
- $var = $dbh->quote($var);
- $where .= qq| AND p.partsgroup_id = $var|;
- }
-
- # connect to database
-
- my ( $transdatefrom, $transdateto );
- if ( $form->{year} ) {
- ( $transdatefrom, $transdateto ) =
- $form->from_to( $form->{year}, '01', 12 );
-
- $dwhere = qq| AND a.transdate >= '$transdatefrom'
- AND a.transdate <= '$transdateto'|;
- }
-
- $query = qq|
- SELECT p.id, p.partnumber, p.description, sum(i.qty) AS qty,
- p.onhand, extract(MONTH FROM a.transdate) AS month,
- '0' AS so, '0' AS po
- FROM invoice i
- JOIN parts p ON (p.id = i.parts_id)
- JOIN ar a ON (a.id = i.trans_id)
- WHERE $where $dwhere AND p.inventory_accno_id > 0
- GROUP BY p.id, p.partnumber, p.description, p.onhand,
- extract(MONTH FROM a.transdate)|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my %parts;
- while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
- $parts{ $ref->{id} } = $ref;
- }
- $sth->finish;
-
- my %ofld = ( customer => 'so', vendor => 'po' );
- my %oe_class = ( customer => 1, vendor => 2 );
-
- for (qw(customer vendor)) {
- $query = qq|
- SELECT p.id, p.partnumber, p.description,
- sum(qty) - sum(ship) AS $ofld{$_}, p.onhand,
- 0 AS month
- FROM orderitems i
- JOIN parts p ON (p.id = i.parts_id)
- JOIN oe a ON (a.id = i.trans_id)
- WHERE $where AND p.inventory_accno_id > 0
- AND p.assembly = '0' AND a.closed = '0'
- AND oe_class_id = $oe_class{$_}
- GROUP BY p.id, p.partnumber, p.description, p.onhand,
- month|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
- if ( exists $parts{ $ref->{id} }->{ $ofld{$_} } ) {
- $parts{ $ref->{id} }->{ $ofld{$_} } += $ref->{ $ofld{$_} };
- }
- else {
- $parts{ $ref->{id} } = $ref;
- }
- }
- $sth->finish;
- }
-
- # add assemblies from open sales orders
- $query = qq|
- SELECT DISTINCT a.id AS orderid, b.id, i.qty - i.ship AS qty
- FROM parts p
- JOIN assembly b ON (b.parts_id = p.id)
- JOIN orderitems i ON (i.parts_id = b.id)
- JOIN oe a ON (a.id = i.trans_id)
- WHERE $where
- AND (p.inventory_accno_id > 0 OR p.assembly = '1')
- AND a.closed = '0'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
- &requirements_assembly( $dbh, $form, \%parts, $ref->{id}, $ref->{qty},
- $where )
- if $ref->{qty};
- }
- $sth->finish;
-
- $dbh->commit;
-
- for (
- sort { $parts{$a}->{ $form->{sort} } cmp $parts{$b}->{ $form->{sort} } }
- keys %parts
- )
- {
- push @{ $form->{parts} }, $parts{$_};
- }
-
-}
-
-sub requirements_assembly {
- my ( $dbh, $form, $parts, $id, $qty, $where ) = @_;
-
- # assemblies
- my $query = qq|
- SELECT p.id, p.partnumber, p.description, a.qty * ? AS so,
- p.onhand, p.assembly, p.partsgroup_id
- FROM assembly a
- JOIN parts p ON (p.id = a.parts_id)
- WHERE $where AND a.id = ? AND p.inventory_accno_id > 0
-
- UNION
-
- SELECT p.id, p.partnumber, p.description, a.qty * ? AS so,
- p.onhand, p.assembly, p.partsgroup_id
- FROM assembly a
- JOIN parts p ON (p.id = a.parts_id)
- WHERE a.id = ? AND p.assembly = '1'|;
-
- my $sth = $dbh->prepare($query);
- $sth->execute( $qty, $id, $qty, $id ) || $form->dberror($query);
-
- while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
- if ( $ref->{assembly} ) {
- &requirements_assembly( $dbh, $form, $parts, $ref->{id}, $ref->{so},
- $where );
- next;
- }
-
- if ( exists $parts->{ $ref->{id} }{so} ) {
- $parts->{ $ref->{id} }{so} += $ref->{so};
- }
- else {
- $parts->{ $ref->{id} } = $ref;
- }
- }
- $sth->finish;
-
-}
-
sub create_links {
my ( $self, $module, $myconfig, $form ) = @_;
Modified: trunk/bin/ic.pl
===================================================================
--- trunk/bin/ic.pl 2013-05-11 08:20:45 UTC (rev 5765)
+++ trunk/bin/ic.pl 2013-05-11 08:26:01 UTC (rev 5766)
@@ -989,395 +989,6 @@
}
-sub requirements {
-
- $form->get_partsgroup( \%myconfig, { searchitems => 'parts' } );
- $form->all_years( \%myconfig );
-
- if ( @{ $form->{all_partsgroup} } ) {
- $partsgroup = qq|<option>\n|;
-
- for ( @{ $form->{all_partsgroup} } ) {
- $partsgroup .=
- qq|<option value="|
- . $form->quote( $_->{partsgroup} )
- . qq|--$_->{id}">$_->{partsgroup}\n|;
- }
-
- $partsgroup = qq|
- <th align=right nowrap>| . $locale->text('Group') . qq|</th>
- <td><select name=partsgroup>$partsgroup</select></td>
-|;
-
- $l_partsgroup =
- qq|<input name=l_partsgroup class=checkbox type=checkbox value=Y> |
- . $locale->text('Group');
- }
-
- if ( @{ $form->{all_years} } ) {
-
- # accounting years
- $form->{selectaccountingyear} = qq|<option>\n|;
- for ( @{ $form->{all_years} } ) {
- $form->{selectaccountingyear} .= qq|<option>$_\n|;
- }
-
- $selectfrom = qq|
- <tr>
- <th align=right>| . $locale->text('Period') . qq|</th>
- <td colspan=3>
- <table>
- <tr>
- <td>
- <select name=year>$form->{selectaccountingyear}</select>
- </td>
- <td>
-|;
-
- $selectfrom .= qq|
- <table>
- <tr>
-|;
-
- for ( sort keys %{ $form->{all_month} } ) {
- $i = ( $_ * 1 ) - 1;
- if ( ( $i % 3 ) == 0 ) {
- $selectfrom .= qq|
- </tr>
- <tr>
-|;
- }
-
- $i = $_ * 1;
-
- $selectfrom .= qq|
- <td nowrap><input name="l_month_$i" class checkbox type=checkbox value=Y> |
- . $locale->text( $form->{all_month}{$_} )
- . qq|</td>\n|;
- }
-
- $selectfrom .= qq|
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-|;
- }
- else {
- $form->error( $locale->text('No History!') );
- }
-
- $form->{title} = $locale->text('Parts Requirements');
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-|;
-
- print qq|
-
-<table width="100%">
-
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr height="5"></tr>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align=right nowrap>| . $locale->text('Number') . qq|</th>
- <td><input name=partnumber size=20></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Description') . qq|</th>
- <td colspan=3><input name=description size=40></td>
- </tr>
- <tr>
- $partsgroup
- </tr>
- $selectfrom
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input type="hidden" name="nextsub" value="requirements_report">
-<input type="hidden" name="sort" value="partnumber">
-
-<br>
-<button class="submit" type="submit" name="action" value="continue">|
- . $locale->text('Continue')
- . qq|</button>|;
-
- $form->hide_form(qw(path login sessionid));
-
- print qq|
-</form>
-|;
-
- if ( $form->{lynx} ) {
- require "bin/menu.pl";
- &menubar;
- }
-
- print qq|
-
-</body>
-</html>
-|;
-
-}
-
-sub requirements_report {
-
- $callback = "$form->{script}?action=requirements_report";
- for (qw(path login sessionid year)) { $callback .= qq|&$_=$form->{$_}| }
- for (qw(partsgroup)) {
- $callback .= qq|&$_=| . $form->escape( $form->{$_}, 1 );
- }
-
- if ( $form->{partnumber} ) {
- $callback .= "&partnumber=" . $form->escape( $form->{partnumber}, 1 );
- $option .= $locale->text('Number') . qq| : $form->{partnumber}<br>|;
- }
- if ( $form->{partsgroup} ) {
- ($partsgroup) = split /--/, $form->{partsgroup};
- $option .= $locale->text('Group') . qq| : $partsgroup<br>|;
- }
- if ( $form->{description} ) {
- $callback .= "&description=" . $form->escape( $form->{description}, 1 );
- $description = $form->{description};
- $description =~ s/\r?\n/<br>/g;
- $option .=
- $locale->text('Description') . qq| : $form->{description}<br>|;
- }
-
- @column_index = $form->sort_columns(qw(partnumber description));
- unshift @column_index, "runningnumber";
-
- for ( 1 .. 12 ) {
- if ( $form->{"l_month_$_"} ) {
- $callback .= qq|&l_month_$_=$form->{"l_month_$_"}|;
- push @column_index, $_;
- $month{$_} = 1;
- }
- }
-
- push @column_index, "year" unless %month;
- push @column_index, qw(onhand so po order);
-
- IC->requirements( \%myconfig, \%$form );
-
- $form->sort_order();
-
- $callback .= "&direction=$form->{direction}&oldsort=$form->{oldsort}";
-
- $href = $callback;
-
- $callback =~ s/(direction=).*?\&/$1$form->{direction}\&/;
-
- if (%month) {
- $option .= $locale->text('Year') . qq| : $form->{year}<br>|;
- }
-
- $column_header{runningnumber} = qq|<th a class=listheading> </th>|;
- $column_header{partnumber} =
-qq|<th nowrap colspan=$colspan><a class=listheading href=$href&sort=partnumber>|
- . $locale->text('Number')
- . qq|</a></th>|;
- $column_header{description} =
- qq|<th nowrap><a class=listheading href=$href&sort=description>|
- . $locale->text('Description')
- . qq|</a></th>|;
- $column_header{onhand} =
- qq|<th class=listheading nowrap>| . $locale->text('Onhand') . qq|</th>|;
- $column_header{so} =
- qq|<th class=listheading nowrap>| . $locale->text('SO') . qq|</th>|;
- $column_header{po} =
- qq|<th class=listheading nowrap>| . $locale->text('PO') . qq|</th>|;
- $column_header{order} =
- qq|<th class=listheading nowrap>| . $locale->text('Order') . qq|</th>|;
- $column_header{year} = qq|<th class=listheading nowrap>$form->{year}</th>|;
-
- $SHORTMONTH = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
- 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
-
- for ( sort { $a <=> $b } keys %month ) {
- $column_header{$_} =
- qq|<th class=listheading nowrap>|
- . $locale->text( $SHORTMONTH->[ $_ - 1 ] )
- . qq|</th>|;
- }
-
- $form->{title} = $locale->text('Parts Requirements');
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
-
- <tr><td>$option</td></tr>
-
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- for (@column_index) { print "\n$column_header{$_}" }
-
- print qq|
- </tr>
- |;
-
- # add order to callback
- $form->{callback} = $callback .= "&sort=$form->{sort}";
-
- # escape callback for href
- $callback = $form->escape($callback);
-
- if ( @{ $form->{parts} } ) {
- $sameid = $form->{parts}->[0]->{id};
- }
-
- for ( keys %month ) { $column_data{$_} = "<td> </td>" }
-
- $i = 0;
- $qty = 0;
- foreach $ref ( @{ $form->{parts} } ) {
-
- if ( $ref->{id} != $sameid ) {
-
- $i++;
- $column_data{runningnumber} = "<td align=right>$i</td>";
-
- $order = 0 if $order < 0;
- $column_data{order} =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $order, '', "-" ) . "</td>";
- $j++;
- $j %= 2;
- print "<tr class=listrow$j>";
-
- for (@column_index) {
- print "\n$column_data{$_}";
- $column_data{$_} = "<td> </td>";
- }
-
- print qq|
- </tr>
-|;
- $qty = 0;
- }
-
- $ref->{description} =~ s/\r?\n/<br>/g;
-
- $column_data{partnumber} =
-"<td><a href=$form->{script}?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{partnumber} </a></td>";
-
- $column_data{description} = "<td>$ref->{description} </td>";
-
- $column_data{onhand} =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $ref->{onhand}, '', " " )
- . "</td>";
- $column_data{so} =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $ref->{so}, '', " " )
- . "</td>";
- $column_data{po} =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $ref->{po}, '', " " )
- . "</td>";
-
- $column_data{ $ref->{month} } =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $ref->{qty}, '', " " )
- . "</td>";
- if (%month) {
- $qty += $ref->{qty} if exists $month{ $ref->{month} };
- }
- else {
- $qty += $ref->{qty};
- }
-
- $column_data{year} =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $qty, '', " " ) . "</td>";
-
- $order = $qty + $ref->{so} - $ref->{po} - $ref->{onhand};
-
- $sameid = $ref->{id};
-
- }
-
- if ( @{ $form->{parts} } ) {
- $i++;
- $column_data{runningnumber} = "<td align=right>$i</td>";
-
- $order = 0 if $order < 0;
- $column_data{order} =
- "<td align=right>"
- . $form->format_amount( \%myconfig, $order, '', "-" ) . "</td>";
- $j++;
- $j %= 2;
- print "<tr class=listrow$j>";
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr><td><hr size=3 noshade></td></tr>
-</table>
-
-|;
-
- print qq|
-
-<br>
-
-<form method=post action=$form->{script}>
-
-|;
-
- $form->hide_form(qw(callback path login sessionid));
-
- if ( $form->{lynx} ) {
- require "bin/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
-}
-
sub makemodel_row {
my ($numrows) = @_;
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2013-05-11 08:20:45 UTC (rev 5765)
+++ trunk/sql/Pg-database.sql 2013-05-11 08:26:01 UTC (rev 5766)
@@ -2686,7 +2686,6 @@
71 Quotations 70 1
72 RFQs 70 2
74 Journal Entry 73 1
-88 Requirements 85 3
96 Description 95 1
97 Partsgroup 95 2
100 Add Timecard 98 2
@@ -3051,8 +3050,6 @@
65 module order.pl 150
84 action stock_assembly 203
85 menu 1 204
-88 module ic.pl 211
-88 action requirements 212
95 menu 1 232
96 module pe.pl 233
96 action translation 234
Modified: trunk/sql/modules/menu_rebuild.sql
===================================================================
--- trunk/sql/modules/menu_rebuild.sql 2013-05-11 08:20:45 UTC (rev 5765)
+++ trunk/sql/modules/menu_rebuild.sql 2013-05-11 08:26:01 UTC (rev 5766)
@@ -361,8 +361,6 @@
65 module order.pl 150
84 action stock_assembly 203
85 menu 1 204
-88 module ic.pl 211
-88 action requirements 212
95 menu 1 232
96 module pe.pl 233
96 action translation 234
@@ -878,7 +876,6 @@
71 Quotations 70 1
72 RFQs 70 2
74 Journal Entry 73 1
-88 Requirements 85 3
96 Description 95 1
97 Partsgroup 95 2
100 Add Timecard 98 2
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.