|
|
|
|
|
|
|
|
foreach ($commandes as $c) |
|
|
foreach ($commandes as $c) |
|
|
$c->init(); |
|
|
$c->init(); |
|
|
|
|
|
|
|
|
$production = Production::find()->where('date LIKE \'' . $date . '\'')->one(); |
|
|
|
|
|
$produits_selec = ProductionProduit::findProduits($production->id); |
|
|
|
|
|
$points_vente = PointVente::find()->all(); |
|
|
|
|
|
foreach ($points_vente as $pv) |
|
|
|
|
|
$pv->initCommandes($commandes); |
|
|
|
|
|
|
|
|
|
|
|
// produits |
|
|
|
|
|
$produits = Produit::find() |
|
|
|
|
|
->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement]) |
|
|
|
|
|
->orderBy('order ASC') |
|
|
|
|
|
->all(); |
|
|
|
|
|
|
|
|
|
|
|
/*return [ |
|
|
|
|
|
'data' => $data, |
|
|
|
|
|
'filename' => $filename |
|
|
|
|
|
];*/ |
|
|
|
|
|
|
|
|
|
|
|
// get your HTML raw content without any layouts or scripts |
|
|
|
|
|
$content = $this->renderPartial('report',[ |
|
|
|
|
|
'production' => $production, |
|
|
|
|
|
'produits_selec' => $produits_selec, |
|
|
|
|
|
'points_vente' => $points_vente, |
|
|
|
|
|
'date' => $date, |
|
|
|
|
|
'produits' => $produits |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
$production = Production::find() |
|
|
|
|
|
->where('date LIKE \'' . $date . '\'') |
|
|
|
|
|
->one(); |
|
|
|
|
|
if($production) |
|
|
|
|
|
{ |
|
|
|
|
|
$produits_selec = ProductionProduit::findProduits($production->id); |
|
|
|
|
|
$points_vente = PointVente::find()->all(); |
|
|
|
|
|
foreach ($points_vente as $pv) |
|
|
|
|
|
$pv->initCommandes($commandes); |
|
|
|
|
|
|
|
|
/*$pdf = Yii::$app->pdf; |
|
|
|
|
|
$pdf->content = $content; |
|
|
|
|
|
$pdf->orientation = Pdf::ORIENT_LANDSCAPE ; |
|
|
|
|
|
return $pdf->render();*/ |
|
|
|
|
|
|
|
|
// produits |
|
|
|
|
|
$produits = Produit::find() |
|
|
|
|
|
->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement]) |
|
|
|
|
|
->orderBy('order ASC') |
|
|
|
|
|
->all(); |
|
|
|
|
|
|
|
|
|
|
|
// get your HTML raw content without any layouts or scripts |
|
|
|
|
|
$content = $this->renderPartial('report',[ |
|
|
|
|
|
'production' => $production, |
|
|
|
|
|
'produits_selec' => $produits_selec, |
|
|
|
|
|
'points_vente' => $points_vente, |
|
|
|
|
|
'date' => $date, |
|
|
|
|
|
'produits' => $produits |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
$date_str = date('d/m/Y',strtotime($date)) ; |
|
|
|
|
|
|
|
|
|
|
|
$pdf = new Pdf([ |
|
|
|
|
|
// set to use core fonts only |
|
|
|
|
|
'mode' => Pdf::MODE_UTF8, |
|
|
|
|
|
// A4 paper format |
|
|
|
|
|
'format' => Pdf::FORMAT_A4, |
|
|
|
|
|
// portrait orientation |
|
|
|
|
|
'orientation' => Pdf::ORIENT_LANDSCAPE, |
|
|
|
|
|
// stream to browser inline |
|
|
|
|
|
'destination' => Pdf::DEST_BROWSER, |
|
|
|
|
|
// your html content input |
|
|
|
|
|
'content' => $content, |
|
|
|
|
|
// format content from your own css file if needed or use the |
|
|
|
|
|
// enhanced bootstrap css built by Krajee for mPDF formatting |
|
|
|
|
|
//'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', |
|
|
|
|
|
// any css to be embedded if required |
|
|
|
|
|
//'cssInline' => '.kv-heading-1{font-size:18px}', |
|
|
|
|
|
// set mPDF properties on the fly |
|
|
|
|
|
//'options' => ['title' => 'Krajee Report Title'], |
|
|
|
|
|
// call mPDF methods on the fly |
|
|
|
|
|
'methods' => [ |
|
|
|
|
|
'SetHeader'=>['Commandes du '.$date_str], |
|
|
|
|
|
'SetFooter'=>['{PAGENO}'], |
|
|
|
|
|
] |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
// return the pdf output as per the destination setting |
|
|
|
|
|
return $pdf->render(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// setup kartik\mpdf\Pdf component |
|
|
|
|
|
$pdf = new Pdf([ |
|
|
|
|
|
// set to use core fonts only |
|
|
|
|
|
'mode' => Pdf::MODE_UTF8, |
|
|
|
|
|
// A4 paper format |
|
|
|
|
|
'format' => Pdf::FORMAT_A4, |
|
|
|
|
|
// portrait orientation |
|
|
|
|
|
'orientation' => Pdf::ORIENT_LANDSCAPE, |
|
|
|
|
|
// stream to browser inline |
|
|
|
|
|
'destination' => Pdf::DEST_BROWSER, |
|
|
|
|
|
// your html content input |
|
|
|
|
|
'content' => $content, |
|
|
|
|
|
// format content from your own css file if needed or use the |
|
|
|
|
|
// enhanced bootstrap css built by Krajee for mPDF formatting |
|
|
|
|
|
//'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', |
|
|
|
|
|
// any css to be embedded if required |
|
|
|
|
|
//'cssInline' => '.kv-heading-1{font-size:18px}', |
|
|
|
|
|
// set mPDF properties on the fly |
|
|
|
|
|
//'options' => ['title' => 'Krajee Report Title'], |
|
|
|
|
|
// call mPDF methods on the fly |
|
|
|
|
|
'methods' => [ |
|
|
|
|
|
'SetHeader'=>['Commandes'], |
|
|
|
|
|
'SetFooter'=>['{PAGENO}'], |
|
|
|
|
|
] |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
// return the pdf output as per the destination setting |
|
|
|
|
|
return $pdf->render(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function actionDeleteCommande($date, $id_commande) { |
|
|
public function actionDeleteCommande($date, $id_commande) { |