PageRenderTime 290ms CodeModel.GetById 274ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/coopcoffeebeans/Customer/product_maint.php

https://github.com/gypsyfarm/gypsyfarm
PHP | 278 lines | 164 code | 104 blank | 10 comment | 16 complexity | 0342d87af59f136690354368e4febc4d MD5 | raw file
  1<?php
  2require("../functions.php");
  3require("../tables.php");
  4
  5session_start();
  6
  7
  8
  9require("../check_login.php");
 10require("../phpclasses.php");
 11 
 12function set_last_maint($action = "x",$key = 0,$user_name = "y") {
 13	global $tbl_coop_item_last_maint;
 14	global $db_conn;
 15   $current_date =  date("m/d/y") ;
 16 
 17   if ($action == 'Update') {
 18     $query = "insert into $tbl_coop_item_last_maint
 19                           (item_id, updated_by, action, maint_date)
 20                     values ($key, '$user_name', '$action', CURDATE())";
 21					
 22					
 23    }
 24    
 25       if ($action == 'Add') {           
 26           $query = "insert into $tbl_coop_item_last_maint
 27                           (item_id, updated_by, action, maint_date)
 28                     values ($key, '$user_name', '$action', CURDATE())";
 29		    $LastMaintInfo=new UpdateLastMaint($key,"add");
 30    }
 31     # echo "<br>$query<br>";
 32      $result = mysql_query($query, $db_conn);
 33      if (!$result){
 34       echo "<font size=2>Add Failed";
 35     }
 36    
 37}	
 38
 39
 40?>
 41<html>
 42
 43<head>
 44<title>Cooperative Coffees - Order and Contact Database system</title>
 45
 46<link REL="stylesheet" TYPE="text/css" HREF="../general.css">
 47
 48<!-- changed #228B22 to #9bbcc2 -->
 49</head>
 50
 51  
 52 <!-- Javascript Routines  -->
 53<script language="Javascript">
 54 
 55    function saveRec() {
 56
 57     if ( confirm("Are you Sure you want to change this record?")) {
 58         document.frmMain.action_type.value = "Update";
 59         document.frmMain.submit();
 60    }
 61     else {
 62       document.frmMain.submit();
 63     }
 64}
 65
 66
 67    function delRec() {
 68
 69     if ( confirm("Are you Sure you want to Delete this record?")) {
 70         document.frmMain.action_type.value = "Delete";
 71         document.frmMain.submit();
 72    }
 73
 74}
 75
 76 
 77
 78
 79</script>
 80 
 81
 82<?
 83#require("../left_menu.php"); 
 84
 85 
 86$current_item_id=  stripslashes($_GET['item_id']);
 87
 88 echo '<table border="0" width="100%" cellspacing="0" cellpadding="0">';
 89  echo '<tr>';
 90    echo '<td width="150" valign="top">';
 91      echo '<table border="1" width="140" cellspacing="0" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" cellpadding="2">';
 92        echo '<tr>';
 93      echo '<td width="100%" bordercolor="#228B22" bgcolor="#228B22"><font face="Verdana" size="1" color="#FFFFFF"><b>::';
 94        
 95        echo "<a href=\"javascript:poptastic('Help.php?x=47A$menu_user_type');\"><font face='Verdana' size='1' color='#FFFFFF'>help</font</a>";
 96        
 97        echo '</tr>';
 98        echo '<tr>';
 99          echo '<td width="600" bordercolor="#228B22" bgcolor="#FFFFFF">';
