Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Problem viewing shift reports
Old 11-25-2010, 12:20 AM Problem viewing shift reports
Skilled Talker

Posts: 97
Name: rhoda
Trades: 0
Good day!
I have 2 kinds of shift and it is also the same they are only different in Forms. I copy the code for shift and i edit it, but i only edit the names of database,fields and tables, so I don't why the shift for 10-6 was not view or appear. Here is the code:
PHP Code:
If($_POST["clt_shift_date"])
        {
        
            
        
$clt_shift[] = '10-6';
        
$clt_shift[] = '6-2';
        
$clt_shift[] = '2-10';
        
        
$firstclt_shift_date $_POST["clt_shift_date"];
        
$firstclt_shift_date date("Y-m-d"strtotime('-1 day',strtotime($firstclt_shift_date)));
        
        
$query "SELECT d.operation_name, SUM(d.input_qty) AS inputqty, d.input_unit, SUM(d.output_qty) AS outputqty, d.output_unit, d.shift FROM clt_traceability d, clt_transact t WHERE ((t.clt_date = '$firstclt_shift_date' AND d.shift = '10-6') || (t.clt_date = '" $_POST["clt_shift_date"] . "' AND d.shift = '6-2') || (t.clt_date = '" $_POST["clt_shift_date"] . "' AND d.shift = '2-10')) AND d.clt_transact_id = t.clt_transact_id GROUP BY d.operation_name, d.output_unit, d.input_unit, d.shift ORDER BY d.operation_name, FIELD(d.shift,'10-6','6-2','2-10')";
        
$result mysql_query($query);
        
        if(
$result)
            {
            echo 
"<table cellspacing='3' style='font-family: arial narrow; font-size: 12px; border-width: 2px 2px 2px 2px; border-style: solid;'>";
            echo 
"<tr><b> Date: &nbsp;  " $_POST['clt_shift_date'] . "</b></tr>";
        
            echo 
"<tr>";
            echo 
"<th class='tdclass'>Operation</th>";
            
$shift_ctr count($clt_shift);
            for(
$ctr 0$ctr $shift_ctr$ctr++)
                echo 
"<th colspan='2' class='tdclass'>" $clt_shift[$ctr] . "</th>";
                
            echo 
"</tr>";
            
            echo 
"<tr>";
            echo 
"<td class='tdclass'></td>";
            
$shift_ctr count($clt_shift);
            for(
$ctr 0$ctr $shift_ctr$ctr++)
                echo 
"<td class='tdclass'>Input</td><td class='tdclass'>Output</td>";
                
            echo 
"</tr>";
            
            
$last_opname "";
            
$tdctr 0;
            while(
$row2 mysql_fetch_array($result))
                {
                
$opname $row2["operation_name"];
                
$i strpos($opname," ",0);
                
$opname substr($opname,$i);
                if(
$last_opname != $opname && $last_opname != "")
                    {
                     if(
$tdctr $shift_ctr)
                        {
                        for(
$tdctr=$tdctr$tdctr $shift_ctr$tdctr++)
                            {
                            echo 
"<td class='tdclass'>&nbsp;</td>";
                            echo 
"<td class='tdclass'>&nbsp;</td>";
                            }
                        }
                    echo 
"</tr>";
                    echo 
"<tr>";
                    echo 
"<td class='tdclass'>" $opname "</td>";
                    
$tdctr 0;
                    }
                elseif(
$last_opname != $opname)
                    {
                    echo 
"<tr>";
                    echo 
"<td class='tdclass'>" $opname "</td>";
                    }
                
                
$last_opname $opname;
                
                for(
$ctr=0$ctr $shift_ctr$ctr++)
                    {
                        
                    if(
$row2["shift"] == $clt_shift[$ctr])
                        {
                        echo 
"<td class='tdclass'>" number_format($row2["inputqty"],2) . "</td>";
                        echo 
"<td class='tdclass'>" number_format($row2["outputqty"],2) . "</td>";
                        
$tdctr++;
                        
$ctr $shift_ctr+1;
                        }
                    elseif(
$ctr == $tdctr)
                        {
                        echo 
"<td class='tdclass'>&nbsp;</td>";
                        echo 
"<td class='tdclass'>&nbsp;</td>";
                        
$tdctr++;
                        }
                    }
                }
            echo 
"</table>";
            }
            
        } 
Only the 6-2 and 2-10 data was appear.
Thank you
newphpcoder is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-30-2010, 11:53 PM Re: Problem viewing shift reports
Average Talker

Posts: 25
Name: Stephen
Location: Arizona
Trades: 0
Is clt_transact.clt_date stored in a text field or a date field? If text, verify that it matches the format returned by date("Y-m-d").
http://www.w3schools.com/php/php_date.asp
__________________

Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE
GetGamesHere is offline
Reply With Quote
View Public Profile Visit GetGamesHere's homepage!
 
Old 12-01-2010, 07:41 PM Re: Problem viewing shift reports
Skilled Talker

Posts: 97
Name: rhoda
Trades: 0
Quote:
Originally Posted by GetGamesHere View Post
Is clt_transact.clt_date stored in a text field or a date field? If text, verify that it matches the format returned by date("Y-m-d").
http://www.w3schools.com/php/php_date.asp
I resolved my problem by removing the code for the date because I have it on the first shift.

Thank you
newphpcoder is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Problem viewing shift reports
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12335 seconds with 12 queries