fix conflict
This commit is contained in:
commit
849edcdb12
@ -411,7 +411,7 @@ class Sale {
|
||||
return $orders;
|
||||
}
|
||||
|
||||
public function getMultiForStats($orders = array(), $nb_sale)
|
||||
public function getMultiForStats($orders = array(), $nb_sale, $strict = false)
|
||||
{
|
||||
$products = $this->getProducts();
|
||||
|
||||
@ -438,8 +438,14 @@ class Sale {
|
||||
|
||||
$multi = array();
|
||||
foreach ($_orders as $key => $order) {
|
||||
if(count($order) >= (int)$nb_sale) {
|
||||
$multi[] = $key;
|
||||
if($strict) {
|
||||
if(count($order) == (int)$nb_sale) {
|
||||
$multi[] = $key;
|
||||
}
|
||||
} else {
|
||||
if(count($order) >= (int)$nb_sale) {
|
||||
$multi[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $multi;
|
||||
|
@ -98,7 +98,7 @@ class AdminPrivateSalesLogistique extends AdminTab {
|
||||
|
||||
var type = $("#export_form input[name=export_type]:checked").val();
|
||||
|
||||
if(type == 1 || type == 2) {
|
||||
if(type == 1 || type == 2 || type == 4) {
|
||||
req += "&type="+type;
|
||||
req += "&lang="+$("input[name=lang]:checked").val();
|
||||
|
||||
@ -467,7 +467,8 @@ class AdminPrivateSalesLogistique extends AdminTab {
|
||||
<input type="radio" name="export_type" value="2"> '.$this->l('Etat de la vente').'
|
||||
<br />
|
||||
<input type="radio" name="export_type" value="3"> '.$this->l('Stats de la vente').'
|
||||
|
||||
<br />
|
||||
<input type="radio" name="export_type" value="4"> '.$this->l('BDC Logistique').'
|
||||
|
||||
<h4>'.$this->l('Selection de la langue').'</h4>
|
||||
<input type="radio" name="lang" value="fr" checked> '.$this->l('Français').'
|
||||
|
@ -5,7 +5,7 @@ class MakeStats {
|
||||
{
|
||||
global $cookie;
|
||||
$category = new Category($id_cat);
|
||||
$products = $category->getProductsStats( $cookie->id_lang , "1", "1000000000000000000", "reference",NULL , NULL, FALSE , FALSE );
|
||||
$products = $category->getProductsStats( $cookie->id_lang , "1", "1000000000000000000", "reference",NULL , FALSE, FALSE , FALSE );
|
||||
|
||||
return $products;
|
||||
}
|
||||
@ -83,10 +83,37 @@ class MakeStats {
|
||||
return $records;
|
||||
}
|
||||
|
||||
public static function getArrayLines($lines, $by_product_price = false)
|
||||
public static function getArrayLines($lines, $by_product_price = false, $id_sale = 0)
|
||||
{
|
||||
$arrayTmp = array();
|
||||
$g = 0;
|
||||
|
||||
if ($id_sale>2) {
|
||||
|
||||
$sale = new Sale((int) $id_sale);
|
||||
$id_products = $sale->getProducts();
|
||||
$ids = Db::getInstance()->ExecuteS('
|
||||
SELECT DISTINCT d.`id_order`, CAST(o.`date_add` as DATE) as `date_add`
|
||||
FROM `'._DB_PREFIX_.'order_detail` d
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o
|
||||
ON d.`id_order` = o.`id_order`
|
||||
WHERE d.`product_id` IN ('.implode(',', $id_products).'
|
||||
-- SELECT `id_product`
|
||||
-- FROM `'._DB_PREFIX_.'product_ps_cache`
|
||||
-- WHERE `id_sale` = '.(int) $id_sale.'
|
||||
)
|
||||
AND o.`valid` = 1
|
||||
');
|
||||
|
||||
$ids_od = array();
|
||||
foreach ($ids as $key => $id) {
|
||||
$ids_od[] = (int)$id['id_order'];
|
||||
}
|
||||
$all_multi = $sale->getMultiForStats($ids_od, 3);
|
||||
$all_m1 = $sale->getMultiForStats($ids_od, 1, true);
|
||||
$all_m2 = $sale->getMultiForStats($ids_od, 2, true);
|
||||
}
|
||||
|
||||
foreach($lines as $line)
|
||||
{
|
||||
|
||||
@ -96,20 +123,20 @@ class MakeStats {
|
||||
if(!isset($arrayTmp[$line['product_id']]))
|
||||
$arrayTmp[$line['product_id']] = array();
|
||||
|
||||
$product_price = MakeStats::getProductPriceWithReduction($line);
|
||||
if($by_product_price)
|
||||
{
|
||||
if(!isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]))
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']] = array();
|
||||
$product_price = MakeStats::getProductPriceWithReduction($line);
|
||||
if($by_product_price)
|
||||
{
|
||||
if(!isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]))
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']] = array();
|
||||
|
||||
if(!isset($arrayTmp[$line['product_id']][$line['product_attribute_id']][$product_price]))
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']][$product_price] = array('line' => $line, 'total' => 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]))
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']] = array('line' => $line, 'total' => 0);
|
||||
}
|
||||
if(!isset($arrayTmp[$line['product_id']][$line['product_attribute_id']][$product_price]))
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']][$product_price] = array('line' => $line, 'total' => 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]))
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']] = array('line' => $line, 'total' => 0);
|
||||
}
|
||||
|
||||
if (isset($line['product_quantity'])) {
|
||||
$quantity = $line['product_quantity'] - $line['product_quantity_reinjected'];
|
||||
@ -118,15 +145,40 @@ class MakeStats {
|
||||
}
|
||||
$stock = (isset($line['attribute_quantity']))?$line['attribute_quantity']:$line['stock'];
|
||||
|
||||
if($by_product_price) {
|
||||
if($by_product_price) {
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']][$product_price]['total'] += $quantity;
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']][$product_price]['stock'] = $stock;
|
||||
} else {
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']][$product_price]['stock'] = $stock;
|
||||
} else {
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['total'] += $quantity;
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['stock'] = $stock;
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['stock'] = $stock;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($id_sale>2) {
|
||||
// multi (order contenant au moins 3 ventes differentes)
|
||||
if(!isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]['multi']) && in_array($line['id_order'], $all_multi)) {
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['multi'] = $quantity;
|
||||
} elseif (isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]) && in_array($line['id_order'], $all_multi)) {
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['multi'] += $quantity;
|
||||
}
|
||||
|
||||
// multi 1 (order contenant uniquement 1 vente)
|
||||
if(!isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]['m1']) && in_array($line['id_order'], $all_m1)) {
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['m1'] = $quantity;
|
||||
} elseif (isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]['m1']) && in_array($line['id_order'], $all_m1)) {
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['m1'] += $quantity;
|
||||
}
|
||||
|
||||
// multi 2 (order contenant uniquement 2 ventes)
|
||||
if(!isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]['m2']) && in_array($line['id_order'], $all_m2)) {
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['m2'] = $quantity;
|
||||
} elseif (isset($arrayTmp[$line['product_id']][$line['product_attribute_id']]['m2']) && in_array($line['id_order'], $all_m2)) {
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['m2'] += $quantity;
|
||||
}
|
||||
|
||||
// multi 1 + multi 2 (produit dans order contenant uniquement 1 vente et order contenant 2 ventes)
|
||||
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['m1_m2'] = $arrayTmp[$line['product_id']][$line['product_attribute_id']]['m1'] + $arrayTmp[$line['product_id']][$line['product_attribute_id']]['m2'];
|
||||
}
|
||||
}
|
||||
return $lines = $arrayTmp;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
1, //1 : bon de commande
|
||||
2, //2 : état des ventes
|
||||
3, //3 : stats des ventes
|
||||
4, //4 : BDC logistique
|
||||
);
|
||||
|
||||
$lang_id = Tools::getValue('lang', 'fr');
|
||||
@ -41,7 +42,8 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
'Remaining quantity' => 'Remaining quantities',
|
||||
'Unit Price' => 'Unit Price',
|
||||
'Total Amount' => 'Total Amount',
|
||||
'Purchase order' => 'Purchase order',
|
||||
'Purchase order' => 'Purchase order',
|
||||
'Purchase order logistic' => 'Purchase order logistic',
|
||||
'State order' => 'Sales report',
|
||||
|
||||
'The number below must be present on each document regarding this order, delivery note, invoice :' => 'The number below must be present on each document regarding this order, delivery note, invoice :',
|
||||
@ -62,7 +64,8 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
'Remaining quantity' => 'Stock restant',
|
||||
'Unit Price' => 'PU HT',
|
||||
'Total Amount' => 'Prix Total HT',
|
||||
'Purchase order' => 'Bon de commande',
|
||||
'Purchase order' => 'Bon de commande',
|
||||
'Purchase order logistic' => 'Bon de commande logistique',
|
||||
'State order' => 'Etat des ventes',
|
||||
'YES' => 'OUI',
|
||||
|
||||
@ -129,15 +132,13 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
$date_to_sql = $date_to;
|
||||
|
||||
$sale = Sale::getSaleFromCategory($id_category);
|
||||
|
||||
$category = new Category($id_category, $cookie->id_lang);
|
||||
$products = MakeStats::getProductsByCat($id_category);
|
||||
|
||||
|
||||
$lines = array();
|
||||
$array_product = array();
|
||||
|
||||
if($type == 1 || $type == 2 || $type == 3) {
|
||||
if($type == 1 || $type == 2 || $type == 3 || $type == 4) {
|
||||
$arrayProduct = array();
|
||||
foreach($products as $product)
|
||||
$array_product[$product['id_product']] = $arrayProduct[$product['id_product']] = new Product($product['id_product']);
|
||||
@ -147,14 +148,18 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
$lines = MakeStats::getOrdersByIdsProduct(array_keys($arrayProduct), $order_states, $date_from->getDate('SQL'), $date_to->getDate('SQL'));
|
||||
|
||||
// adding - fev 2016
|
||||
if ($type == 2) {
|
||||
if ($type == 2 || $type == 4) {
|
||||
$lines = MakeStats::getDetailsByIdsProduct(array_keys($arrayProduct), $order_states, $date_from->getDate('SQL'), $date_to->getDate('SQL'));
|
||||
}
|
||||
// end adding
|
||||
|
||||
// for stats
|
||||
$lines_tmp = $lines;
|
||||
$lines = MakeStats::getArrayLines($lines);
|
||||
if ($type == 4) {
|
||||
$lines = MakeStats::getArrayLines($lines, false, $sale->id);
|
||||
} else {
|
||||
$lines = MakeStats::getArrayLines($lines);
|
||||
}
|
||||
} else {
|
||||
die("Type d'export invalide");
|
||||
}
|
||||
@ -236,13 +241,10 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
{
|
||||
foreach($arrayProduct as $id_product_attribute => $values)
|
||||
{
|
||||
//echo "<pre>";var_dump($values);echo "</pre>";
|
||||
$arrayTmp[$values['line']['product_id']][$values['line']['product_attribute_id']] = $values;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// associate position
|
||||
$arrayTmp2 = array();
|
||||
@ -255,7 +257,6 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
|
||||
// ksort($lines2);
|
||||
|
||||
|
||||
$have_declinaison = false;
|
||||
foreach($lines2 as $lines_attributes)
|
||||
{
|
||||
@ -277,6 +278,9 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
$extrafields = Category::getSalesInfos(array((int)$category->id_category));
|
||||
$title = $lang['State order'] .' '. $category->name . ' - ' . $extrafields[(int)$category->id_category]['sales'][1];
|
||||
break;
|
||||
case '4':
|
||||
$title = $lang['Purchase order logistic'].' '. $category->name .' - Bébé Boutik '. $date_from->getNomMois() .' '.$date_from->getAnnee();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -284,69 +288,107 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
$firstColumn = 'A';
|
||||
if($have_declinaison === true)
|
||||
{
|
||||
if ($type == 1) {
|
||||
$lastColumn = 'H';
|
||||
if ($type == 4) {
|
||||
$lastColumn = 'K';
|
||||
|
||||
$letter_product_ref_interne = 'B';
|
||||
$letter_product_name = 'C';
|
||||
$letter_product_attribute_name = 'D';
|
||||
$letter_product_ht = 'E';
|
||||
$letter_product_M1_M2 = 'F';
|
||||
$letter_product_multi = 'G';
|
||||
|
||||
$letter_product_colisage = 'H';
|
||||
$letter_product_stock3btk = 'I';
|
||||
$letter_product_missing = 'J';
|
||||
|
||||
$letter_product_total_qty= 'K';
|
||||
|
||||
} else {
|
||||
$lastColumn = 'J';
|
||||
}
|
||||
|
||||
$letter_bdc_title = 'C';
|
||||
$letter_end_address = 'B';
|
||||
if ($type == 1) {
|
||||
$lastColumn = 'H';
|
||||
} else {
|
||||
$lastColumn = 'J';
|
||||
}
|
||||
|
||||
$letter_date = 'C';
|
||||
$letter_franco = 'D';
|
||||
$letter_condition = 'E';
|
||||
$letter_bdc_title = 'C';
|
||||
$letter_end_address = 'B';
|
||||
|
||||
$letter_product_ean = 'B';
|
||||
$letter_product_ref_interne = 'C';
|
||||
$letter_product_name = 'D';
|
||||
$letter_product_attribute_name = 'E';
|
||||
/*$letter_product_qty = 'F';*/
|
||||
$letter_date = 'C';
|
||||
$letter_franco = 'D';
|
||||
$letter_condition = 'E';
|
||||
|
||||
if ($type == 1) {
|
||||
$letter_product_qty = 'F';
|
||||
$letter_product_ht = 'G';
|
||||
$letter_product_total = 'H';
|
||||
} else {
|
||||
$letter_product_total_qty = 'F';
|
||||
$letter_product_qty = 'G';
|
||||
$letter_product_remaining_qty = 'H';
|
||||
$letter_product_ht = 'I';
|
||||
$letter_product_total = 'J';
|
||||
$letter_product_ean = 'B';
|
||||
$letter_product_ref_interne = 'C';
|
||||
$letter_product_name = 'D';
|
||||
$letter_product_attribute_name = 'E';
|
||||
/*$letter_product_qty = 'F';*/
|
||||
|
||||
if ($type == 1) {
|
||||
$letter_product_qty = 'F';
|
||||
$letter_product_ht = 'G';
|
||||
$letter_product_total = 'H';
|
||||
} else {
|
||||
$letter_product_total_qty = 'F';
|
||||
$letter_product_qty = 'G';
|
||||
$letter_product_remaining_qty = 'H';
|
||||
$letter_product_ht = 'I';
|
||||
$letter_product_total = 'J';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type == 1) {
|
||||
$lastColumn = 'G';
|
||||
if ($type == 4) {
|
||||
$lastColumn = 'J';
|
||||
|
||||
$letter_product_ref_interne = 'B';
|
||||
$letter_product_name = 'C';
|
||||
//$letter_product_attribute_name = 'D';
|
||||
$letter_product_ht = 'D';
|
||||
$letter_product_M1_M2 = 'E';
|
||||
$letter_product_multi = 'F';
|
||||
|
||||
$letter_product_colisage = 'G';
|
||||
$letter_product_stock3btk = 'H';
|
||||
$letter_product_missing = 'I';
|
||||
|
||||
$letter_product_total_qty= 'J';
|
||||
|
||||
} else {
|
||||
$lastColumn = 'I';
|
||||
}
|
||||
|
||||
$letter_bdc_title = 'C';
|
||||
$letter_end_address = 'B';
|
||||
|
||||
$letter_date = 'C';
|
||||
$letter_franco = 'D';
|
||||
$letter_condition = 'E';
|
||||
if ($type == 1) {
|
||||
$lastColumn = 'G';
|
||||
} else {
|
||||
$lastColumn = 'I';
|
||||
}
|
||||
|
||||
$letter_bdc_title = 'C';
|
||||
$letter_end_address = 'B';
|
||||
|
||||
$letter_date = 'C';
|
||||
$letter_franco = 'D';
|
||||
$letter_condition = 'E';
|
||||
|
||||
|
||||
$letter_product_ean = 'B';
|
||||
$letter_product_ref_interne = 'C';
|
||||
$letter_product_name = 'D';
|
||||
// $letter_product_attribute_name = 'C';
|
||||
/* $letter_product_qty = 'E';*/
|
||||
$letter_product_ean = 'B';
|
||||
$letter_product_ref_interne = 'C';
|
||||
$letter_product_name = 'D';
|
||||
// $letter_product_attribute_name = 'C';
|
||||
/* $letter_product_qty = 'E';*/
|
||||
|
||||
if ($type == 1) {
|
||||
$letter_product_qty = 'E';
|
||||
$letter_product_ht = 'F';
|
||||
$letter_product_total = 'G';
|
||||
} else {
|
||||
$letter_product_total_qty = 'E';
|
||||
$letter_product_qty = 'F';
|
||||
$letter_product_remaining_qty = 'G';
|
||||
$letter_product_ht = 'H';
|
||||
$letter_product_total = 'I';
|
||||
if ($type == 1) {
|
||||
$letter_product_qty = 'E';
|
||||
$letter_product_ht = 'F';
|
||||
$letter_product_total = 'G';
|
||||
} else {
|
||||
$letter_product_total_qty = 'E';
|
||||
$letter_product_qty = 'F';
|
||||
$letter_product_remaining_qty = 'G';
|
||||
$letter_product_ht = 'H';
|
||||
$letter_product_total = 'I';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -623,61 +665,105 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
|
||||
$i ++;
|
||||
}
|
||||
|
||||
if ($type == 2) {
|
||||
$activeSheet->SetCellValue($firstColumn.$i, $date_of_extract->getJour().' '.$date_of_extract->getNomMois().' '.$date_of_extract->getAnnee());
|
||||
if ($type == 4) {
|
||||
$activeSheet->SetCellValue($firstColumn.$i, $title);
|
||||
$i++;$i++;
|
||||
}
|
||||
|
||||
$activeSheet->SetCellValue($firstColumn.$i, $lang['Product ID']);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_ean.$i, $lang['EAN']);
|
||||
$activeSheet->getStyle($letter_product_ean.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
$activeSheet->SetCellValue($letter_product_ref_interne.$i, $lang['Reference BB']);
|
||||
$activeSheet->getStyle($letter_product_ref_interne.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
//$activeSheet->getStyle('E'.$i)->getBorders()->setBold(true);
|
||||
$activeSheet->SetCellValue($letter_product_ref_interne.$i, $lang['Reference BB']);
|
||||
$activeSheet->getStyle($letter_product_ref_interne.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_name.$i, $lang['Product Name']);
|
||||
$activeSheet->getStyle($letter_product_name.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
if($have_declinaison === true) {
|
||||
$activeSheet->SetCellValue($letter_product_attribute_name.$i, $lang['Attribute']);
|
||||
$activeSheet->getStyle($letter_product_attribute_name.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
}
|
||||
$activeSheet->SetCellValue($letter_product_name.$i, $lang['Product Name']);
|
||||
$activeSheet->getStyle($letter_product_name.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
if($have_declinaison === true) {
|
||||
$activeSheet->SetCellValue($letter_product_attribute_name.$i, $lang['Attribute']);
|
||||
$activeSheet->getStyle($letter_product_attribute_name.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
}
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_qty.$i, $lang['Quantity']);
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getAlignment()->setWrapText(true);
|
||||
if ($type == 2) {
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getFill()->applyFromArray(
|
||||
array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'rotation' => 0,
|
||||
'startcolor' => array(
|
||||
'rgb' => 'D9D9D9'
|
||||
),
|
||||
'endcolor' => array(
|
||||
'argb' => 'D9D9D9D9'
|
||||
)
|
||||
)
|
||||
);
|
||||
$activeSheet->SetCellValue($letter_product_total_qty.$i, $lang['Total quantity']);
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, $lang['Unit Price']);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_M1_M2.$i, 'M1+M2');
|
||||
$activeSheet->getStyle($letter_product_M1_M2.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_M1_M2.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_multi.$i, 'Multi');
|
||||
$activeSheet->getStyle($letter_product_multi.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_multi.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_colisage.$i, 'Colisage/ferme');
|
||||
$activeSheet->getStyle($letter_product_colisage.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_colisage.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_stock3btk.$i, 'Stock 3BTK');
|
||||
$activeSheet->getStyle($letter_product_stock3btk.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_stock3btk.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_missing.$i, 'Manquant');
|
||||
$activeSheet->getStyle($letter_product_missing.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_missing.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total_qty.$i, 'Total qty');
|
||||
$activeSheet->getStyle($letter_product_total_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_total_qty.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_remaining_qty.$i, $lang['Remaining quantity']);
|
||||
$activeSheet->getStyle($letter_product_remaining_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_remaining_qty.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
} else {
|
||||
|
||||
if ($type == 2) {
|
||||
$activeSheet->SetCellValue($firstColumn.$i, $date_of_extract->getJour().' '.$date_of_extract->getNomMois().' '.$date_of_extract->getAnnee());
|
||||
$i++;$i++;
|
||||
}
|
||||
|
||||
$activeSheet->SetCellValue($firstColumn.$i, $lang['Product ID']);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_ean.$i, $lang['EAN']);
|
||||
$activeSheet->getStyle($letter_product_ean.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
$activeSheet->SetCellValue($letter_product_ref_interne.$i, $lang['Reference BB']);
|
||||
$activeSheet->getStyle($letter_product_ref_interne.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
//$activeSheet->getStyle('E'.$i)->getBorders()->setBold(true);
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_name.$i, $lang['Product Name']);
|
||||
$activeSheet->getStyle($letter_product_name.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
if($have_declinaison === true) {
|
||||
$activeSheet->SetCellValue($letter_product_attribute_name.$i, $lang['Attribute']);
|
||||
$activeSheet->getStyle($letter_product_attribute_name.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
}
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_qty.$i, $lang['Quantity']);
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getAlignment()->setWrapText(true);
|
||||
if ($type == 2) {
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getFill()->applyFromArray(
|
||||
array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'rotation' => 0,
|
||||
'startcolor' => array(
|
||||
'rgb' => 'D9D9D9'
|
||||
),
|
||||
'endcolor' => array(
|
||||
'argb' => 'D9D9D9D9'
|
||||
)
|
||||
)
|
||||
);
|
||||
$activeSheet->SetCellValue($letter_product_total_qty.$i, $lang['Total quantity']);
|
||||
$activeSheet->getStyle($letter_product_total_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_total_qty.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_remaining_qty.$i, $lang['Remaining quantity']);
|
||||
$activeSheet->getStyle($letter_product_remaining_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_remaining_qty.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
}
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, $lang['Unit Price']);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total.$i, $lang['Total Amount']);
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
}
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, $lang['Unit Price']);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total.$i, $lang['Total Amount']);
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
||||
|
||||
$i++;
|
||||
$iOri = $i;
|
||||
@ -691,6 +777,56 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case '4':
|
||||
foreach($lines2 as $lines_attributes)
|
||||
{
|
||||
foreach($lines_attributes as $values)
|
||||
{
|
||||
|
||||
$id_product_attribute = $values['line']['product_attribute_id'];
|
||||
$id_product = $values['line']['product_id'];
|
||||
$current_product = $array_product[$id_product];
|
||||
if($id_product_attribute != 0)
|
||||
{
|
||||
$combination = new Combination($id_product_attribute);
|
||||
if($combination->wholesale_price == 0)
|
||||
$wholesale_price = $current_product->wholesale_price;
|
||||
else
|
||||
$wholesale_price = $combination->wholesale_price;
|
||||
}
|
||||
else
|
||||
{
|
||||
$wholesale_price = $current_product->wholesale_price;
|
||||
}
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_ref_interne.$i, $values['line']['product_reference']);
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_name.$i, $values['line']['product_name_base']);
|
||||
if($have_declinaison === true)
|
||||
$activeSheet->SetCellValue($letter_product_attribute_name.$i, $values['line']['product_attribute_name_base']);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, (float)$wholesale_price );
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR );
|
||||
|
||||
if (isset($values['multi'])) {
|
||||
$activeSheet->setCellValue($letter_product_multi.$i, $values['multi']);
|
||||
}
|
||||
if (isset($values['m1_m2'])) {
|
||||
$activeSheet->setCellValue($letter_product_M1_M2.$i, $values['m1_m2']);
|
||||
}
|
||||
|
||||
// colonnes vide
|
||||
// $activeSheet->setCellValue($letter_product_colisage.$i, '');
|
||||
// $activeSheet->setCellValue($letter_product_stock3btk.$i, '');
|
||||
// $activeSheet->setCellValue($letter_product_missing.$i, '');
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total_qty.$i, '='.$letter_product_M1_M2.$i.'+'.$letter_product_multi.$i.'+'.$letter_product_colisage.$i.'-'.$letter_product_stock3btk.$i.'-'.$letter_product_missing.$i);
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR );
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
foreach($lines2 as $lines_attributes)
|
||||
{
|
||||
@ -807,126 +943,149 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
|
||||
break;
|
||||
}
|
||||
|
||||
$activeSheet->SetCellValue($firstColumn.$i, 'Total');
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getFont()->setBold(true);
|
||||
if ($type = 4) {
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_qty.$i, '=SUM('.$letter_product_qty.($iOri).':'.$letter_product_qty.($i-1).')');
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getFont()->setBold(true);
|
||||
if ($type == 2) {
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getFill()->applyFromArray(
|
||||
array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'rotation' => 0,
|
||||
'startcolor' => array(
|
||||
'rgb' => 'D9D9D9'
|
||||
),
|
||||
'endcolor' => array(
|
||||
'argb' => 'D9D9D9D9'
|
||||
)
|
||||
)
|
||||
);
|
||||
$activeSheet->SetCellValue($letter_product_total_qty.$i, '=SUM('.$letter_product_total_qty.($iOri).':'.$letter_product_total_qty.($i-1).')');
|
||||
$activeSheet->getStyle($letter_product_total_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_total_qty.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_remaining_qty.$i, '=SUM('.$letter_product_remaining_qty.($iOri).':'.$letter_product_remaining_qty.($i-1).')');
|
||||
$activeSheet->getStyle($letter_product_remaining_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_remaining_qty.$i)->getFont()->setBold(true);
|
||||
}
|
||||
|
||||
$activeSheet->getStyle($firstColumn.($iOri-1).':'.$lastColumn.$i)->applyFromArray($arrayBorder);
|
||||
|
||||
$i++;
|
||||
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, $lang['Total Amount']);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
||||
if($type == 1)
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total.$i, '=SUM('.$letter_product_total.($iOri).':'.$letter_product_total.($i-2).')');
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR );
|
||||
|
||||
if($lang_id != 'en')
|
||||
{
|
||||
$i++;
|
||||
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, 'TVA '.$TVA);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
||||
if($type == 1)
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total.$i, '='.$letter_product_total.($i-1).'*'.($TVA/100) );
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR );
|
||||
|
||||
$i++;
|
||||
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, 'TOTAL TTC');
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total.$i, '='.$letter_product_total.($i-1).'+'.$letter_product_total.($i-2) );
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR );
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->getStyle($letter_product_ht.($i-3).':'.$lastColumn.$i)->applyFromArray($arrayBorder);
|
||||
}
|
||||
else
|
||||
{
|
||||
$activeSheet->getStyle($letter_product_ht.($i-1).':'.$lastColumn.$i)->applyFromArray($arrayBorder);
|
||||
}
|
||||
if($type == 1)
|
||||
{
|
||||
$value = Configuration::get('PS_IT_OF_BAS_PAGE_'.$lang_id);
|
||||
if($value != '')
|
||||
{
|
||||
$i++;
|
||||
$value = str_replace('<br />', ' ' , nl2br($value));
|
||||
|
||||
$activeSheet->setCellValue($firstColumn.$i, $value);
|
||||
$activeSheet->mergeCells($firstColumn.$i.':'.$lastColumn.$i );
|
||||
$activeSheet->getRowDimension($i)->setRowHeight(80);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_TEXT );
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setWrapText(true);
|
||||
}
|
||||
|
||||
$value = Configuration::get('PS_IT_OF_BAS_PAGE_BIS_'.$lang_id);
|
||||
if($value != '')
|
||||
{
|
||||
$i++;
|
||||
$value = str_replace('<br />', ' ' , nl2br($value));
|
||||
|
||||
$activeSheet->setCellValue($firstColumn.$i, $value);
|
||||
$activeSheet->mergeCells($firstColumn.$i.':'.$lastColumn.$i );
|
||||
$activeSheet->getRowDimension($i)->setRowHeight(80);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setWrapText(true);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getFont()->getColor()->setRGB('FF0000');
|
||||
$activeSheet->getStyle($firstColumn.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_TEXT );
|
||||
}
|
||||
}
|
||||
|
||||
$activeSheet->getColumnDimension($firstColumn)->setWidth(25);
|
||||
$activeSheet->getColumnDimension($letter_product_ean)->setWidth(25);
|
||||
$activeSheet->getColumnDimension($letter_product_ref_interne)->setWidth(25);
|
||||
$activeSheet->getColumnDimension($letter_product_qty)->setWidth(18);
|
||||
$activeSheet->getColumnDimension($letter_product_name)->setWidth(40);
|
||||
if($have_declinaison === true)
|
||||
$activeSheet->getColumnDimension($letter_product_attribute_name)->setWidth(20);
|
||||
|
||||
$activeSheet->getColumnDimension($letter_product_qty)->setWidth(13);
|
||||
if ($type == 2) {
|
||||
$activeSheet->getColumnDimension($firstColumn)->setWidth(10);
|
||||
$activeSheet->getColumnDimension($letter_product_ref_interne)->setWidth(25);
|
||||
$activeSheet->getColumnDimension($letter_product_name)->setWidth(40);
|
||||
if ($have_declinaison === true) {
|
||||
$activeSheet->getColumnDimension($letter_product_attribute_name)->setWidth(20);
|
||||
}
|
||||
$activeSheet->getColumnDimension($letter_product_ht)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_multi)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_M1_M2)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_colisage)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_stock3btk)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_missing)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_total_qty)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_remaining_qty)->setWidth(13);
|
||||
|
||||
$i++;
|
||||
|
||||
$activeSheet->setCellValue($firstColumn.$i, '');
|
||||
|
||||
} else {
|
||||
|
||||
$activeSheet->SetCellValue($firstColumn.$i, 'Total');
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_qty.$i, '=SUM('.$letter_product_qty.($iOri).':'.$letter_product_qty.($i-1).')');
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getFont()->setBold(true);
|
||||
if ($type == 2) {
|
||||
$activeSheet->getStyle($letter_product_qty.$i)->getFill()->applyFromArray(
|
||||
array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'rotation' => 0,
|
||||
'startcolor' => array(
|
||||
'rgb' => 'D9D9D9'
|
||||
),
|
||||
'endcolor' => array(
|
||||
'argb' => 'D9D9D9D9'
|
||||
)
|
||||
)
|
||||
);
|
||||
$activeSheet->SetCellValue($letter_product_total_qty.$i, '=SUM('.$letter_product_total_qty.($iOri).':'.$letter_product_total_qty.($i-1).')');
|
||||
$activeSheet->getStyle($letter_product_total_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_total_qty.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->SetCellValue($letter_product_remaining_qty.$i, '=SUM('.$letter_product_remaining_qty.($iOri).':'.$letter_product_remaining_qty.($i-1).')');
|
||||
$activeSheet->getStyle($letter_product_remaining_qty.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$activeSheet->getStyle($letter_product_remaining_qty.$i)->getFont()->setBold(true);
|
||||
}
|
||||
|
||||
$activeSheet->getStyle($firstColumn.($iOri-1).':'.$lastColumn.$i)->applyFromArray($arrayBorder);
|
||||
|
||||
$i++;
|
||||
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, $lang['Total Amount']);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
||||
if($type == 1)
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total.$i, '=SUM('.$letter_product_total.($iOri).':'.$letter_product_total.($i-2).')');
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR );
|
||||
|
||||
if($lang_id != 'en')
|
||||
{
|
||||
$i++;
|
||||
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, 'TVA '.$TVA);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
||||
if($type == 1)
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total.$i, '='.$letter_product_total.($i-1).'*'.($TVA/100) );
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR );
|
||||
|
||||
$i++;
|
||||
|
||||
$activeSheet->setCellValue($letter_product_ht.$i, 'TOTAL TTC');
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
||||
$activeSheet->getStyle($letter_product_ht.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->setCellValue($letter_product_total.$i, '='.$letter_product_total.($i-1).'+'.$letter_product_total.($i-2) );
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR );
|
||||
$activeSheet->getStyle($letter_product_total.$i)->getFont()->setBold(true);
|
||||
|
||||
$activeSheet->getStyle($letter_product_ht.($i-3).':'.$lastColumn.$i)->applyFromArray($arrayBorder);
|
||||
}
|
||||
else
|
||||
{
|
||||
$activeSheet->getStyle($letter_product_ht.($i-1).':'.$lastColumn.$i)->applyFromArray($arrayBorder);
|
||||
}
|
||||
if($type == 1)
|
||||
{
|
||||
$value = Configuration::get('PS_IT_OF_BAS_PAGE_'.$lang_id);
|
||||
if($value != '')
|
||||
{
|
||||
$i++;
|
||||
$value = str_replace('<br />', ' ' , nl2br($value));
|
||||
|
||||
$activeSheet->setCellValue($firstColumn.$i, $value);
|
||||
$activeSheet->mergeCells($firstColumn.$i.':'.$lastColumn.$i );
|
||||
$activeSheet->getRowDimension($i)->setRowHeight(80);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_TEXT );
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setWrapText(true);
|
||||
}
|
||||
|
||||
$value = Configuration::get('PS_IT_OF_BAS_PAGE_BIS_'.$lang_id);
|
||||
if($value != '')
|
||||
{
|
||||
$i++;
|
||||
$value = str_replace('<br />', ' ' , nl2br($value));
|
||||
|
||||
$activeSheet->setCellValue($firstColumn.$i, $value);
|
||||
$activeSheet->mergeCells($firstColumn.$i.':'.$lastColumn.$i );
|
||||
$activeSheet->getRowDimension($i)->setRowHeight(80);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getAlignment()->setWrapText(true);
|
||||
$activeSheet->getStyle($firstColumn.$i)->getFont()->getColor()->setRGB('FF0000');
|
||||
$activeSheet->getStyle($firstColumn.$i)->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_TEXT );
|
||||
}
|
||||
}
|
||||
|
||||
$activeSheet->getColumnDimension($firstColumn)->setWidth(25);
|
||||
$activeSheet->getColumnDimension($letter_product_ean)->setWidth(25);
|
||||
$activeSheet->getColumnDimension($letter_product_ref_interne)->setWidth(25);
|
||||
$activeSheet->getColumnDimension($letter_product_qty)->setWidth(18);
|
||||
$activeSheet->getColumnDimension($letter_product_name)->setWidth(40);
|
||||
if($have_declinaison === true)
|
||||
$activeSheet->getColumnDimension($letter_product_attribute_name)->setWidth(20);
|
||||
|
||||
$activeSheet->getColumnDimension($letter_product_qty)->setWidth(13);
|
||||
if ($type == 2) {
|
||||
$activeSheet->getColumnDimension($letter_product_total_qty)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_remaining_qty)->setWidth(13);
|
||||
}
|
||||
$activeSheet->getColumnDimension($letter_product_ht)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_total)->setWidth(13);
|
||||
|
||||
$i++;
|
||||
|
||||
$activeSheet->setCellValue($firstColumn.$i, '');
|
||||
}
|
||||
$activeSheet->getColumnDimension($letter_product_ht)->setWidth(13);
|
||||
$activeSheet->getColumnDimension($letter_product_total)->setWidth(13);
|
||||
|
||||
$i++;
|
||||
|
||||
$activeSheet->setCellValue($firstColumn.$i, '');
|
||||
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="'.$title.'.xlsx"');
|
||||
|
Loading…
Reference in New Issue
Block a user