100          
101                     echo '<font face="Verdana" size="1">*<a href="../index.php">Back to Main Menu</a></font><br>';
102           echo '<hr>';   	
103	   echo '<font face="Verdana" size="1">*<a href="cooporder.php">Create a new Order</a></font><br>';
104           echo '<hr>';
105	   echo '<font face="Verdana" size="1">*<a href="reports/index.php">View Reports</a></font><br>';
106           echo '<hr>';
107	   echo '<font face="Verdana" size="1">*<a href="../Contact_Search/contact_start.php">Contact Database</a></font><br>';
108	   echo '<hr>';
109	   echo '<font face="Verdana" size="1">*<a href="product_start.php">Lot Review</a></font><br>';
110           echo '<hr>';
111           
112  	   echo '<font face="Verdana" size="1">*<a href="cupping_maint.php?item_id='.$current_item_id.'">Add Cupping Notes </a></font><br>';
113           echo '<hr>';         
114  
115           
116	   echo '<font face="Verdana" size="1">*<a href="password.php">Change Password</a></font><br>';
117           echo '<hr>';
118	   echo '<font face="Verdana" size="1">*<a href="../logout.php">Log out</a></font><br>';
119	   
120	           
121            echo '</td>';
122        echo '</tr>';
123        
124              echo '</table>';
125    echo '</td>';
126
127
128    echo '<td  valign="top">';
129      echo '<table border="1"  width="100%" bordercolor="#FFFFFF" cellspacing="0" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" cellpadding="2">';
130        echo '<tr>';
131          echo '<td width="100%" bordercolor="#228B22" bgcolor="#228B22"><font face="Verdana" size="1" color="#FFFFFF"><b>::';
132 
133                echo 'ยค ';
134            $current_date = date('Y-m-d H:i:s');
135            echo date('H:i, jS F');
136            echo '</font>';
137    
138                        echo '</td>';
139        echo '</tr>';
140 
141 
142 
143        echo '<tr>';
144          echo '<td width="100%" bordercolor="#228B22" bgcolor="#FFFFFF">';
145
146 
147 
148 
149 
150//********Present the Menus*********************************************
151if (isset($_SESSION['contact_id']))  {
152 
153$form_message = '';
154# set up connection string to database.
155  $db_conn = mysql_connect('mysql.coopcoffeesbeans.com', 'greenbeans3', 'annh401');
156  mysql_select_db('cbeans', $db_conn);
157
158  if (!$db_conn)
159  {
160     echo 'Error: Could not connect to database.  Please try again later.';
161     exit;
162  }
163
164
165
166
167
168
169  $action=$_REQUEST['form_action'];
170  $action_type = $_REQUEST['action_type'];
171   
172 
173   
174  
175   
176   
177 echo '<form name=frmMain method=post action="product_maint.php?item_id='.$current_item_id.'">';
178
179
180 //**********************************Gets the DataSet************************************
181mysql_select_db($tbl_coop_item);
182
183
184$query = "select ci.item_id, ci.item_code, ci.lot_ship, ci.warehouse,
185          ci.item_description, id.item_description as generic_description, ci.member_price, ci.non_member_price,
186          ci.mark, ci.warehouse_code, ci.cost, ci.quantity, ci.transfer_in, ci.transfer_out,
187          id.weight as bag_lbs,ci.green_cb, ci.spot_available, ci.green_comment,
188          ci.STATUS, ci.ship_date, ci.arrival_date, ci.ft_item, ci.org_item,
189          ci.contract_date, ci.sample_shipped, ci.sample_approved, ci.container,
190          ci.document, ci.fda_confirm, ci.fda_date, ci.customs_clear_date,
191          ci.item_notes, ci.item_active, id.rank, ci.fixed_date, ci.fixed_price, ci.nyc, ci.prefinance, ci.prefinance_amount, ci.flo_id, ci.scribd_id, ci.guid 
192          from $tbl_coop_item ci, $tbl_item_description id
193          where ci.item_id = $current_item_id
194             and ci.item_code = id.item_code ";
195
196 # echo "<br>$query<br>";
197$result = mysql_query($query, $db_conn);
198$num_results = mysql_num_rows($result);
199$row = mysql_fetch_array($result);
200
201
202# start
203$key_to_use = $row['item_id'];
204$query2 = "SELECT max( seq ) as seq FROM $tbl_coop_item_last_maint WHERE item_id =  '$key_to_use'";
205$result2 = mysql_query($query2, $db_conn);
206
207
208
209
210 
211$row2 = mysql_fetch_array($result2);
212$record_to_get = $row2['seq'];
213$query2 = "SELECT *  FROM $tbl_coop_item_last_maint WHERE seq =  '$record_to_get'";
214$result2 = mysql_query($query2, $db_conn);
215  
216$row2 = mysql_fetch_array($result2);
217echo 'Last Maint by: '.$row2['updated_by'].' &nbsp;&nbsp;&nbsp;';
218echo 'Date: '.$row2['maint_date'].' &nbsp;&nbsp;&nbsp;';
219echo 'Type: '.$row2['action'].' &nbsp;&nbsp;&nbsp;';
220
221echo '<a href="javascript:poptastic(\'last_maint_detail.php?key_to_use='.$key_to_use.'\');"><font face="Verdana" size="1" color="#000000">Last Maint Detail</font></a>';
222 
223#end 
224
225
226
227 
228 echo '<input type=hidden name=action_type size=10 value="transfer">';
229echo '<input  type="hidden" name="r_action" value="';
230if  ($num_results == 0)	{
231    echo 'Add';
232}
233else {
234    echo 'Update';
235}
236echo  '">';
237
238 echo "<h1>Review</h1>";
239 
240  
241 require("product_fields.php");
242  
243  
244 
245 
246  
247  
248   
249}     
250else {  
251    if (isset($userid)) {
252      // if they've tried and failed to log in
253        echo 'Could not log you in';
254    }
255    else {
256      // they have not tried to log in yet or have logged out
257      echo '<font size=4 color=black>You are not logged in, please enter a valid userid and password.</font>';
258    }
259}
260
261
262           echo '</form>';
263?>
264
265
266            <hr noshade size="1" color="#228B22">
267             
268          </td>
269        </tr>
270      </table>
271    </td>
272  </tr>
273</table>
274
275
276</body>
277
278</html>