add shipping rules

This commit is contained in:
Ludovic CANDELLIER
2023-07-16 14:45:42 +02:00
parent 72a7b270f9
commit 0879b0abf0
459 changed files with 6219 additions and 5416 deletions

View File

@@ -5,11 +5,17 @@ namespace App\Repositories\Core;
class Export
{
public $xls;
public $sheet;
public $filename;
public $stockage;
public $lig;
public $nb;
public $debug;
public function __construct()
@@ -75,16 +81,18 @@ class Export
if (isset($options[$key])) {
$txt = $options[$key][$txt];
}
if (!isset($multioptions[$key])){
$this->writeCell($this->lig, $col, $txt);
$this->nb++;
$col++;
continue;}
$tabs = self::getReverseMultiOptions($txt);
foreach ($tabs as $key2 => $value) {
$txt .= $multioptions[$key][$key2] . '\n';
}
if (! isset($multioptions[$key])) {
$this->writeCell($this->lig, $col, $txt);
$this->nb++;
$col++;
continue;
}
$tabs = self::getReverseMultiOptions($txt);
foreach ($tabs as $key2 => $value) {
$txt .= $multioptions[$key][$key2].'\n';
}
$this->writeCell($this->lig, $col, $txt);
$this->nb++;
$col++;
@@ -104,41 +112,43 @@ class Export
{
// Redirect output to a clients web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $this->filename . '"');
header('Content-Disposition: attachment;filename="'.$this->filename.'"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
// header('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be needed
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header('Pragma: public'); // HTTP/1.0
}
public function close()
{
if ($this->debug){
return;}
// Debug::message($this->xls);
$objWriter = PHPExcel_IOFactory::createWriter($this->xls, 'Excel2007');
// Debug::message($objWriter);
// exit;
if (!$this->stockage) {
$this->header();
$objWriter->save('php://output');
} else {
// $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$objWriter->save('text.xlsx');
}
if ($this->debug) {
return;
}
// Debug::message($this->xls);
$objWriter = PHPExcel_IOFactory::createWriter($this->xls, 'Excel2007');
// Debug::message($objWriter);
// exit;
if (! $this->stockage) {
$this->header();
$objWriter->save('php://output');
} else {
// $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$objWriter->save('text.xlsx');
}
}
public function conv($lig, $col)
{
$c = static::convColtoTxt($col);
$lig = $this->lig;
return ("$c$lig");
return "$c$lig";
}
public function convColtoTxt($col)
@@ -151,22 +161,25 @@ class Export
$c = '';
}
$c .= chr(65 + $col1);
return ($c);
return $c;
}
public function getOption($var)
{
$data = $this->init();
return ($data[$var . '_options']);
return $data[$var.'_options'];
}
public function getOptions($data)
{
$options = array();
$options = [];
foreach ($data as $key => $value) {
$var = substr($key, 0, -8);
$options[$var] = $value;
}
return $options;
}
}