PageRenderTime 94ms CodeModel.GetById 19ms RepoModel.GetById 2ms app.codeStats 0ms

/coopcoffeebeans/Bill/phpclasses.php

https://github.com/gypsyfarm/gypsyfarm
PHP | 215 lines | 166 code | 33 blank | 16 comment | 3 complexity | a62cf33a66aec6808c5bfdfb3d15db10 MD5 | raw file
  1. <?php
  2. #$PlaceField=new myTextBoxChoice($view_mode,);
  3. #$PlaceField->displayBox('User2:','User2',5,$row['User2']);
  4. class myTextBoxChoice {
  5. var $myViewMode = 1;
  6. var $box_size = 5;
  7. var $box_color = '#EC0000';
  8. function myTextBoxChoice($view_mode){
  9. $this->$myViewMode =$view_mode;
  10. # echo 'view mode is now set to '.$this->$myViewMode;
  11. }
  12. function setSize($value){
  13. $this->box_size=$value;
  14. }
  15. function setWidth($value){
  16. $this->box_width=$value;
  17. }
  18. function setColor($value){
  19. $this->box_color=$value;
  20. }
  21. function displayBox($heading,$name,$size,$value,$trailer){
  22. /*
  23. echo sprintf('
  24. <div style="height:%spx;width:%spx;background-color:%s"> </div>
  25. ',$this->box_height,$this->box_width,$this->box_color);
  26. */
  27. # echo 'view mode is set to '.$this->$myViewMode;
  28. echo $heading ;
  29. if ($this->$myViewMode == 1)
  30. {
  31. echo "<input type=text name=$name onchange='dirty="."'true'"."' size=$size value='".$value."'>";
  32. }
  33. else
  34. {
  35. echo "<span class='label'> $value</span>";
  36. echo $trailer;
  37. }
  38. }
  39. }
  40. class UpdateLastMaint {
  41. var $myKey = 0;
  42. var $action = "Add";
  43. var $b_field_1 = "";
  44. var $before_row;
  45. var $after_row;
  46. function UpdateLastMaint($key,$action){
  47. $this->$myKey =$key;
  48. $this->$action=$action;
  49. # echo "init action:".$this->$action;
  50. }
  51. function GetBefore($key) {
  52. global $tbl_coop_item;
  53. global $tbl_item_description;
  54. global $db_conn;
  55. $query = "select ci.item_id, ci.item_code, ci.lot_ship, ci.warehouse,
  56. ci.item_description, id.item_description as generic_description, ci.member_price, ci.non_member_price,
  57. ci.mark, ci.warehouse_code, ci.cost, ci.quantity, ci.transfer_in, ci.transfer_out,
  58. id.weight as bag_lbs,ci.green_cb, ci.spot_available, ci.green_comment,
  59. ci.STATUS, ci.ship_date, ci.arrival_date, ci.ft_item, ci.org_item,
  60. ci.contract_date, ci.sample_shipped, ci.sample_approved, ci.container,
  61. ci.document, ci.fda_confirm, ci.fda_date, ci.customs_clear_date,
  62. ci.item_notes, ci.item_active, id.rank, ci.fixed_date, ci.fixed_price, ci.nyc, ci.prefinance, ci.prefinance_amount
  63. from $tbl_coop_item ci, $tbl_item_description id
  64. where ci.item_id = $key
  65. and ci.item_code = id.item_code;";
  66. $result = mysql_query($query, $db_conn);
  67. $num_results = mysql_num_rows($result);
  68. $row = mysql_fetch_array($result);
  69. $this->$before_row = $row;
  70. $row2 = $this->$before_row['item_id'];
  71. }
  72. function GetAfter($key,$user_name) {
  73. global $tbl_coop_item;
  74. global $tbl_item_description;
  75. global $tbl_coop_item_last_maint2;
  76. global $db_conn;
  77. # echo "init action:".$this->$action;
  78. $query = "select ci.item_id, ci.item_code, ci.lot_ship, ci.warehouse,
  79. ci.item_description, id.item_description as generic_description, ci.member_price, ci.non_member_price,
  80. ci.mark, ci.warehouse_code, ci.cost, ci.quantity, ci.transfer_in, ci.transfer_out,
  81. id.weight as bag_lbs,ci.green_cb, ci.spot_available, ci.green_comment,
  82. ci.STATUS, ci.ship_date, ci.arrival_date, ci.ft_item, ci.org_item,
  83. ci.contract_date, ci.sample_shipped, ci.sample_approved, ci.container,
  84. ci.document, ci.fda_confirm, ci.fda_date, ci.customs_clear_date,
  85. ci.item_notes, ci.item_active, id.rank, ci.fixed_date, ci.fixed_price, ci.nyc, ci.prefinance, ci.prefinance_amount
  86. from $tbl_coop_item ci, $tbl_item_description id
  87. where ci.item_id = $key
  88. and ci.item_code = id.item_code;";
  89. $result = mysql_query($query, $db_conn);
  90. $num_results = mysql_num_rows($result);
  91. $row = mysql_fetch_array($result);
  92. # $this->$action = "UPDATE";
  93. # echo "<br>Ok,<br>";
  94. # print_r ($this->$action);
  95. # echo "<br>End";
  96. $row2 = $this->$before_row['item_id'];
  97. $query = "insert into $tbl_coop_item_last_maint2 ".
  98. " (item_id, updated_by, ACTION, maint_date, b_item_code, b_lot_ship, b_warehouse, b_item_description, b_member_price, b_non_member_price, b_mark, b_warehouse_code, b_cost, b_quantity, b_transfer_out, b_transfer_in, b_bag_lbs, b_STATUS, b_ship_date, b_arrival_date, b_ft_item, b_org_item, b_item_notes, b_item_active, b_green_cb, b_spot_available, b_green_comment, b_contract_date, b_sample_shipped, b_sample_approved, b_container, b_document, b_fda_confirm, b_fda_date, b_customs_clear_date, b_fixed_date, b_fixed_price, a_item_code, a_lot_ship, a_warehouse, a_item_description, a_member_price, a_non_member_price, a_mark, a_warehouse_code, a_cost, a_quantity, a_transfer_out, a_transfer_in, a_bag_lbs, a_STATUS, a_ship_date, a_arrival_date, a_ft_item, a_org_item, a_item_notes, a_item_active, a_green_cb, a_spot_available, a_green_comment, a_contract_date, a_sample_shipped, a_sample_approved, a_container, a_document, a_fda_confirm, a_fda_date, a_customs_clear_date, a_fixed_date, a_fixed_price, b_nyc, a_nyc, b_prefinance, a_prefinance, b_prefinance_amount, a_prefinance_amount) ".
  99. " values('".$row['item_id']."','".
  100. $user_name."','".
  101. 'Update'."',".
  102. 'CURDATE()'.",'".
  103. $row2['item_code']."','".
  104. $row2['lot_ship']."','".
  105. $row2['warehouse']."','".
  106. $row2['item_description']."','".
  107. $row2['member_price']."','".
  108. $row2['non_member_price']."','".
  109. $row2['mark']."','".
  110. $row2['warehouse_code']."','".
  111. $row2['cost']."','".
  112. $row2['quantity']."','".
  113. $row2['transfer_out']."','".
  114. $row2['transfer_in']."','".
  115. $row2['bag_lbs']."','".
  116. $row2['STATUS']."','".
  117. $row2['ship_date']."','".
  118. $row2['arrival_date']."','".
  119. $row2['ft_item']."','".
  120. $row2['org_item']."','".
  121. $row2['item_notes']."','".
  122. $row2['item_active']."','".
  123. $row2['green_cb']."','".
  124. $row2['spot_available']."','".
  125. $row2['green_comment']."','".
  126. $row2['contract_date']."','".
  127. $row2['sample_shipped']."','".
  128. $row2['sample_approved']."','".
  129. $row2['container']."','".
  130. $row2['document']."','".
  131. $row2['fda_confirm']."','".
  132. $row2['fda_date']."','".
  133. $row2['customs_clear_date']."','".
  134. $row2['fixed_date']."','".
  135. $row2['fixed_price']."','".
  136. $row['item_code']."','".
  137. $row['lot_ship']."','".
  138. $row['warehouse']."','".
  139. $row['item_description']."','".
  140. $row['member_price']."','".
  141. $row['non_member_price']."','".
  142. $row['mark']."','".
  143. $row['warehouse_code']."','".
  144. $row['cost']."','".
  145. $row['quantity']."','".
  146. $row['transfer_out']."','".
  147. $row['transfer_in']."','".
  148. $row['bag_lbs']."','".
  149. $row['STATUS']."','".
  150. $row['ship_date']."','".
  151. $row['arrival_date']."','".
  152. $row['ft_item']."','".
  153. $row['org_item']."','".
  154. $row['item_notes']."','".
  155. $row['item_active']."','".
  156. $row['green_cb']."','".
  157. $row['spot_available']."','".
  158. $row['green_comment']."','".
  159. $row['contract_date']."','".
  160. $row['sample_shipped']."','".
  161. $row['sample_approved']."','".
  162. $row['container']."','".
  163. $row['document']."','".
  164. $row['fda_confirm']."','".
  165. $row['fda_date']."','".
  166. $row['customs_clear_date']."','".
  167. $row['fixed_date']."','".
  168. $row['fixed_price']."','".
  169. $row2['nyc']."','".
  170. $row['nyc']."','".
  171. $row2['prefinance']."','".
  172. $row['prefinance']."','".
  173. $row2['prefinance_amount']."','".
  174. $row['prefinance_amount']."')";
  175. # echo "<br>$query <br>";
  176. $result = mysql_query($query, $db_conn);
  177. if (!$result){
  178. echo "<font size=2>Last Maint Add Failed";
  179. }
  180. }
  181. }
  182. ?>