--- /dev/null
+<?php
+
+/*
+ * Copyright (C) 2013 Hugo Villeneuve <hugo@hugovil.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+/* Exportation BOM digikey. */
+function export_bom_digikey(&$data, $num, $col_num_to_id, $col_id_to_num, $filename)
+{
+ global $debug;
+
+ $handle = fopen($filename, "w");
+
+ foreach ($data as $key => $row) {
+ $num = count($row);
+
+ for ($c = 0; $c < $num; $c++) {
+ if (isset($col_num_to_id[$c])) {
+ if ($col_num_to_id[$c] == QTY_COL_NAME) {
+ $qty = $row[$c];
+ } else if ($col_num_to_id[$c] == "Part Number") {
+ $pn = $row[$c];
+
+ if ($pn == "") {
+ $pn = "MISSING";
+ }
+ } else if ($col_num_to_id[$c] == DESIGNATOR_COL_NAME) {
+ $refdes = $row[$c];
+ } else if ($col_num_to_id[$c] == "Manufacturer") {
+ $manuf = $row[$c];
+ }
+
+ }
+ }
+
+ if ($pn != "MISSING") {
+ $line = $qty . CSV_DK_DELIM . $manuf . CSV_DK_DELIM . $pn . CSV_DK_DELIM . $refdes . "\r\n";
+ fwrite($handle, $line);
+ }
+ }
+
+ fclose($handle);
+}
+
+?>