diff --git a/modules/ant_wp/AdminAntWp.php b/modules/ant_wp/AdminAntWp.php index 26f4a25d..28d53e01 100644 --- a/modules/ant_wp/AdminAntWp.php +++ b/modules/ant_wp/AdminAntWp.php @@ -5,15 +5,20 @@ include_once(_PS_ROOT_DIR_.'/modules/ant_wp/GenerateWp.php'); require_once _PS_PHPEXCEL_DIR_.'Classes/PHPExcel.php'; require_once _PS_PHPEXCEL_DIR_.'Classes/PHPExcel/IOFactory.php'; +ini_set('memory_limit', '8G'); +ini_set('max_execution_time', 300); class AdminAntWp extends AdminTab { + const DUPLICATED_EANS = 'duplicated_ean'; + const DUPLICATED_REFS = 'duplicated_refs'; protected $_html; public $module_name; public $config_tab; public $controller; public $helperForm; public $_object; + public $report; public function __construct($config_tab = true) { @@ -26,6 +31,9 @@ class AdminAntWp extends AdminTab $this->controller = 'AdminAntWp'; } $this->helperForm = new HelperFormBootstrap(); + $this->report = array(); + $this->report[self::DUPLICATED_EANS] = array(); + $this->report[self::DUPLICATED_REFS] = array(); // $this->helperForm->_select2 = true; // $this->helperForm->_inputSwitch = true; } @@ -101,6 +109,8 @@ class AdminAntWp extends AdminTab fgetcsv($f, 0, ';'); $products = array(); $product_info = array(); + $timer_table = array(); + $callStartTime = microtime(true); $refs = array(); $eans = array(); while($line = fgetcsv($f, 0, ';')) { @@ -109,191 +119,215 @@ class AdminAntWp extends AdminTab } if($line[0] != '') { $ean = trim($line[0]); - $products[$ean] = array( - 'ean' => $ean, - 'supplier_ref' => trim((String)utf8_encode($line[1])), - 'name_ha' => trim((String)utf8_encode($line[2])), - 'quantity' => trim($line[3]), - 'ppc' => trim((float)$line[4]), - 'prix_ha' => trim((float)$line[5]), - 'name_attribute_ha' => trim((String)$line[6]) - ); + if(!isset($products[$ean])){ + $products[$ean] = array( + 'ean' => $ean, + 'supplier_ref' => trim((String)utf8_encode($line[1])), + 'name_ha' => trim((String)utf8_encode($line[2])), + 'quantity' => trim($line[3]), + 'ppc' => trim((float)$line[4]), + 'prix_ha' => trim((float)$line[5]), + 'name_attribute_ha' => trim((String)$line[6]) + ); + }else{ + $this->report[self::DUPLICATED_EANS][] = $ean; + } $eans[] = $ean; } else { $ref = trim((String)utf8_encode($line[1])); - $products[$ref] = array( - 'ean' => trim($line[0]), - 'supplier_ref' => $ref, - 'name_ha' => trim((String)utf8_encode($line[2])), - 'quantity' => trim($line[3]), - 'ppc' => trim((float)$line[4]), - 'prix_ha' => trim((float)$line[5]), - 'name_attribute_ha' => trim((String)utf8_encode($line[6])) - ); + if(!isset($products[$ref])) { + $products[$ref] = array( + 'ean' => trim($line[0]), + 'supplier_ref' => $ref, + 'name_ha' => trim((String)utf8_encode($line[2])), + 'quantity' => trim($line[3]), + 'ppc' => trim((float)$line[4]), + 'prix_ha' => trim((float)$line[5]), + 'name_attribute_ha' => trim((String)utf8_encode($line[6])) + ); + }else{ + $this->report[self::DUPLICATED_REFS][] = $ref; + } $refs[] = $ref; } } - $product_info = array(); $product_found = 0; $ids = array(); $exclude_ids = $this->getBraderieProducts(); - foreach (Db::getInstance()->executeS(' - SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, p.`ean13`, p.`price`, p.`wholesale_price`, - p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.`nc8`, cu.`id_country` - FROM - `'._DB_PREFIX_.'product` p - INNER JOIN ( - SELECT date_add, max(id_product) as maxid - FROM `'._DB_PREFIX_.'product` - WHERE id_product NOT IN ('.implode(',',$exclude_ids).') - GROUP BY ean13 - ) as b - ON p.`id_product` = b.maxid - LEFT JOIN `'._DB_PREFIX_.'category_product` c - ON (b.maxid = c.`id_product` AND p.`id_category_default` = c.`id_category`) - LEFT JOIN `'._DB_PREFIX_.'product_customs` cu - ON (cu.`id_product` = p.`id_product`) - WHERE p.`ean13` IN ("'.implode('","',$eans).'") - AND p.`id_product` IS NOT NULL - ORDER BY c.`position` - ') as $row) { - if($row['ean13']!='' && isset($products[$row['ean13']])){ - $products[$row['ean13']] = array_merge($products[$row['ean13']], $row); - $product_found++; - $ids[] = (int)$row['id_product']; - } - // elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){ - // $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row); - // $product_found++; - // $ids[] = (int)$row['id_product']; - // } - } + $timer_table[] = 'Excluded products gathered at '.(microtime(true)-$callStartTime); + if(count($eans) > 0) { + $sql = ' + SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, p.`ean13`, p.`price`, p.`wholesale_price`, + p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.`nc8`, cu.`id_country` + FROM + `' . _DB_PREFIX_ . 'product` p + INNER JOIN ( + SELECT date_add, max(id_product) as maxid + FROM `' . _DB_PREFIX_ . 'product` + WHERE id_product NOT IN (' . implode(',', $exclude_ids) . ') + GROUP BY ean13 + ) as b + ON p.`id_product` = b.maxid + LEFT JOIN `' . _DB_PREFIX_ . 'category_product` c + ON (b.maxid = c.`id_product` AND p.`id_category_default` = c.`id_category`) + LEFT JOIN `' . _DB_PREFIX_ . 'product_customs` cu + ON (cu.`id_product` = p.`id_product`) + WHERE p.`ean13` IN ("' . implode('","', $eans) . '") + AND p.`id_product` IS NOT NULL + ORDER BY c.`position` + '; + $result = Db::getInstance()->executeS($sql); - foreach (Db::getInstance()->executeS(' + foreach ($result as $row) { + if($row['ean13'] == '8427077902761'){ + $timer_table[] = json_encode($row); + } + if ($row['ean13'] != '' && isset($products[$row['ean13']])) { + $products[$row['ean13']] = array_merge($products[$row['ean13']], $row); + $product_found++; + $ids[] = (int)$row['id_product']; + } + // elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){ + // $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row); + // $product_found++; + // $ids[] = (int)$row['id_product']; + // } + } + } + $timer_table[] = 'Ean product gathered at '.(microtime(true)-$callStartTime); + if(count($refs)> 0) { + foreach (Db::getInstance()->executeS(' SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, p.`ean13`, p.`price`, p.`wholesale_price`, p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.`nc8`, cu.`id_country` FROM - `'._DB_PREFIX_.'product` p + `' . _DB_PREFIX_ . 'product` p INNER JOIN ( SELECT date_add, max(id_product) as maxid - FROM `'._DB_PREFIX_.'product` - WHERE id_product NOT IN ('.implode(',',$exclude_ids).') + FROM `' . _DB_PREFIX_ . 'product` + WHERE id_product NOT IN (' . implode(',', $exclude_ids) . ') GROUP BY supplier_reference ) as b ON p.`id_product` = b.maxid - LEFT JOIN `'._DB_PREFIX_.'category_product` c + LEFT JOIN `' . _DB_PREFIX_ . 'category_product` c ON (b.maxid = c.`id_product` AND p.`id_category_default` = c.`id_category`) - LEFT JOIN `'._DB_PREFIX_.'product_customs` cu + LEFT JOIN `' . _DB_PREFIX_ . 'product_customs` cu ON (cu.`id_product` = p.`id_product`) - WHERE p.`supplier_reference` IN ("'.implode('","',$refs).'") + WHERE p.`supplier_reference` IN ("' . implode('","', $refs) . '") AND p.`id_product` IS NOT NULL ORDER BY c.`position` ') as $row) { - // if($row['ean13']!='' && isset($products[$row['ean13']])){ - // $products[$row['ean13']] = array_merge($products[$row['ean13']], $row); - // $product_found++; - // $ids[] = (int)$row['id_product']; - // } else - if($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){ - $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row); - $product_found++; - $ids[] = (int)$row['id_product']; + // if($row['ean13']!='' && isset($products[$row['ean13']])){ + // $products[$row['ean13']] = array_merge($products[$row['ean13']], $row); + // $product_found++; + // $ids[] = (int)$row['id_product']; + // } else + if ($row['supplier_reference'] != '' && isset($products[$row['supplier_reference']])) { + $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row); + $product_found++; + $ids[] = (int)$row['id_product']; + } } } - - foreach (Db::getInstance()->executeS(' + $timer_table[] = 'Ref product gathered at '.(microtime(true)-$callStartTime); + if(count($eans) > 0) { + foreach (Db::getInstance()->executeS(' SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`, b.`id_product_attribute`, b.`ean13`, b.`supplier_reference` as at_ref, p.`price`, p.`wholesale_price`, p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.`nc8`, cu.`id_country`, al.`name` as attribute_name FROM - `'._DB_PREFIX_.'product` p + `' . _DB_PREFIX_ . 'product` p INNER JOIN ( SELECT max(id_product) as maxid, ean13, `supplier_reference`, `id_product_attribute` - FROM `'._DB_PREFIX_.'product_attribute` - WHERE id_product NOT IN ('.implode(',',$exclude_ids).') + FROM `' . _DB_PREFIX_ . 'product_attribute` + WHERE id_product NOT IN (' . implode(',', $exclude_ids) . ') GROUP BY ean13 ) as b ON p.`id_product`= b.maxid - LEFT JOIN `'._DB_PREFIX_.'category_product` c + LEFT JOIN `' . _DB_PREFIX_ . 'category_product` c ON (b.maxid = c.`id_product` AND p.`id_category_default` = c.`id_category`) - LEFT JOIN `'._DB_PREFIX_.'product_customs` cu + LEFT JOIN `' . _DB_PREFIX_ . 'product_customs` cu ON (cu.`id_product` = p.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` ac + LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` ac ON (ac.`id_product_attribute` = b.`id_product_attribute`) - LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al + LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON (al.`id_attribute` = ac.`id_attribute` AND al.`id_lang` = 2) - WHERE b.`ean13` IN ("'.implode('","',$eans).'") + WHERE b.`ean13` IN ("' . implode('","', $eans) . '") AND p.`id_product` IS NOT NULL ORDER BY c.`position` ') as $row) { - if($row['ean13']!='' && isset($products[$row['ean13']])){ - $products[$row['ean13']] = array_merge($products[$row['ean13']], $row); - $product_found++; - if(!in_array((int)$row['id_product'],$ids)){ - $ids[] = (int)$row['id_product']; + if ($row['ean13'] != '' && isset($products[$row['ean13']])) { + $products[$row['ean13']] = array_merge($products[$row['ean13']], $row); + $product_found++; + if (!in_array((int)$row['id_product'], $ids)) { + $ids[] = (int)$row['id_product']; + } } + // elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){ + // $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row); + // $product_found++; + // if(!in_array((int)$row['id_product'],$ids)){ + // $ids[] = (int)$row['id_product']; + // } + // } elseif($row['at_ref']!='' && isset($products[$row['at_ref']])){ + // $products[$row['at_ref']] = array_merge($products[$row['at_ref']], $row); + // $product_found++; + // if(!in_array((int)$row['id_product'],$ids)){ + // $ids[] = (int)$row['id_product']; + // } + // } } - // elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){ - // $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row); - // $product_found++; - // if(!in_array((int)$row['id_product'],$ids)){ - // $ids[] = (int)$row['id_product']; - // } - // } elseif($row['at_ref']!='' && isset($products[$row['at_ref']])){ - // $products[$row['at_ref']] = array_merge($products[$row['at_ref']], $row); - // $product_found++; - // if(!in_array((int)$row['id_product'],$ids)){ - // $ids[] = (int)$row['id_product']; - // } - // } } - foreach (Db::getInstance()->executeS(' + $timer_table[] = 'Ean product attr gathered at '.(microtime(true)-$callStartTime); + if(count($refs) > 0) { + foreach (Db::getInstance()->executeS(' SELECT p.`id_product`, p.`id_tax_rules_group`, p.`id_category_default`,b.`id_product_attribute`, b.`ean13`, b.`supplier_reference` as at_ref, p.`price`, p.`wholesale_price`, p.`reference`, p.`supplier_reference`, p.`weight`, p.`height`, p.`width`, p.`depth`, c.`position`, cu.`nc8`, cu.`id_country`, al.`name` as attribute_name FROM - `'._DB_PREFIX_.'product` p + `' . _DB_PREFIX_ . 'product` p INNER JOIN ( SELECT max(id_product) as maxid, ean13, `supplier_reference`, `id_product_attribute` - FROM `'._DB_PREFIX_.'product_attribute` - WHERE id_product NOT IN ('.implode(',',$exclude_ids).') + FROM `' . _DB_PREFIX_ . 'product_attribute` + WHERE id_product NOT IN (' . implode(',', $exclude_ids) . ') GROUP BY supplier_reference ) as b ON p.`id_product`= b.maxid - LEFT JOIN `'._DB_PREFIX_.'category_product` c + LEFT JOIN `' . _DB_PREFIX_ . 'category_product` c ON (b.maxid = c.`id_product` AND p.`id_category_default` = c.`id_category`) - LEFT JOIN `'._DB_PREFIX_.'product_customs` cu + LEFT JOIN `' . _DB_PREFIX_ . 'product_customs` cu ON (cu.`id_product` = p.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` ac + LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` ac ON (ac.`id_product_attribute` = b.`id_product_attribute`) - LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al + LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON (al.`id_attribute` = ac.`id_attribute` AND al.`id_lang` = 2) - WHERE b.`supplier_reference` IN ("'.implode('","',$refs).'") + WHERE b.`supplier_reference` IN ("' . implode('","', $refs) . '") AND p.`id_product` IS NOT NULL ORDER BY c.`position` ') as $row) { - // if($row['ean13']!='' && isset($products[$row['ean13']])){ - // $products[$row['ean13']] = array_merge($products[$row['ean13']], $row); - // $product_found++; - // if(!in_array((int)$row['id_product'],$ids)){ - // $ids[] = (int)$row['id_product']; - // } - // } - if($row['at_ref']!='' && isset($products[$row['at_ref']])){ - $products[$row['at_ref']] = array_merge($products[$row['at_ref']], $row); - $product_found++; - if(!in_array((int)$row['id_product'],$ids)){ - $ids[] = (int)$row['id_product']; - } - } elseif($row['supplier_reference']!='' && isset($products[$row['supplier_reference']])){ - $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row); - $product_found++; - if(!in_array((int)$row['id_product'],$ids)){ - $ids[] = (int)$row['id_product']; + // if($row['ean13']!='' && isset($products[$row['ean13']])){ + // $products[$row['ean13']] = array_merge($products[$row['ean13']], $row); + // $product_found++; + // if(!in_array((int)$row['id_product'],$ids)){ + // $ids[] = (int)$row['id_product']; + // } + // } + if ($row['at_ref'] != '' && isset($products[$row['at_ref']])) { + $products[$row['at_ref']] = array_merge($products[$row['at_ref']], $row); + $product_found++; + if (!in_array((int)$row['id_product'], $ids)) { + $ids[] = (int)$row['id_product']; + } + } elseif ($row['supplier_reference'] != '' && isset($products[$row['supplier_reference']])) { + $products[$row['supplier_reference']] = array_merge($products[$row['supplier_reference']], $row); + $product_found++; + if (!in_array((int)$row['id_product'], $ids)) { + $ids[] = (int)$row['id_product']; + } } } } + $timer_table[] = 'Ref product attr gathered at '.(microtime(true)-$callStartTime); $new_products = count($products) - $product_found; if(!empty($ids)){ foreach (Db::getInstance()->executeS(' @@ -320,7 +354,7 @@ class AdminAntWp extends AdminTab } } } - + $timer_table[] = 'Additional info gathered at '.(microtime(true)-$callStartTime); foreach (Db::getInstance()->executeS(' SELECT at.`ean13`, at.`supplier_reference` as at_ref, p.`supplier_reference`, pl.* FROM '._DB_PREFIX_.'product p @@ -353,14 +387,24 @@ class AdminAntWp extends AdminTab } } } + $timer_table[] = 'Additional info (attr) gathered at '.(microtime(true)-$callStartTime); } $params['lines'] = $products; if(!empty($params['lines'])){ $wp = new GenerateWp(); - $wp->generate($params); + $wp->generate($params, $timer_table, $callStartTime); $filename = str_replace(' ', '_', $filename); - $wp->objWriter->save(dirname(__FILE__).'/'.$filename.'.xlsx'); - $this->_html .= HelperFormBootstrap::displaySuccess('Génération complète
Télécharger le XLS
Produits trouvés : '.$product_found.'
Produits nouveaux : '.$new_products); + $wp->objWriter->save(__DIR__ .'/'.$filename.'.xlsx'); + $timer_table_formatted = implode('
', $timer_table); + $duplicated_formatted = ''; + if (!empty($this->report[self::DUPLICATED_REFS])) { + $duplicated_formatted = '
Duplications de Reférences

' . implode('
', $this->report[self::DUPLICATED_REFS]). '

'; + } + if (!empty($this->report[self::DUPLICATED_EANS])) { + $duplicated_formatted .= '
Duplications d\'EANs

' . implode('
', $this->report[self::DUPLICATED_EANS]) . '

'; + } + $this->_html .= HelperFormBootstrap::displaySuccess('Génération complète
Télécharger le XLS'. + '
Produits trouvés : '.$product_found.'
Produits nouveaux : '.$new_products.$duplicated_formatted.'


Timers :
'.$timer_table_formatted.'

'); } else { $this->_html .= HelperFormBootstrap::displayErrors($this->l('Veuillez charger un fichier correct !')); } diff --git a/modules/ant_wp/GenerateWp.php b/modules/ant_wp/GenerateWp.php index 63dd6d24..b2b5931f 100644 --- a/modules/ant_wp/GenerateWp.php +++ b/modules/ant_wp/GenerateWp.php @@ -28,81 +28,115 @@ class GenerateWp $this->columns = array( 'B' => 'EAN', 'C' => 'Ref fournisseur', - 'D' => 'Nom du produit', - 'E' => 'Type de produit', - 'F' => 'Nom / Collection', - 'G' => 'Coloris / Déclinaison', - 'H' => 'Taille HA', - 'I' => 'Taille (old)', - 'J' => 'Nom du produit HA', - 'K' => 'Nom du produit (old)', - 'L' => 'Nb de caract. Titre', - 'M' => 'Order', - 'N' => 'Catégorie', - 'O' => 'Sous-catégorie', - 'P' => 'Sous-sous-catégorie', - 'Q' => 'Nb de photos', - 'R' => 'Ordre Logistique', - 'S' => 'Ref Bébé Boutik', - 'T' => 'Nb de caract. Ref', - 'U' => 'Description courte', - 'V' => 'Bon à savoir', - 'W' => 'Les plus', - 'X' => 'Vidéo', - 'Y' => 'Livraison', - 'Z' => 'Poids', - 'AA' => 'Vente old', - 'AB' => 'BDC old', - 'AC' => 'Quantité réservée', - 'AD' => 'Taille', - 'AE' => 'TVA appliquée', - 'AF' => 'PPC TTC', - 'AG' => 'PPC old', - 'AH' => 'Prix achat HT', - 'AI' => 'Prix HA old', - 'AJ' => 'Différence', - 'AK' => 'PV 3BTK appliqué', - 'AL' => 'Prix vente old', - 'AM' => 'Remise membre', - 'AN' => 'Marge', - 'AO' => 'Photos', - 'AP' => 'Photos old', - 'AQ' => 'BDC Potentiel', - 'AR' => 'Custom code', - 'AS' => 'Pays de fabrication', - 'AT' => 'Date de la vente'); + 'D' => 'Ref modifiée', + 'E' => 'Nom du produit', + 'F' => 'Type de produit', + 'G' => 'Nom / Collection', + 'H' => 'Coloris / Déclinaison', + 'I' => 'Taille HA', + 'J' => 'Taille (old)', + 'K' => 'Nom du produit HA', + 'L' => 'Nom du produit (old)', + 'M' => 'Nb de caract. Titre', + 'N' => 'Order', + 'O' => 'Catégorie', + 'P' => 'Sous-catégorie', + 'Q' => 'Sous-sous-catégorie', + 'R' => 'Nb de photos', + 'S' => 'Ordre Logistique', + 'T' => 'Ref Bébé Boutik', + 'U' => 'Nb de caract. Ref', + 'V' => 'Description courte', + 'W' => 'Bon à savoir', + 'X' => 'Les plus', + 'Y' => 'Vidéo', + 'Z' => 'Livraison', + 'AA'=> 'Poids', + 'AB' => 'Vente old', + 'AC' => 'BDC old', + 'AD' => 'Quantité réservée', + 'AE' => 'Taille', + 'AF' => 'TVA appliquée', + 'AG' => 'PPC TTC', + 'AH' => 'PPC old', + 'AI' => 'Prix achat HT', + 'AJ' => 'Prix HA old', + 'AK' => 'Différence', + 'AL' => 'PV 3BTK appliqué', + 'AM' => 'Prix vente old', + 'AN' => 'Remise membre', + 'AO' => 'Marge', + 'AP' => 'Photos', + 'AQ' => 'Photos old', + 'AR' => 'BDC Potentiel', + 'AS' => 'Custom code', + 'AT' => 'Pays de fabrication', + 'AU' => 'Date de la vente'); } public static $FORMAT_DARK_BLUE = '214A7B'; public static $FORMAT_LIGHT_BLUE = '6C8DCD'; public static $FORMAT_LIGHTER_DARK_BLUE = 'C6D9F0'; public static $FORMAT_BG_LIGHT_RED = 'FEC7CE'; + public static $FORMAT_BG_DARK_RED = 'FF9A0511'; public static $FORMAT_BG_LIGHT_GREEN = 'C7EECF'; + public static $FORMAT_BG_DARK_GREEN = 'FF09600B'; public static $FORMAT_BG_LIGHT_YELLOW = 'FEEAA0'; + public static $FORMAT_BG_DARK_YELLOW = 'FFA36415'; - public function generate($params) + public function generate($params, &$timer_table, $callStartTime) { $sheets = array(0,1); $lastLine = count($params['lines'])+4; $this->objPHPExcel->removeSheetByIndex(0); + $borders_style = array( + 'borders' => array( + 'allborders' => array( + 'style' => PHPExcel_Style_Border::BORDER_THIN, + 'color' => array( + 'rgb' => '000000' + ) + ) + ) + ); + + $borders_style_none = array( + 'borders' => array( + 'allborders' => array( + 'style' => PHPExcel_Style_Border::BORDER_THIN, + 'color' => array( + 'rgb' => 'FFFFFF' + ) + ) + ) + ); + + $darker_light_blue_style = array( + 'type' => PHPExcel_Style_Fill::FILL_SOLID, + 'rotation' => 0, + 'startcolor' => array( + 'rgb' => self::$FORMAT_LIGHTER_DARK_BLUE + ), + 'endcolor' => array( + 'rgb' => self::$FORMAT_LIGHTER_DARK_BLUE + ) + ); + foreach ($sheets as $key => $sheet) { $this->objPHPExcel->createSheet(); $this->objPHPExcel->setActiveSheetIndex($key); $this->objPHPExcel->setActiveSheetIndex($key)->setCellValue('A1','Vente - '.(String)$params['marque']); $activeSheet = $this->objPHPExcel->getActiveSheet(); - if($key == 0){ - $activeSheet->setTitle('WP-Vente FR'); - }else{ - $activeSheet->setTitle('WP-Vente ES'); - } + $activeSheet->mergeCells('A1:B1'); - if($key == 0){ - $activeSheet->setCellValue('AO1',(String)$params['marque']); - $activeSheet->getStyle('AO1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE); - $activeSheet->getStyle('AO1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); - $activeSheet->getStyle('AO1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER); - $activeSheet->getStyle('AO1')->getFill()->applyFromArray( + if($key === 0){ + $activeSheet->setTitle('WP-Vente FR'); + $activeSheet->setCellValue('AP1',(String)$params['marque']); + $activeSheet->getStyle('AP1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE); + $activeSheet->getStyle('AP1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); + $activeSheet->getStyle('AP1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER); + $activeSheet->getStyle('AP1')->getFill()->applyFromArray( array( 'type' => PHPExcel_Style_Fill::FILL_SOLID, 'rotation' => 0, @@ -114,41 +148,38 @@ class GenerateWp ) ) ); + + }elseif($key === 1){ + $activeSheet->setTitle('WP-Vente ES'); } - - $activeSheet->getStyle('A1:AT'.$lastLine)->getFont()->setSize(10); - $activeSheet->getStyle('A1:AT'.$lastLine)->getFont()->setName('calibri'); + $activeSheet->getStyle('A1:AZ'.($lastLine+20))->applyFromArray($borders_style_none); + $activeSheet->getStyle('A1:AU'.$lastLine)->getFont()->setSize(10); + $activeSheet->getStyle('A1:AU'.$lastLine)->getFont()->setName('calibri'); + $activeSheet->getColumnDimension('A')->setWidth(3); + $activeSheet->freezePane('E5'); } - - $borders_style = array( - 'borders' => array( - 'allborders' => array( - 'style' => PHPExcel_Style_Border::BORDER_NONE - ) - ) - ); - + $timer_table[] = 'Excel sheet format done for the 3 first lines in '.(microtime(true)-$callStartTime); $i=4; - $activeSheet->getColumnDimension('A')->setWidth(3); + foreach ($this->columns as $key => $value) { $this->objPHPExcel->setActiveSheetIndex(0); $activeSheet = $this->objPHPExcel->getActiveSheet(); $activeSheet->getRowDimension($i)->setRowHeight(25); - if(in_array($key, array('B','C','N','O','P','S','V','W','X','Y'), true)){ + if(in_array($key, array('B','C','D','O','P','Q','T','W','X','Y','Z'), true)){ $activeSheet->getColumnDimension($key)->setWidth(16); - } elseif(in_array($key, array('E','F','G','H','I','J','K'), true)){ + } elseif(in_array($key, array('F','G','H','I','J','K','L'), true)){ $activeSheet->getColumnDimension($key)->setWidth(20); - } elseif(in_array($key, array('L','M','Q','R','T'), true)){ + } elseif(in_array($key, array('M','N','R','S','U'), true)){ $activeSheet->getColumnDimension($key)->setWidth(10); - } elseif(in_array($key, array('Z','AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM','AN'), true)){ + } elseif(in_array($key, array('AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM','AN','AO'), true)){ $activeSheet->getColumnDimension($key)->setWidth(11); - } elseif(in_array($key, array('U','AO'), true)){ + } elseif(in_array($key, array('V','AP'), true)){ $activeSheet->getColumnDimension($key)->setWidth(45); - } elseif(in_array($key, array('AQ','AR','AS','AT'), true)){ + } elseif(in_array($key, array('AR','AS','AT', 'AU'), true)){ $activeSheet->getColumnDimension($key)->setWidth(12); - } elseif('D' === $key){ + } elseif('E' === $key){ $activeSheet->getColumnDimension($key)->setWidth(25); - } elseif('AP' === $key){ + } elseif('AQ' === $key){ $activeSheet->getColumnDimension($key)->setWidth(40); } @@ -172,7 +203,7 @@ class GenerateWp $activeSheet->getStyle($key.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER); $activeSheet->getStyle($key.$i)->getAlignment()->setWrapText(true); $activeSheet->getStyle($key.$i)->applyFromArray($borders_style); - if(in_array($key,array('AA','AB','AG','AI','AJ','AL'),true)){ + if(in_array($key,array('AB','AC','AH','AJ','AK','AM'),true)){ $activeSheet->getStyle($key.$i)->getFill()->applyFromArray( array( 'type' => PHPExcel_Style_Fill::FILL_SOLID, @@ -204,11 +235,11 @@ class GenerateWp $this->objPHPExcel->setActiveSheetIndex(1); $activeSheet = $this->objPHPExcel->getActiveSheet(); $activeSheet->getRowDimension($i)->setRowHeight(25); - if(in_array($key, array('B','C','D','F','G','H','J'), true)) { + if(in_array($key, array('B','C','D','E','G','H','I'), true)) { $activeSheet->getColumnDimension($key)->setWidth(13); - } elseif(in_array($key, array('E','J'), true)) { + } elseif(in_array($key, array('F','K'), true)) { $activeSheet->getColumnDimension($key)->setWidth(25); - } elseif('I' === $key) { + } elseif('J' === $key) { $activeSheet->getColumnDimension($key)->setWidth(35); } else { $activeSheet->getColumnDimension($key)->setWidth(8); @@ -233,11 +264,139 @@ class GenerateWp ) ); } - + $timer_table[] = 'Excel sheet format done for the 4 first lines in '.(microtime(true)-$callStartTime); $i++; $sales = array(); $order_states = explode(',', Configuration::get('PS_IT_OF_ORDER_STATES')); + foreach ($params['lines'] as $key => $row) { + + $image_line = '=IF(R'.$i.'="","",IF(R'.$i.'=1, + "https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg", + IF(R'.$i.'=2, + "https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg", + IF(R'.$i.'=3, + "https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg", + IF(R'.$i.'=4, + "https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg", + IF(R'.$i.'='.$i.',"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg", + IF(R'.$i.'=6,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg", + IF(R'.$i.'=7,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-6.jpg", + IF(R'.$i.'=8,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-6.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-7.jpg", + IF(R'.$i.'=9,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-6.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-7.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-8.jpg", + IF(R'.$i.'=10,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-6.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-7.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-8.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-9.jpg", + IF(R'.$i.'=11,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-6.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-7.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-8.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-9.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-10.jpg", + IF(R'.$i.'=12,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-6.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-7.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-8.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-9.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-10.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-11.jpg", + IF(R'.$i.'=13,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-6.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-7.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-8.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-9.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-10.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-11.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-12.jpg", + IF(R'.$i.'=14,"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-6.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-7.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-8.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-9.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-10.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-11.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-12.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-13.jpg", + IF(R'.$i.'=1'.$i.',"https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&".jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-1.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-2.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-3.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-4.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-5.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-6.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-7.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-8.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-9.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-10.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-11.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-12.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-13.jpg, + https://static.bebeboutik.com/img_import/"&AP1&"/"&D'.$i.'&"-14.jpg"))))))))))))))))'; + $image_line = str_replace(array("\r", "\n", ' '), '', $image_line); + if(isset($row['id_product'])){ $id_categories = array(); foreach(Db::getInstance()->ExecuteS(' @@ -258,14 +417,14 @@ class GenerateWp } $categories_title = array(2 => array(0 => '', 1 => '', 2 => ''), 3 => array(0 => '', 1 => '', 2 => '')); - foreach ($id_categories as $key => $id_category) { + foreach ($id_categories as $key_cat => $id_category) { foreach (Db::getInstance()->executeS(' SELECT `name`,`id_lang` FROM `'._DB_PREFIX_.'category_lang` WHERE `id_category` = '.(int) $id_category.' AND (`id_lang` = 2 OR `id_lang` = 3) ') as $title) { - $categories_title[$title['id_lang']][$key] = $title['name']; + $categories_title[$title['id_lang']][$key_cat] = $title['name']; } } @@ -283,7 +442,6 @@ class GenerateWp } $price = Product::getPriceStatic($row['id_product'],TRUE, NULL, 2, NULL, FALSE, FALSE); $price2 = Product::getPriceStatic($row['id_product'],TRUE, NULL, 2); - if(isset($row['id_product_attribute'])){ $quantity_sold = (int) Db::getInstance()->getValue(' SELECT SUM(d.`product_quantity` - d.`product_quantity_reinjected`) @@ -305,53 +463,61 @@ class GenerateWp AND sc.id_order_state IN ("'.implode('","', $order_states).'") '); } + if($quantity_sold === 0){ + $quantity_sold = ''; + $total_revenue = ''; + }else{ + $total_revenue = Tools::ps_round(($quantity_sold * $row['wholesale_price']),2); + } + $this->objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$i, (String)$row['ean']) - ->setCellValue('C'.$i, (String)$row['supplier_reference']) - ->setCellValue('D'.$i, '=IF(AND(E'.$i.'="",F'.$i.'="",G'.$i.'=""),"",E'.$i.'&" "&F'.$i.'&" - "&G'.$i.')') - ->setCellValue('E'.$i, '') + ->setCellValue('C'.$i, (String)$row['supplier_ref']) + ->setCellValue('D'.$i, (String)$row['supplier_reference']) + ->setCellValue('E'.$i, '=IF(AND(F'.$i.'="",G'.$i.'="",H'.$i.'=""),"",F'.$i.'&" "&G'.$i.'&" - "&H'.$i.')') ->setCellValue('F'.$i, '') ->setCellValue('G'.$i, '') - ->setCellValue('H'.$i, $row['name_attribute_ha']) - ->setCellValue('I'.$i, (isset($row['attribute_name'])?$row['attribute_name']:'')) - ->setCellValue('J'.$i, $row['name_ha']) - ->setCellValue('K'.$i, $row['lang'][2]['name']) - ->setCellValue('L'.$i, '=LEN(D'.$i.')') - ->setCellValue('M'.$i, (int)$row['position']) - ->setCellValue('N'.$i, $categories_title[2][0]) - ->setCellValue('O'.$i, $categories_title[2][1]) - ->setCellValue('P'.$i, $categories_title[2][2]) - ->setCellValue('Q'.$i, count($images)) - ->setCellValue('R'.$i, '') - ->setCellValue('S'.$i, '=AO1&"-"&R'.$i.'&"-"&LEFT(C'.$i.',9)') - ->setCellValue('T'.$i, '=IF(S'.$i.'="","",LEN(S'.$i.'))') - ->setCellValue('U'.$i, $row['lang'][2]['description_short']) - ->setCellValue('V'.$i, $row['lang'][2]['description']) - ->setCellValue('W'.$i, $row['lang'][2]['description_more']) - ->setCellValue('X'.$i, $row['lang'][2]['videos']) - ->setCellValue('Y'.$i, $row['lang'][2]['description_delivery']) - ->setCellValue('Z'.$i, $row['weight']) - ->setCellValue('AA'.$i, $quantity_sold) - ->setCellValue('AB'.$i, Tools::ps_round(($quantity_sold * $row['wholesale_price']),2)) - ->setCellValue('AC'.$i, $row['quantity']) - ->setCellValue('AD'.$i, $row['height']) - ->setCellValue('AE'.$i, $row['id_tax_rules_group']) - ->setCellValue('AF'.$i, $row['ppc']) - ->setCellValue('AG'.$i, Product::getPriceStatic($row['id_product'],TRUE, (int) $k, 2, NULL, FALSE, FALSE)) - ->setCellValue('AH'.$i, $row['prix_ha']) - ->setCellValue('AI'.$i, Tools::ps_round($row['wholesale_price'], 2)) - ->setCellValue('AJ'.$i, '=IF(AI'.$i.'="","",IF((AH'.$i.'-AI'.$i.')>0,"ATTENTION",IF((AH'.$i.'-AI'.$i.')<0,"COOL",IF((AH'.$i.'-AI'.$i.')=0,"OK",""))))') - ->setCellValue('AK'.$i, '=IF(AH'.$i.'="","",(AH'.$i.'*1.85))') - ->setCellValue('AL'.$i, $price2) - ->setCellValue('AM'.$i, '=IF(AND(AF'.$i.'="",AK'.$i.'=""),"",ROUND((1-AK'.$i.'/AF'.$i.')*100,4))') - ->setCellValue('AN'.$i, '=IF(AND(AH'.$i.'="",AK'.$i.'=""),"",1-AH'.$i.'/(AK'.$i.'/1.2))') - ->setCellValue('AO'.$i, '=IF(Q'.$i.'="","",IF(Q'.$i.'=1,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg",IF(Q'.$i.'=2,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg",IF(Q'.$i.'=3,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg",IF(Q'.$i.'=4,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg",IF(Q'.$i.'='.$i.',"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg",IF(Q'.$i.'=6,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg",IF(Q'.$i.'=7,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg",IF(Q'.$i.'=8,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg",IF(Q'.$i.'=9,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg",IF(Q'.$i.'=10,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg",IF(Q'.$i.'=11,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg",IF(Q'.$i.'=12,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-11.jpg",IF(Q'.$i.'=13,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-11.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-12.jpg",IF(Q'.$i.'=14,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-11.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-12.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-13.jpg",IF(Q'.$i.'=1'.$i.',"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-11.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-12.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-13.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-14.jpg"))))))))))))))))') - ->setCellValue('AP'.$i, implode(', ', $images)) - ->setCellValue('AQ'.$i, '=AC'.$i.'*AH'.$i) - ->setCellValue('AR'.$i, isset($row['nc8'])?$row['nc8']:"") - ->setCellValue('AS'.$i, isset($row['id_country'])?$row['id_country']:"") - ->setCellValue('AT'.$i, date('d/m/Y',strtotime($sales[$id_categories[0]]))); - $this->objPHPExcel->setActiveSheetIndex(0)->getStyle('B'.$i.':AT'.$i.'')->applyFromArray($borders_style); + ->setCellValue('H'.$i, '') + ->setCellValue('I'.$i, $row['name_attribute_ha']) + ->setCellValue('J'.$i, (isset($row['attribute_name'])?$row['attribute_name']:'')) + ->setCellValue('K'.$i, $row['name_ha']) + ->setCellValue('L'.$i, $row['lang'][2]['name']) + ->setCellValue('M'.$i, '=LEN(E'.$i.')') + ->setCellValue('N'.$i, (int)$row['position']) + ->setCellValue('O'.$i, $categories_title[2][0]) + ->setCellValue('P'.$i, $categories_title[2][1]) + ->setCellValue('Q'.$i, $categories_title[2][2]) + ->setCellValue('R'.$i, count($images)) + ->setCellValue('S'.$i, '') + ->setCellValue('T'.$i, '=AP1&"-"&S'.$i.'&"-"&LEFT(D'.$i.',9)') + ->setCellValue('U'.$i, '=IF(T'.$i.'="","",LEN(T'.$i.'))') + ->setCellValue('V'.$i, $row['lang'][2]['description_short']) + ->setCellValue('W'.$i, $row['lang'][2]['description']) + ->setCellValue('X'.$i, $row['lang'][2]['description_more']) + ->setCellValue('Y'.$i, $row['lang'][2]['videos']) + ->setCellValue('Z'.$i, $row['lang'][2]['description_delivery']) + ->setCellValue('AA'.$i, $row['weight']) + ->setCellValue('AB'.$i, $quantity_sold) + ->setCellValue('AC'.$i, $total_revenue) + ->setCellValue('AD'.$i, $row['quantity']) + ->setCellValue('AE'.$i, $row['height']) + ->setCellValue('AF'.$i, $row['id_tax_rules_group']) + ->setCellValue('AG'.$i, $row['ppc']) + ->setCellValue('AH'.$i, Product::getPriceStatic($row['id_product'],TRUE, NULL, 2, NULL, FALSE, FALSE)) + ->setCellValue('AI'.$i, $row['prix_ha']) + ->setCellValue('AJ'.$i, Tools::ps_round($row['wholesale_price'], 2)) + ->setCellValue('AK'.$i, '=IF(AJ'.$i.'="","",IF((AI'.$i.'-AJ'.$i.')>0,"ATTENTION",IF((AI'.$i.'-AJ'.$i.')<0,"COOL",IF((AI'.$i.'-AJ'.$i.')=0,"OK",""))))') + ->setCellValue('AL'.$i, '=IF(AI'.$i.'="","",(AI'.$i.'*1.85))') + ->setCellValue('AM'.$i, $price2) + ->setCellValue('AN'.$i, '=IF(AND(AG'.$i.'="",AL'.$i.'=""),"",ROUND((1-AL'.$i.'/AG'.$i.')*100,4))') + ->setCellValue('AO'.$i, '=IF(AND(AI'.$i.'="",AL'.$i.'=""),"",1-AI'.$i.'/(AL'.$i.'/1.2))') + ->setCellValue('AP'.$i, $image_line) + ->setCellValue('AQ'.$i, implode(', ', $images)) + ->setCellValue('AR'.$i, '=AD'.$i.'*AI'.$i) + ->setCellValue('AS'.$i, isset($row['nc8'])?$row['nc8']:"") + ->setCellValue('AT'.$i, isset($row['id_country'])?$row['id_country']:"") + ->setCellValue('AU'.$i, date('d/m/Y',strtotime($sales[$id_categories[0]]))); + $this->objPHPExcel->setActiveSheetIndex(0)->getStyle('B'.$i.':AU'.$i.'')->applyFromArray($borders_style); $this->objPHPExcel->setActiveSheetIndex(1)->setCellValue('B'.$i, (String)$row['ean']) ->setCellValue('C'.$i, (String)$row['supplier_reference']) @@ -369,24 +535,24 @@ class GenerateWp } else { $this->objPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$i, (String)$row['ean']) ->setCellValue('C'.$i, (String)$row['supplier_ref']) - ->setCellValue('D'.$i, '=IF(AND(E'.$i.'="",F'.$i.'="",G'.$i.'=""),"",E'.$i.'&" "&F'.$i.'&" - "&G'.$i.')') - ->setCellValue('E'.$i, '') + ->setCellValue('D'.$i, (String)$row['supplier_reference']) + ->setCellValue('E'.$i, '=IF(AND(F'.$i.'="",G'.$i.'="",H'.$i.'=""),"",F'.$i.'&" "&G'.$i.'&" - "&H'.$i.')') ->setCellValue('F'.$i, '') ->setCellValue('G'.$i, '') - ->setCellValue('H'.$i, $row['name_attribute_ha']) - ->setCellValue('I'.$i, '') - ->setCellValue('J'.$i, $row['name_ha']) - ->setCellValue('K'.$i, '') - ->setCellValue('L'.$i, '=LEN(D'.$i.')') - ->setCellValue('M'.$i, '') + ->setCellValue('H'.$i, '') + ->setCellValue('I'.$i, $row['name_attribute_ha']) + ->setCellValue('J'.$i, '') + ->setCellValue('K'.$i, $row['name_ha']) + ->setCellValue('L'.$i, '') + ->setCellValue('M'.$i, '=LEN(E'.$i.')') ->setCellValue('N'.$i, '') ->setCellValue('O'.$i, '') ->setCellValue('P'.$i, '') ->setCellValue('Q'.$i, '') ->setCellValue('R'.$i, '') - ->setCellValue('S'.$i, '=AO1&"-"&R'.$i.'&"-"&LEFT(C'.$i.',9)') - ->setCellValue('T'.$i, '=IF(S'.$i.'="","",LEN(S'.$i.'))') - ->setCellValue('U'.$i, '') + ->setCellValue('S'.$i, '') + ->setCellValue('T'.$i, '=AP1&"-"&S'.$i.'&"-"&LEFT(D'.$i.',9)') + ->setCellValue('U'.$i, '=IF(T'.$i.'="","",LEN(T'.$i.'))') ->setCellValue('V'.$i, '') ->setCellValue('W'.$i, '') ->setCellValue('X'.$i, '') @@ -394,25 +560,26 @@ class GenerateWp ->setCellValue('Z'.$i, '') ->setCellValue('AA'.$i, '') ->setCellValue('AB'.$i, '') - ->setCellValue('AC'.$i, $row['quantity']) - ->setCellValue('AD'.$i, '') + ->setCellValue('AC'.$i, '') + ->setCellValue('AD'.$i, $row['quantity']) ->setCellValue('AE'.$i, '') - ->setCellValue('AF'.$i, $row['ppc']) - ->setCellValue('AG'.$i, '') - ->setCellValue('AH'.$i, $row['prix_ha']) - ->setCellValue('AI'.$i, '') - ->setCellValue('AJ'.$i, '=IF(AI'.$i.'="","",IF((AH'.$i.'-AI'.$i.')>0,"ATTENTION",IF((AH'.$i.'-AI'.$i.')<0,"COOL",IF((AH'.$i.'-AI'.$i.')=0,"OK",""))))') - ->setCellValue('AK'.$i, '=IF(AH'.$i.'="","",(AH'.$i.'*1.85))') - ->setCellValue('AL'.$i, '') - ->setCellValue('AM'.$i, '=IF(AND(AF'.$i.'="",AK'.$i.'=""),"",ROUND((1-AK'.$i.'/AF'.$i.')*100,4))') - ->setCellValue('AN'.$i, '=IF(AND(AH'.$i.'="",AK'.$i.'=""),"",1-AH'.$i.'/(AK'.$i.'/1.2))') - ->setCellValue('AO'.$i, '=IF(Q'.$i.'="","",IF(Q'.$i.'=1,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg",IF(Q'.$i.'=2,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg",IF(Q'.$i.'=3,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg",IF(Q'.$i.'=4,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg",IF(Q'.$i.'='.$i.',"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg",IF(Q'.$i.'=6,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg",IF(Q'.$i.'=7,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg",IF(Q'.$i.'=8,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg",IF(Q'.$i.'=9,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg",IF(Q'.$i.'=10,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg",IF(Q'.$i.'=11,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg",IF(Q'.$i.'=12,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-11.jpg",IF(Q'.$i.'=13,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-11.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-12.jpg",IF(Q'.$i.'=14,"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-11.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-12.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-13.jpg",IF(Q'.$i.'=1'.$i.',"https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&".jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-1.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-2.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-3.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-4.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-5.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-6.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-7.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-8.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-9.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-10.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-11.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-12.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-13.jpg,https://static.bebeboutik.com/img_import/"&AO1&"/"&C'.$i.'&"-14.jpg"))))))))))))))))') - ->setCellValue('AP'.$i, '') - ->setCellValue('AQ'.$i, '=AC'.$i.'*AH'.$i) - ->setCellValue('AR'.$i, '') + ->setCellValue('AF'.$i, '') + ->setCellValue('AG'.$i, $row['ppc']) + ->setCellValue('AH'.$i, '') + ->setCellValue('AI'.$i, $row['prix_ha']) + ->setCellValue('AJ'.$i, '') + ->setCellValue('AK'.$i, '=IF(AJ'.$i.'="","",IF((AI'.$i.'-AJ'.$i.')>0,"ATTENTION",IF((AI'.$i.'-AJ'.$i.')<0,"COOL",IF((AI'.$i.'-AJ'.$i.')=0,"OK",""))))') + ->setCellValue('AL'.$i, '=IF(AI'.$i.'="","",(AI'.$i.'*1.85))') + ->setCellValue('AM'.$i, '') + ->setCellValue('AN'.$i, '=IF(AND(AG'.$i.'="",AL'.$i.'=""),"",ROUND((1-AL'.$i.'/AG'.$i.')*100,4))') + ->setCellValue('AO'.$i, '=IF(AND(AI'.$i.'="",AL'.$i.'=""),"",1-AI'.$i.'/(AL'.$i.'/1.2))') + ->setCellValue('AP'.$i, $image_line) + ->setCellValue('AQ'.$i, '') + ->setCellValue('AR'.$i, '=AD'.$i.'*AI'.$i) ->setCellValue('AS'.$i, '') - ->setCellValue('AT'.$i, ''); - $this->objPHPExcel->setActiveSheetIndex(0)->getStyle('B'.$i.':AT'.$i.'')->applyFromArray($borders_style); + ->setCellValue('AT'.$i, '') + ->setCellValue('AU'.$i, ''); + $this->objPHPExcel->setActiveSheetIndex(0)->getStyle('B'.$i.':AU'.$i.'')->applyFromArray($borders_style); $this->objPHPExcel->setActiveSheetIndex(1)->setCellValue('B'.$i, (String)$row['ean']) ->setCellValue('C'.$i, $row['supplier_ref']) @@ -430,16 +597,8 @@ class GenerateWp } $i++; } - $darker_light_blue_style = array( - 'type' => PHPExcel_Style_Fill::FILL_SOLID, - 'rotation' => 0, - 'startcolor' => array( - 'rgb' => self::$FORMAT_LIGHTER_DARK_BLUE - ), - 'endcolor' => array( - 'rgb' => self::$FORMAT_LIGHTER_DARK_BLUE - ) - ); + + $timer_table[] = 'Excel sheet data inserted after '.(microtime(true)-$callStartTime); $this->objPHPExcel->setActiveSheetIndex(0); $this->objPHPExcel->getActiveSheet() @@ -447,35 +606,31 @@ class GenerateWp ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER); $this->objPHPExcel->getActiveSheet() - ->getStyle('C5:C'.$lastLine) + ->getStyle('D5:D'.$lastLine) ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT); $this->objPHPExcel->getActiveSheet() - ->getStyle('L5:L'.$lastLine) + ->getStyle('I5:I'.$lastLine) ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER); $this->objPHPExcel->getActiveSheet() - ->getStyle('L5:L'.$lastLine) + ->getStyle('I5:I'.$lastLine) ->getAlignment() ->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $this->objPHPExcel->getActiveSheet() - ->getStyle('R5:R'.$lastLine) + ->getStyle('S5:S'.$lastLine) ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT); $this->objPHPExcel->getActiveSheet() - ->getStyle('T5:T'.$lastLine) + ->getStyle('U5:U'.$lastLine) ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER); $this->objPHPExcel->getActiveSheet() - ->getStyle('T5:T'.$lastLine) + ->getStyle('U5:U'.$lastLine) ->getAlignment() ->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $this->objPHPExcel->getActiveSheet() - ->getStyle('AB5:AB'.$lastLine) - ->getNumberFormat() - ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR); - $this->objPHPExcel->getActiveSheet() - ->getStyle('AF5:AF'.$lastLine) + ->getStyle('AC5:AC'.$lastLine) ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR); $this->objPHPExcel->getActiveSheet() @@ -483,82 +638,92 @@ class GenerateWp ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR); $this->objPHPExcel->getActiveSheet() - ->getStyle('AA5:AA' . $lastLine) - ->getFill()->applyFromArray($darker_light_blue_style); + ->getStyle('AH5:AH'.$lastLine) + ->getNumberFormat() + ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR); $this->objPHPExcel->getActiveSheet() ->getStyle('AB5:AB' . $lastLine) ->getFill()->applyFromArray($darker_light_blue_style); $this->objPHPExcel->getActiveSheet() - ->getStyle('AG5:AG' . $lastLine) + ->getStyle('AC5:AC' . $lastLine) ->getFill()->applyFromArray($darker_light_blue_style); $this->objPHPExcel->getActiveSheet() - ->getStyle('AI5:AI' . $lastLine) + ->getStyle('AH5:AH' . $lastLine) ->getFill()->applyFromArray($darker_light_blue_style); $this->objPHPExcel->getActiveSheet() ->getStyle('AJ5:AJ' . $lastLine) ->getFill()->applyFromArray($darker_light_blue_style); $this->objPHPExcel->getActiveSheet() - ->getStyle('AL5:AL' . $lastLine) + ->getStyle('AK5:AK' . $lastLine) ->getFill()->applyFromArray($darker_light_blue_style); $this->objPHPExcel->getActiveSheet() - ->getStyle('AA5:AA' . $lastLine) - ->getFont()->setBold(true); + ->getStyle('AM5:AM' . $lastLine) + ->getFill()->applyFromArray($darker_light_blue_style); $this->objPHPExcel->getActiveSheet() ->getStyle('AB5:AB' . $lastLine) ->getFont()->setBold(true); $this->objPHPExcel->getActiveSheet() - ->getStyle('AG5:AG' . $lastLine) + ->getStyle('AC5:AC' . $lastLine) ->getFont()->setBold(true); $this->objPHPExcel->getActiveSheet() - ->getStyle('AI5:AI' . $lastLine) + ->getStyle('AH5:AH' . $lastLine) ->getFont()->setBold(true); $this->objPHPExcel->getActiveSheet() ->getStyle('AJ5:AJ' . $lastLine) ->getFont()->setBold(true); $this->objPHPExcel->getActiveSheet() - ->getStyle('AL5:AL' . $lastLine) + ->getStyle('AK5:AK' . $lastLine) + ->getFont()->setBold(true); + $this->objPHPExcel->getActiveSheet() + ->getStyle('AM5:AM' . $lastLine) ->getFont()->setBold(true); //Conditionnal formating for column L $nb_max_char = 64; $objConditional1 = new PHPExcel_Style_Conditional(); $objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_EXPRESSION) - ->addCondition('L5>'.$nb_max_char); + ->addCondition('M5>'.$nb_max_char); $objConditional1->getStyle()->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getEndColor()->setARGB(self::$FORMAT_BG_LIGHT_RED); + $objConditional1->getStyle()->getFont()->setColor(new PHPExcel_Style_Color(self::$FORMAT_BG_DARK_RED)); $objConditional2 = new PHPExcel_Style_Conditional(); $objConditional2->setConditionType(PHPExcel_Style_Conditional::CONDITION_EXPRESSION) - ->addCondition('L5='.$nb_max_char); + ->addCondition('M5='.$nb_max_char); $objConditional2->getStyle()->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getEndColor()->setARGB(self::$FORMAT_BG_LIGHT_YELLOW); + $objConditional2->getStyle()->getFont()->setColor(new PHPExcel_Style_Color(self::$FORMAT_BG_DARK_YELLOW)); $objConditional3 = new PHPExcel_Style_Conditional(); $objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_EXPRESSION) - ->addCondition('L5<'.$nb_max_char); + ->addCondition('M5<'.$nb_max_char); $objConditional3->getStyle()->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getEndColor()->setARGB(self::$FORMAT_BG_LIGHT_GREEN); + $objConditional3->getStyle()->getFont()->setColor(new PHPExcel_Style_Color(self::$FORMAT_BG_DARK_GREEN)); - $conditionalStyles = $this->objPHPExcel->getActiveSheet()->getStyle('L5:L'.$lastLine)->getConditionalStyles(); + $conditionalStyles = $this->objPHPExcel->getActiveSheet()->getStyle('M5:M'.$lastLine)->getConditionalStyles(); $conditionalStyles[] = $objConditional1; $conditionalStyles[] = $objConditional2; $conditionalStyles[] = $objConditional3; - $this->objPHPExcel->getActiveSheet()->getStyle('L5:L'.$lastLine)->setConditionalStyles($conditionalStyles); + $this->objPHPExcel->getActiveSheet()->getStyle('M5:M'.$lastLine)->setConditionalStyles($conditionalStyles); $nb_max_char = 17; //Conditionnal formating for column T $objConditional1 = new PHPExcel_Style_Conditional(); $objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_EXPRESSION) - ->addCondition('T5>'.$nb_max_char); + ->addCondition('U5>'.$nb_max_char); $objConditional1->getStyle()->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getEndColor()->setARGB(self::$FORMAT_BG_LIGHT_RED); + $objConditional1->getStyle()->getFont()->setColor(new PHPExcel_Style_Color(self::$FORMAT_BG_DARK_RED)); $objConditional2 = new PHPExcel_Style_Conditional(); $objConditional2->setConditionType(PHPExcel_Style_Conditional::CONDITION_EXPRESSION) - ->addCondition('T5='.$nb_max_char); + ->addCondition('U5='.$nb_max_char); $objConditional2->getStyle()->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getEndColor()->setARGB(self::$FORMAT_BG_LIGHT_YELLOW); + $objConditional2->getStyle()->getFont()->setColor(new PHPExcel_Style_Color(self::$FORMAT_BG_DARK_YELLOW)); $objConditional3 = new PHPExcel_Style_Conditional(); $objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_EXPRESSION) - ->addCondition('T5<'.$nb_max_char); + ->addCondition('U5<'.$nb_max_char); $objConditional3->getStyle()->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getEndColor()->setARGB(self::$FORMAT_BG_LIGHT_GREEN); + $objConditional3->getStyle()->getFont()->setColor(new PHPExcel_Style_Color(self::$FORMAT_BG_DARK_GREEN)); - $conditionalStyles = $this->objPHPExcel->getActiveSheet()->getStyle('T5:T'.$lastLine)->getConditionalStyles(); + $conditionalStyles = $this->objPHPExcel->getActiveSheet()->getStyle('U5:U'.$lastLine)->getConditionalStyles(); $conditionalStyles[] = $objConditional1; $conditionalStyles[] = $objConditional2; $conditionalStyles[] = $objConditional3; - $this->objPHPExcel->getActiveSheet()->getStyle('T5:T'.$lastLine)->setConditionalStyles($conditionalStyles); + $this->objPHPExcel->getActiveSheet()->getStyle('U5:U'.$lastLine)->setConditionalStyles($conditionalStyles); //Conditionnal formating for column AJ $objConditional1 = new PHPExcel_Style_Conditional(); @@ -572,21 +737,17 @@ class GenerateWp ->setText('COOL'); $objConditional2->getStyle()->getFont()->setColor(new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_GREEN)); - $conditionalStyles = $this->objPHPExcel->getActiveSheet()->getStyle('AJ5:AJ'.$lastLine)->getConditionalStyles(); + $conditionalStyles = $this->objPHPExcel->getActiveSheet()->getStyle('AK5:AK'.$lastLine)->getConditionalStyles(); $conditionalStyles[] = $objConditional1; $conditionalStyles[] = $objConditional2; - $this->objPHPExcel->getActiveSheet()->getStyle('AJ5:AJ'.$lastLine)->setConditionalStyles($conditionalStyles); + $this->objPHPExcel->getActiveSheet()->getStyle('AK5:AK'.$lastLine)->setConditionalStyles($conditionalStyles); - $this->objPHPExcel->getActiveSheet() - ->getStyle('AH5:AH'.$lastLine) - ->getNumberFormat() - ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR); $this->objPHPExcel->getActiveSheet() ->getStyle('AI5:AI'.$lastLine) ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR); $this->objPHPExcel->getActiveSheet() - ->getStyle('AK5:AK'.$lastLine) + ->getStyle('AJ5:AJ'.$lastLine) ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR); $this->objPHPExcel->getActiveSheet() @@ -596,21 +757,25 @@ class GenerateWp $this->objPHPExcel->getActiveSheet() ->getStyle('AM5:AM'.$lastLine) ->getNumberFormat() - ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER); + ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR); $this->objPHPExcel->getActiveSheet() ->getStyle('AN5:AN'.$lastLine) ->getNumberFormat() + ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00); + $this->objPHPExcel->getActiveSheet() + ->getStyle('AO5:AO'.$lastLine) + ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00); $this->objPHPExcel->getActiveSheet() - ->getStyle('AQ5:AQ'.$lastLine) + ->getStyle('AR5:AR'.$lastLine) ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR); $this->objPHPExcel->getActiveSheet() - ->getStyle('AQ5:AQ'.$lastLine) + ->getStyle('AR5:AR'.$lastLine) ->getAlignment() ->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $this->objPHPExcel->getActiveSheet() - ->getStyle('AT5:AT'.$lastLine) + ->getStyle('AU5:AU'.$lastLine) ->getNumberFormat() ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY); @@ -621,5 +786,6 @@ class GenerateWp ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER); $this->objPHPExcel->setActiveSheetIndex(0); $this->objWriter = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'Excel2007'); + $timer_table[] = 'Excel sheet process done after '.(microtime(true)-$callStartTime); } } \ No newline at end of file