Add processing of optional parts (do not populate).
authorHugo Villeneuve <hugo@hugovil.com>
Mon, 13 Jan 2014 16:14:55 +0000 (11:14 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Fri, 24 Jan 2014 03:54:32 +0000 (22:54 -0500)
Optional parts must have attribute "Asm" set to DNP.

bomgen/bomgen.php

index b7fd0bb..c240dea 100755 (executable)
@@ -21,20 +21,20 @@ $debug = 0;
 define("DATA_ROW_START", 3);
 
 define("PAPER_US_LETTER", 1);
-define("PAPER_US_LEGAL", 5);
-define("PAPER_US_A3", 8);
-define("PAPER_US_A4", 9);
-define("PAPER_US_A5", 11);
 
 define("QTY_COL_NAME", "Count");
 define("COMPANY_PN_COL_NAME", "P/N_LSI");
 define("DESIGNATOR_COL_NAME", "RefDes");
 
+
+define("ASSEMBLY_COL_NAME", "Asm");
+define("DO_NOT_POPULATE_KEYWORD", "DNP");
+
 /* width = 0 -> Ne pas afficher la colonne. */
 $csv_infos =
-  array("Count"          => array("nom"   => "Qty",
+  array(QTY_COL_NAME     => array("nom"   => "Qty",
                                   "width" => 5),
-        "RefDes"         => array("nom"   => "Designator",
+        DESIGNATOR_COL_NAME => array("nom"   => "Designator",
                                   "width" => 30),
         "Description"    => array("nom"   => "Description",
                                   "width" => 45),
@@ -42,18 +42,20 @@ $csv_infos =
                                   "width" => 15),
         "Voltage"        => array("nom"   => "Voltage",
                                   "width" => 10),
-        "CURRENT"        => array("nom"   => "Current",
+        "Current"        => array("nom"   => "Current",
                                   "width" => 10),
-        "POWER"          => array("nom"   => "Power",
+        "Power"          => array("nom"   => "Power",
                                   "width" => 10),
-        "MANUFACTURER"   => array("nom"   => "Manufacturer",
+        "Manufacturer"   => array("nom"   => "Manufacturer",
                                   "width" => 30),
         "Part Number"    => array("nom"   => "Manuf. P/N",
                                   "width" => 30),
-        "P/N_LSI"        => array("nom"   => "LSI P/N",
+        COMPANY_PN_COL_NAME => array("nom"   => "LSI P/N",
                                   "width" => 15),
         "PatternName"    => array("nom"   => "Footprint",
                                   "width" => 20),
+        ASSEMBLY_COL_NAME => array("nom"   => "Assembly",
+                                  "width" => 0),
         "UnitCost"       => array("nom"   => "Unit Cost",
                                   "width" => 7),
         "TotalCost"      => array("nom"   => "Total Cost", /* Colonne ajoutée par ce script. */
@@ -282,7 +284,7 @@ if (($handle = fopen($src, "r")) !== FALSE) {
       if (($ref_prefix2 == "MH") ||
           ($ref_prefix2 == "TP") ||
           ($ref_prefix2 == "FI") ||
-          (array_key_exists('NOPOP', $col_id_to_num) && ($row[$col_id_to_num['NOPOP']] == "NOPOP")) ||
+          (array_key_exists(ASSEMBLY_COL_NAME, $col_id_to_num) && ($row[$col_id_to_num[ASSEMBLY_COL_NAME]] == DO_NOT_POPULATE_KEYWORD)) ||
           ($company_pn == "*")) {
         /* Enlève les composants non désirés. */
         continue;