Merge branch 'ticket-simplemulti_bdc' into develop

This commit is contained in:
Marion Muszynski 2016-06-20 11:02:00 +02:00
commit 1bfd79afb9
3 changed files with 33 additions and 24 deletions

View File

@ -85,7 +85,9 @@ class MakeStats {
public static function getArrayLines($lines, $by_product_price = false, $id_sale = 0)
{
$arrayTmp = array();
$arrayTmp = array();
$all_multi = array();
$all_m1 = array();
$g = 0;
if ($id_sale && (int)$id_sale>2) {
@ -109,9 +111,10 @@ class MakeStats {
foreach ($ids as $key => $id) {
$ids_od[] = (int)$id['id_order'];
}
$all_multi = $sale->getMultiForStats($ids_od, 3);
//$all_multi = $sale->getMultiForStats($ids_od, 3);
//$all_m2 = $sale->getMultiForStats($ids_od, 2, true);
$all_multi = $sale->getMultiForStats($ids_od, 2);
$all_m1 = $sale->getMultiForStats($ids_od, 1, true);
$all_m2 = $sale->getMultiForStats($ids_od, 2, true);
}
foreach($lines as $line)
@ -154,7 +157,7 @@ class MakeStats {
}
if ($id_sale && (int)$id_sale>2) {
// multi (order contenant au moins 3 ventes differentes)
// multi (order contenant au moins 2 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)) {
@ -169,15 +172,15 @@ class MakeStats {
}
// 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)) {
/*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'];
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['total_m'] = $arrayTmp[$line['product_id']][$line['product_attribute_id']]['m1_m2'] + $arrayTmp[$line['product_id']][$line['product_attribute_id']]['multi'];
// $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'];
$arrayTmp[$line['product_id']][$line['product_attribute_id']]['total_m'] = $arrayTmp[$line['product_id']][$line['product_attribute_id']]['m1'] + $arrayTmp[$line['product_id']][$line['product_attribute_id']]['multi'];
}
}
return $lines = $arrayTmp;

View File

@ -307,7 +307,8 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
$letter_product_name = 'C';
$letter_product_attribute_name = 'D';
$letter_product_ht = 'E';
$letter_product_M1_M2 = 'F';
//$letter_product_M1_M2 = 'F';
$letter_product_M1 = 'F';
$letter_product_multi = 'G';
$letter_product_colisage = 'H';
@ -359,7 +360,8 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
$letter_product_name = 'C';
//$letter_product_attribute_name = 'D';
$letter_product_ht = 'D';
$letter_product_M1_M2 = 'E';
/*$letter_product_M1_M2 = 'E';*/
$letter_product_M1 = 'E';
$letter_product_multi = 'F';
$letter_product_colisage = 'G';
@ -711,10 +713,10 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
$activeSheet->getStyle($letter_product_ht.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$activeSheet->getStyle($letter_product_ht.$i)->applyFromArray($borders_style);
$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->getStyle($letter_product_M1_M2.$i)->applyFromArray($borders_style);
$activeSheet->setCellValue($letter_product_M1.$i, 'M1');
$activeSheet->getStyle($letter_product_M1.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$activeSheet->getStyle($letter_product_M1.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$activeSheet->getStyle($letter_product_M1.$i)->applyFromArray($borders_style);
$activeSheet->setCellValue($letter_product_multi.$i, 'Multi');
$activeSheet->getStyle($letter_product_multi.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
@ -885,8 +887,8 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
$activeSheet->setCellValue($letter_product_multi.$i, (isset($values['multi']))?$values['multi']:0);
$activeSheet->getStyle($letter_product_multi.$i)->applyFromArray($borders_style);
$activeSheet->setCellValue($letter_product_M1_M2.$i, (isset($values['m1_m2']))?$values['m1_m2']:0);
$activeSheet->getStyle($letter_product_M1_M2.$i)->applyFromArray($borders_style);
$activeSheet->setCellValue($letter_product_M1.$i, (isset($values['m1']))?$values['m1']:0);
$activeSheet->getStyle($letter_product_M1.$i)->applyFromArray($borders_style);
// colonnes vide - a remplir par 3BTK
//$activeSheet->setCellValue($letter_product_colisage.$i, 0);
@ -896,7 +898,7 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
//$activeSheet->setCellValue($letter_product_missing.$i, 0);
$activeSheet->getStyle($letter_product_missing.$i)->applyFromArray($borders_style);
$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->setCellValue($letter_product_total_qty.$i, '='.$letter_product_M1.$i.'+'.$letter_product_multi.$i.'+'.$letter_product_colisage.$i.'-'.$letter_product_stock3btk.$i.'-'.$letter_product_missing.$i);
$activeSheet->getStyle($letter_product_total_qty.$i)->applyFromArray($borders_style);
$i++;
@ -1125,9 +1127,9 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
$activeSheet->getStyle($letter_product_multi.$i)->getFont()->setBold(true);
$activeSheet->getStyle($letter_product_multi.$i)->applyFromArray($borders_style);
$activeSheet->SetCellValue($letter_product_M1_M2.$i, '=SUM('.$letter_product_M1_M2.($iOri).':'.$letter_product_M1_M2.($i-1).')');
$activeSheet->getStyle($letter_product_M1_M2.$i)->getFont()->setBold(true);
$activeSheet->getStyle($letter_product_M1_M2.$i)->applyFromArray($borders_style);
$activeSheet->SetCellValue($letter_product_M1.$i, '=SUM('.$letter_product_M1.($iOri).':'.$letter_product_M1.($i-1).')');
$activeSheet->getStyle($letter_product_M1.$i)->getFont()->setBold(true);
$activeSheet->getStyle($letter_product_M1.$i)->applyFromArray($borders_style);
$activeSheet->SetCellValue($letter_product_colisage.$i, '=SUM('.$letter_product_colisage.($iOri).':'.$letter_product_colisage.($i-1).')');
$activeSheet->getStyle($letter_product_colisage.$i)->getFont()->setBold(true);
@ -1151,7 +1153,7 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
}
$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_M1)->setWidth(13);
$activeSheet->getColumnDimension($letter_product_colisage)->setWidth(13);
$activeSheet->getColumnDimension($letter_product_stock3btk)->setWidth(13);
$activeSheet->getColumnDimension($letter_product_missing)->setWidth(13);

View File

@ -107,7 +107,7 @@ class ParentOrderController extends ParentOrderControllerCore {
// $carrier_shipping_cost = 5;
}
}
}
}
// si multiple carriers
if (count($_carriers) > 1) {
@ -183,8 +183,12 @@ class ParentOrderController extends ParentOrderControllerCore {
$carriers_ah[] = $carrier;
}
}
unset($carriers);
$carriers = $carriers_ah;
// fix a check !
if (count($carriers_ah) > 0) {
unset($carriers);
$carriers = $carriers_ah;
}
}
}