/* Exportation BOM digikey. */
function export_bom_digikey(&$data, $num, $col_num_to_id, $col_id_to_num, $filename)
{
- global $debug;
+ global $debug, $kits;
$handle = fopen($filename, "w");
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];
+ $qty = $kits * $row[$c]; /* Multiply unit cost by number of kits to assemble. */
} else if ($col_num_to_id[$c] == "Part Number") {
$pn = $row[$c];
$debug = 0;
$digikey_bom = false;
+$kits = 1;
define("DATA_ROW_START", 3);
"width" => 0),
);
+$short_opts = "hckn:";
+
function usage()
{
echo "Usage: bomgen.php [OPTIONS] [INPUT FILE]\n";
echo " -c Add cost information to the BOM\n";
echo " -k Create digikey BOM submission file (tab-separated fields)\n";
echo " -h Display this help and exit\n";
+ echo " -n Number of cards/kits for digikey BOM submission\n";
}
/*
$comp_total = 0;
$titre = "BOM";
-$short_opts = "hck";
-
$cg = new Console_Getopt();
/* Read the command line. */
case 'k':
$digikey_bom = true;
break;
+ case 'n':
+ $kits = $o[1];
+ break;
case 'h':
usage();
exit(1);