You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

250 line
11 KiB

  1. <?php
  2. define('IN_CB', true);
  3. include('include/header.php');
  4. $default_value['start'] = 'C';
  5. $start = isset($_POST['start']) ? $_POST['start'] : $default_value['start'];
  6. registerImageKey('start', $start);
  7. $identifiers = array(
  8. '' => 'Select an identifier',
  9. '00' => 'Serial Shipping Container Code (SSCC-18)',
  10. '01' => 'Shipping Container Code (SSC)',
  11. '02' => 'Number of containers',
  12. '10' => 'Batch Number',
  13. '11' => 'Production Date',
  14. '12' => 'Due date',
  15. '13' => 'Packaging Date',
  16. '15' => 'Sell by Date (Quality Control)',
  17. '17' => 'Expiration Date',
  18. '20' => 'Product Variant',
  19. '21' => 'Serial Number',
  20. '240' => 'Additional Product Identification',
  21. '241' => 'Customer part number',
  22. '250' => 'Second Serial Number',
  23. '251' => 'Reference to source entity',
  24. '253' => 'Global Document Type Identifier',
  25. '30' => 'Quantity Each',
  26. '310y' => 'Product Net Weight in kg',
  27. '311y' => 'Product Length/1st Dimension, in meters',
  28. '312y' => 'Product Width/Diameter/2nd Dimension, in meters',
  29. '313y' => 'Product Depth/Thickness/3rd Dimension, in meters',
  30. '314y' => 'Product Area, in square meters',
  31. '315y' => 'Product Volume, in liters',
  32. '316y' => 'product Volume, in cubic meters',
  33. '320y' => 'Product Net Weight, in pounds',
  34. '321y' => 'Product Length/1st Dimension, in inches',
  35. '322y' => 'Product Length/1st Dimension, in feet',
  36. '323y' => 'Product Length/1st Dimension, in yards',
  37. '324y' => 'Product Width/Diameter/2nd Dimension, in inches',
  38. '325y' => 'Product Width/Diameter/2nd Dimension, in feet',
  39. '326y' => 'Product Width/Diameter/2nd Dimension, in yards',
  40. '327y' => 'Product Depth/Thickness/3rd Dimension, in inches',
  41. '328y' => 'Product Depth/Thickness/3rd Dimension, in feet',
  42. '329y' => 'Product Depth/Thickness/3rd Dimension, in yards',
  43. '330y' => 'Container Gross Weight (Kg)',
  44. '331y' => 'Container Length/1st Dimension (Meters)',
  45. '332y' => 'Container Width/Diameter/2nd Dimension (Meters)',
  46. '333y' => 'Container Depth/Thickness/3rd Dimension (Meters)',
  47. '334y' => 'Container Area (Square Meters)',
  48. '335y' => 'Container Gross Volume (Liters)',
  49. '336y' => 'Container Gross Volume (Cubic Meters)',
  50. '337y' => 'Kilograms per square meter',
  51. '340y' => 'Container Gross Weight (Pounds)',
  52. '341y' => 'Container Length/1st Dimension, in inches',
  53. '342y' => 'Container Length/1st Dimension, in feet',
  54. '343y' => 'Container Length/1st Dimension in, in yards',
  55. '344y' => 'Container Width/Diameter/2nd Dimension, in inches',
  56. '345y' => 'Container Width/Diameter/2nd Dimension, in feet',
  57. '346y' => 'Container Width/Diameter/2nd Dimension, in yards',
  58. '347y' => 'Container Depth/Thickness/Height/3rd Dimension, in inches',
  59. '348y' => 'Container Depth/Thickness/Height/3rd Dimension, in feet',
  60. '349y' => 'Container Depth/Thickness/Height/3rd Dimension, in yards',
  61. '350y' => 'Product Area (Square Inches)',
  62. '351y' => 'Product Area (Square Feet)',
  63. '352y' => 'Product Area (Square Yards)',
  64. '353y' => 'Container Area (Square Inches)',
  65. '354y' => 'Container Area (Square Feet)',
  66. '355y' => 'Container Area (Square Yards)',
  67. '356y' => 'Net Weight (Troy Ounces)',
  68. '357y' => 'Kilograms per square meter',
  69. '360y' => 'Product Volume (Quarts)',
  70. '361y' => 'Product Volume (Gallons)',
  71. '362y' => 'Container Gross Volume (Quarts)',
  72. '363y' => 'Container Gross Volume (Gallons)',
  73. '364y' => 'Product Volume (Cubic Inches)',
  74. '365y' => 'Product Volume (Cubic Feet)',
  75. '366y' => 'Product Volume (Cubic Yards)',
  76. '367y' => 'Container Gross Volume (Cubic Inches)',
  77. '368y' => 'Container Gross Volume (Cubic Feet)',
  78. '369y' => 'Container Gross Volume (Cubic Yards)',
  79. '37' => 'Number of Units Contained',
  80. '390y' => 'Amount payable-single monetary area',
  81. '391y' => 'Amount payable with ISO currency code',
  82. '392y' => 'Amount payable for a Variable Measure Trade Item single monetary unit',
  83. '393y' => 'Amount payable for a Variable Measure Trade Item - with ISO currency code',
  84. '400' => 'Customer Purchase Order Number',
  85. '401' => 'Consignment number',
  86. '402' => 'Shipment Identification Number',
  87. '403' => 'Routing code',
  88. '410' => 'Ship To/Deliver To Location Code (EAN13 or DUNS code)',
  89. '411' => 'Bill To/Invoice Location Code (EAN13 or DUNS code)',
  90. '412' => 'Purchase From Location Code (EAN13 or DUNS code)',
  91. '413' => 'Ship for - deliver for - forward to EAN.UCC Global Location Number',
  92. '414' => 'Identification of a physical location EAN.UCC Global Location Number',
  93. '415' => 'EAN.UCC Global Location Number of the invoicing party',
  94. '420' => 'Ship To/Deliver To Postal Code (Single Postal Authority)',
  95. '421' => 'Ship To/Deliver To Postal Code (Multiple Postal Authority)',
  96. '422' => 'Country of origin of a trade item',
  97. '8001' => 'Roll Products - Width/Length/Core Diameter',
  98. '8002' => 'Electronic Serial Number (ESN) for Cellular Phone',
  99. '8003' => 'UPC/EAN Number and Serial Number of Returnable Asset',
  100. '8004' => 'UPC/EAN Serial Identification',
  101. '8005' => 'Price per Unit of Measure',
  102. '8006' => 'Identification of the component of a trade item',
  103. '8007' => 'International Bank Account Number',
  104. '8018' => 'EAN.UCC Global Service Relation Number',
  105. '8020' => 'Payment Slip Reference Number',
  106. '8100' => 'Coupon Extended Code: Number System and Offer',
  107. '8101' => '8101 Coupon Extended Code: Number System, Offer, End of Offer',
  108. '8102' => 'Coupon Extended Code: Number System preceded by 0',
  109. '90' => 'Mutually Agreed Between Trading Partners',
  110. '91' => 'Internal Company Codes',
  111. '92' => 'Internal Company Codes',
  112. '93' => 'Internal Company Codes',
  113. '94' => 'Internal Company Codes',
  114. '95' => 'Internal Company Codes',
  115. '96' => 'Internal Company Codes',
  116. '97' => 'Internal Company Codes',
  117. '98' => 'Internal Company Codes',
  118. '99' => 'Internal Company Codes'
  119. );
  120. foreach ($identifiers as $key => $value) {
  121. if ($key) {
  122. $identifiers[$key] = $key . ' - ' . $value;
  123. }
  124. }
  125. registerImageKey('code', 'BCGgs1128');
  126. $vals = array();
  127. for($i = 0; $i <= 127; $i++) {
  128. $vals[] = '%' . sprintf('%02X', $i);
  129. }
  130. $characters = array(
  131. 'NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', 'BS', 'TAB', 'LF', 'VT', 'FF', 'CR', 'SO', 'SI', 'DLE', 'DC1', 'DC2', 'DC3', 'DC4', 'NAK', 'SYN', 'ETB', 'CAN', 'EM', 'SUB', 'ESC', 'FS', 'GS', 'RS', 'US',
  132. '&nbsp;', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
  133. '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
  134. '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'DEL'
  135. );
  136. ?>
  137. <ul id="specificOptions">
  138. <li class="option">
  139. <div class="title">
  140. <label for="start">Starts with</label>
  141. </div>
  142. <div class="value">
  143. <?php echo getSelectHtml('start', $start, array('NULL' => 'Auto', 'A' => 'Code 128-A', 'B' => 'Code 128-B', 'C' => 'Code 128-C')); ?>
  144. </div>
  145. </li>
  146. <li class="option">
  147. <div class="title">
  148. <label for="identifier">Identifiers</label>
  149. </div>
  150. <div class="value">
  151. <?php echo getSelectHtml('identifier', null, $identifiers); ?>
  152. <div id="identifierContainer"></div>
  153. </div>
  154. </li>
  155. </ul>
  156. <div id="validCharacters">
  157. <h3>Valid Characters</h3>
  158. <?php $c = count($characters); for ($i = 0; $i < $c; $i++) { echo getButton($characters[$i], $vals[$i]); } ?>
  159. </div>
  160. <div id="explanation">
  161. <h3>Explanation</h3>
  162. <ul>
  163. <li>Encoded as Code 128.</li>
  164. <li>The former correct name was UCC/EAN-128.</li>
  165. <li>Used for shipping containers.</li>
  166. <li>Based on the GS1 standard.</li>
  167. </ul>
  168. </div>
  169. <script>
  170. (function($) {
  171. "use strict";
  172. var identifierSelect = $("#identifier"),
  173. identifierContainer = $("#identifierContainer"),
  174. generateText = $("#text");
  175. var updateText = function() {
  176. var text = "";
  177. $(".gs1128_identifier").each(function() {
  178. var $this = $(this);
  179. text += "(" + $this.find(".gs1128_id").val() + ")" + $this.find(".gs1128_value").val() + "~F1";
  180. });
  181. text = text.substring(0, text.length - 3);
  182. generateText.val(text);
  183. };
  184. var addIdentifier = function(id) {
  185. var identifier = $("<div class='gs1128_identifier'><input type='text' value='" + id + "' class='gs1128_id' readonly='readonly' /> - <input type='text' class='gs1128_value' /><a href='#' class='gs1128_delete'><img src='delete.png' alt='Delete' /></a></div>")
  186. .appendTo(identifierContainer)
  187. identifier.find(".gs1128_delete").on("click", function() {
  188. $(this).closest(".gs1128_identifier").remove();
  189. updateText();
  190. return false;
  191. });
  192. identifier.find(".gs1128_value").on("keyup", function() {
  193. updateText();
  194. });
  195. identifierSelect.val();
  196. return;
  197. };
  198. identifierSelect.change(function() {
  199. addIdentifier($(this).find("option:selected").val());
  200. updateText();
  201. });
  202. generateText.on("keyup", function() {
  203. var val = $(this).val(),
  204. section = val.split("~F1"),
  205. i = 0, regex = /^\(([0-9]*y?)\)(.*)$/,
  206. result;
  207. // Let's remove all identifiers we put already
  208. $(".gs1128_identifier").remove();
  209. for (i = 0; i < section.length; i++) {
  210. // we are able to handle only if you have ()
  211. result = regex.exec(section[i]);
  212. if (result.length === 3) {
  213. addIdentifier(result[1]);
  214. $(".gs1128_identifier").eq(i).find(".gs1128_value").val(result[2]);
  215. } else {
  216. // Oups, you entered something wrong...
  217. $(".gs1128_identifier").remove();
  218. break;
  219. }
  220. }
  221. });
  222. $(function() {
  223. if (generateText.val() !== "") {
  224. generateText.keyup();
  225. }
  226. });
  227. })(jQuery);
  228. </script>
  229. <?php
  230. include('include/footer.php');
  231. ?>