<tr class="<?php if(isset($displayOrders) && $displayOrders): ?>order<?php endif; ?>"> | |||||
<td class="align-left"> | |||||
<?= Html::encode($productOrder->product->name) ?> | |||||
<?php if($productOrder->unit == 'piece' && isset($productOrder->product->weight) && $productOrder->product->weight): ?> | |||||
<span class="weight"> / <?= $productOrder->product->weight ?> g</span> | |||||
<?php endif; ?> | |||||
<?php if(strlen($productOrder->product->description)): ?> | |||||
<br /><small><?= Html::encode($productOrder->product->description) ?></small> | |||||
<?php endif; ?> | |||||
</td> | |||||
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?> | |||||
<td class="align-center"><?= Price::format($productOrder->getPrice()) ?></td> | |||||
<?php endif; ?> | |||||
<td class="align-center"><?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?></td> | |||||
<td class="align-center"><?= Product::strUnit($productOrder->unit, 'wording') ?></td> | |||||
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?> | |||||
<?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?> | |||||
<td class="align-center"><?= $productOrder->taxRate->value * 100 ?> %</td> | |||||
<?php endif; ?> | |||||
<td class="align-center"><?= Price::format($productOrder->getPrice() * $productOrder->quantity) ?></td> | |||||
<?php endif; ?> | |||||
</tr> |
</tr> | </tr> | ||||
</thead> | </thead> | ||||
<tbody> | <tbody> | ||||
<?php foreach($document->getProductsOrders() as $product): ?> | |||||
<?php foreach($product as $productOrder): ?> | |||||
<tr> | |||||
<td class="align-left"> | |||||
<?= Html::encode($productOrder->product->name) ?> | |||||
<?php if($productOrder->unit == 'piece' && isset($productOrder->product->weight) && $productOrder->product->weight): ?> | |||||
<span class="weight"> / <?= $productOrder->product->weight ?> g</span> | |||||
<?php endif; ?> | |||||
<?php if(strlen($productOrder->product->description)): ?> | |||||
<br /><small><?= Html::encode($productOrder->product->description) ?></small> | |||||
<?php if($document->isDisplayOrders()): ?> | |||||
<?php foreach($document->orders as $order): ?> | |||||
<tr> | |||||
<td> | |||||
<strong><?= Html::encode($order->getUsername()) ; ?></strong> | |||||
le <?= date('d/m/Y', strtotime($order->date)) ?> | |||||
</td> | |||||
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?> | |||||
<td class="align-center"></td> | |||||
<?php endif; ?> | <?php endif; ?> | ||||
</td> | |||||
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?> | |||||
<td class="align-center"><?= Price::format($productOrder->getPrice()) ?></td> | |||||
<?php endif; ?> | |||||
<td class="align-center"><?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?></td> | |||||
<td class="align-center"><?= Product::strUnit($productOrder->unit, 'wording') ?></td> | |||||
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?> | |||||
<?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?> | |||||
<td class="align-center"><?= $productOrder->taxRate->value * 100 ?> %</td> | |||||
<td></td> | |||||
<td></td> | |||||
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?> | |||||
<?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?> | |||||
<td class="align-center"></td> | |||||
<?php endif; ?> | |||||
<td class="align-center"></td> | |||||
<?php endif; ?> | <?php endif; ?> | ||||
<td class="align-center"><?= Price::format($productOrder->getPrice() * $productOrder->quantity) ?></td> | |||||
<?php endif; ?> | |||||
</tr> | |||||
</tr> | |||||
<?php foreach($order->productOrder as $productOrder): ?> | |||||
<?= $this->render('_download_product_line', [ | |||||
'productOrder' => $productOrder, | |||||
'displayOrders' => true, | |||||
]) ?> | |||||
<?php endforeach; ?> | |||||
<?php endforeach; ?> | <?php endforeach; ?> | ||||
<?php endforeach; ?> | |||||
<?php else: ?> | |||||
<?php foreach($document->getProductsOrders() as $product): ?> | |||||
<?php foreach($product as $productOrder): ?> | |||||
<?= $this->render('_download_product_line', [ | |||||
'productOrder' => $productOrder, | |||||
]) ?> | |||||
<?php endforeach; ?> | |||||
<?php endforeach; ?> | |||||
<?php endif; ?> | |||||
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?> | <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?> | ||||
<?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?> | <?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?> | ||||
<tr> | <tr> |
<?= $form->field($model, 'document_invoice_first_reference') ; ?> | <?= $form->field($model, 'document_invoice_first_reference') ; ?> | ||||
<?= $form->field($model, 'document_delivery_note_prefix') ; ?> | <?= $form->field($model, 'document_delivery_note_prefix') ; ?> | ||||
<?= $form->field($model, 'document_delivery_note_first_reference') ; ?> | <?= $form->field($model, 'document_delivery_note_first_reference') ; ?> | ||||
<?= $form->field($model, 'document_display_orders_invoice')->dropDownList([ | |||||
0 => 'Non', | |||||
1 => 'Oui' | |||||
]) ; ?> | |||||
<?= $form->field($model, 'document_display_orders_delivery_note')->dropDownList([ | |||||
0 => 'Non', | |||||
1 => 'Oui' | |||||
]) ; ?> | |||||
<?= $form->field($model, 'document_infos_bottom') | <?= $form->field($model, 'document_infos_bottom') | ||||
->textarea(['rows' => 15]) ?> | ->textarea(['rows' => 15]) ?> | ||||
<?= $form->field($model, 'document_infos_quotation') | <?= $form->field($model, 'document_infos_quotation') |
/* line 5, ../../sass/document/download.scss */ | /* line 5, ../../sass/document/download.scss */ | ||||
body { | |||||
padding-bottom: 200px; | |||||
} | |||||
/* line 9, ../../sass/document/download.scss */ | |||||
.document-download { | .document-download { | ||||
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; | font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; | ||||
} | } | ||||
/* line 10, ../../sass/document/download.scss */ | |||||
/* line 14, ../../sass/document/download.scss */ | |||||
.document-download #block-addresses .producer { | .document-download #block-addresses .producer { | ||||
text-align: left; | text-align: left; | ||||
margin-bottom: 20px; | margin-bottom: 20px; | ||||
} | } | ||||
/* line 15, ../../sass/document/download.scss */ | |||||
/* line 19, ../../sass/document/download.scss */ | |||||
.document-download #block-addresses .producer .logo { | .document-download #block-addresses .producer .logo { | ||||
margin-bottom: 20px; | margin-bottom: 20px; | ||||
} | } | ||||
/* line 23, ../../sass/document/download.scss */ | |||||
/* line 27, ../../sass/document/download.scss */ | |||||
.document-download #block-addresses .user { | .document-download #block-addresses .user { | ||||
text-align: right; | text-align: right; | ||||
} | } | ||||
/* line 28, ../../sass/document/download.scss */ | |||||
/* line 32, ../../sass/document/download.scss */ | |||||
.document-download #block-infos-document { | .document-download #block-infos-document { | ||||
padding-top: 30px; | padding-top: 30px; | ||||
} | } | ||||
/* line 31, ../../sass/document/download.scss */ | |||||
/* line 35, ../../sass/document/download.scss */ | |||||
.document-download #block-infos-document .date { | .document-download #block-infos-document .date { | ||||
padding-bottom: 10px; | padding-bottom: 10px; | ||||
} | } | ||||
/* line 34, ../../sass/document/download.scss */ | |||||
/* line 38, ../../sass/document/download.scss */ | |||||
.document-download #block-infos-document .reference { | .document-download #block-infos-document .reference { | ||||
padding-bottom: 10px; | padding-bottom: 10px; | ||||
font-size: 15px; | font-size: 15px; | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
/* line 39, ../../sass/document/download.scss */ | |||||
/* line 43, ../../sass/document/download.scss */ | |||||
.document-download #block-infos-document .reference .block-is-draft { | .document-download #block-infos-document .reference .block-is-draft { | ||||
border: solid 2px black; | border: solid 2px black; | ||||
padding: 10px; | padding: 10px; | ||||
text-transform: uppercase; | text-transform: uppercase; | ||||
} | } | ||||
/* line 50, ../../sass/document/download.scss */ | |||||
/* line 54, ../../sass/document/download.scss */ | |||||
.document-download #block-no-product { | .document-download #block-no-product { | ||||
font-weight: bold; | font-weight: bold; | ||||
border: solid 2px black; | border: solid 2px black; | ||||
text-transform: uppercase; | text-transform: uppercase; | ||||
padding: 10px; | padding: 10px; | ||||
} | } | ||||
/* line 57, ../../sass/document/download.scss */ | |||||
/* line 61, ../../sass/document/download.scss */ | |||||
.document-download #block-products { | .document-download #block-products { | ||||
padding-top: 20px; | padding-top: 20px; | ||||
} | } | ||||
/* line 60, ../../sass/document/download.scss */ | |||||
/* line 64, ../../sass/document/download.scss */ | |||||
.document-download #block-products table { | .document-download #block-products table { | ||||
width: 100%; | width: 100%; | ||||
padding: 0px; | padding: 0px; | ||||
border-right: solid 1px #c0c0c0; | border-right: solid 1px #c0c0c0; | ||||
border-collapse: collapse; | border-collapse: collapse; | ||||
} | } | ||||
/* line 68, ../../sass/document/download.scss */ | |||||
/* line 72, ../../sass/document/download.scss */ | |||||
.document-download #block-products table td, .document-download #block-products table th { | .document-download #block-products table td, .document-download #block-products table th { | ||||
padding: 5px; | padding: 5px; | ||||
border-top: solid 1px #c0c0c0; | border-top: solid 1px #c0c0c0; | ||||
border-left: solid 1px #c0c0c0; | border-left: solid 1px #c0c0c0; | ||||
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; | font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; | ||||
} | } | ||||
/* line 74, ../../sass/document/download.scss */ | |||||
/* line 78, ../../sass/document/download.scss */ | |||||
.document-download #block-products table td.align-left, .document-download #block-products table th.align-left { | .document-download #block-products table td.align-left, .document-download #block-products table th.align-left { | ||||
text-align: left; | text-align: left; | ||||
} | } | ||||
/* line 77, ../../sass/document/download.scss */ | |||||
/* line 81, ../../sass/document/download.scss */ | |||||
.document-download #block-products table td.align-center, .document-download #block-products table th.align-center { | .document-download #block-products table td.align-center, .document-download #block-products table th.align-center { | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 80, ../../sass/document/download.scss */ | |||||
/* line 84, ../../sass/document/download.scss */ | |||||
.document-download #block-products table td.align-right, .document-download #block-products table th.align-right { | .document-download #block-products table td.align-right, .document-download #block-products table th.align-right { | ||||
text-align: right; | text-align: right; | ||||
} | } | ||||
/* line 87, ../../sass/document/download.scss */ | |||||
/* line 91, ../../sass/document/download.scss */ | |||||
.document-download .block-infos { | .document-download .block-infos { | ||||
margin-top: 20px; | margin-top: 20px; | ||||
padding: 10px; | padding: 10px; | ||||
border: solid 1px #c0c0c0; | border: solid 1px #c0c0c0; | ||||
} | } | ||||
/* line 92, ../../sass/document/download.scss */ | |||||
/* line 96, ../../sass/document/download.scss */ | |||||
.document-download .block-infos strong { | .document-download .block-infos strong { | ||||
font-size: 12px; | font-size: 12px; | ||||
} | } | ||||
/* line 98, ../../sass/document/download.scss */ | |||||
/* line 102, ../../sass/document/download.scss */ | |||||
#footer { | #footer { | ||||
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; | font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; | ||||
text-align: center; | text-align: center; | ||||
padding-top: 20px; | |||||
padding-top: 10px; | |||||
border-top: solid 1px gray; | border-top: solid 1px gray; | ||||
} | } | ||||
/* line 104, ../../sass/document/download.scss */ | |||||
/* line 108, ../../sass/document/download.scss */ | |||||
#footer .infos-bottom { | #footer .infos-bottom { | ||||
padding-bottom: 20px; | padding-bottom: 20px; | ||||
margin-bottom: 40px; | margin-bottom: 40px; | ||||
font-size: 12px; | font-size: 12px; | ||||
line-height: 18px; | line-height: 18px; | ||||
} | } | ||||
/* line 110, ../../sass/document/download.scss */ | |||||
/* line 114, ../../sass/document/download.scss */ | |||||
#footer .reference-document { | #footer .reference-document { | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } |
$font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif ; | $font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif ; | ||||
$border-color: #c0c0c0 ; | $border-color: #c0c0c0 ; | ||||
body { | |||||
padding-bottom: 200px ; | |||||
} | |||||
.document-download { | .document-download { | ||||
font-family: $font-family ; | font-family: $font-family ; | ||||
#footer { | #footer { | ||||
font-family: $font-family ; | font-family: $font-family ; | ||||
text-align: center ; | text-align: center ; | ||||
padding-top: 20px ; | |||||
padding-top: 10px ; | |||||
border-top: solid 1px gray ; | border-top: solid 1px gray ; | ||||
.infos-bottom { | .infos-bottom { |
return $this->hasMany(Order::className(), [$fieldIdDocument => 'id']) | return $this->hasMany(Order::className(), [$fieldIdDocument => 'id']) | ||||
->with($defaultOptionsSearch['with']) | ->with($defaultOptionsSearch['with']) | ||||
->joinWith($defaultOptionsSearch['join_with']); | |||||
->joinWith($defaultOptionsSearch['join_with']) | |||||
->orderBy('user.lastname ASC, user.name ASC, comment_point_sale ASC'); | |||||
} | } | ||||
} | } | ||||
$contentFooter .= '</div>'; | $contentFooter .= '</div>'; | ||||
$marginBottom = 10 ; | |||||
if(strlen(Producer::getConfig('document_infos_bottom')) > 0) { | |||||
$marginBottom = 40 ; | |||||
} | |||||
$pdf = new Pdf([ | $pdf = new Pdf([ | ||||
'mode' => Pdf::MODE_UTF8, | 'mode' => Pdf::MODE_UTF8, | ||||
'format' => Pdf::FORMAT_A4, | 'format' => Pdf::FORMAT_A4, | ||||
'content' => $content, | 'content' => $content, | ||||
'filename' => $this->getFilename(), | 'filename' => $this->getFilename(), | ||||
'cssFile' => Yii::getAlias('@webroot/css/document/download.css'), | 'cssFile' => Yii::getAlias('@webroot/css/document/download.css'), | ||||
'marginBottom' => $marginBottom, | |||||
'methods' => [ | 'methods' => [ | ||||
'SetHTMLFooter' => $contentFooter | 'SetHTMLFooter' => $contentFooter | ||||
] | ] | ||||
return $productsOrdersArray; | return $productsOrdersArray; | ||||
} | } | ||||
public function isDisplayOrders() | |||||
{ | |||||
$displayOrders = ($this->getClass() == 'Invoice') ? | |||||
Producer::getConfig('document_display_orders_invoice') : | |||||
Producer::getConfig('document_display_orders_delivery_note') ; | |||||
return $displayOrders ; | |||||
} | |||||
public function getFilename() | public function getFilename() | ||||
{ | { | ||||
return Yii::getAlias('@app/web/pdf/'.$this->getType().'-' . $this->reference. '.pdf') ; | return Yii::getAlias('@app/web/pdf/'.$this->getType().'-' . $this->reference. '.pdf') ; |
}], | }], | ||||
[['description', 'mentions', 'gcs', 'order_infos', 'slug', 'secret_key_payplug', 'background_color_logo', 'option_behavior_cancel_order', 'tiller_provider_token', 'tiller_restaurant_token', 'status', | [['description', 'mentions', 'gcs', 'order_infos', 'slug', 'secret_key_payplug', 'background_color_logo', 'option_behavior_cancel_order', 'tiller_provider_token', 'tiller_restaurant_token', 'status', | ||||
'document_infos_bottom', 'document_infos_quotation', 'document_infos_invoice', 'document_infos_delivery_note', 'address'], 'string'], | 'document_infos_bottom', 'document_infos_quotation', 'document_infos_invoice', 'document_infos_delivery_note', 'address'], 'string'], | ||||
[['negative_balance', 'credit', 'active', 'online_payment', 'user_manage_subscription', 'option_allow_user_gift', 'use_credit_checked_default', 'tiller'], 'boolean'], | |||||
[['negative_balance', 'credit', 'active', 'online_payment', 'user_manage_subscription', 'option_allow_user_gift', 'use_credit_checked_default', 'tiller', 'document_display_orders_invoice', 'document_display_orders_delivery_note'], 'boolean'], | |||||
[['name', 'siret', 'logo', 'photo', 'postcode', 'city', 'code', 'type', 'credit_functioning', 'option_behavior_cancel_order', 'document_quotation_prefix', 'document_quotation_first_reference', 'document_invoice_prefix', 'document_invoice_first_reference', 'document_delivery_note_prefix', 'document_delivery_note_first_reference'], 'string', 'max' => 255], | [['name', 'siret', 'logo', 'photo', 'postcode', 'city', 'code', 'type', 'credit_functioning', 'option_behavior_cancel_order', 'document_quotation_prefix', 'document_quotation_first_reference', 'document_invoice_prefix', 'document_invoice_first_reference', 'document_delivery_note_prefix', 'document_delivery_note_first_reference'], 'string', 'max' => 255], | ||||
[['free_price', 'credit_limit_reminder', 'credit_limit'], 'double'], | [['free_price', 'credit_limit_reminder', 'credit_limit'], 'double'], | ||||
['free_price', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'], | ['free_price', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'], | ||||
'document_infos_quotation' => 'Informations affichées en bas des devis', | 'document_infos_quotation' => 'Informations affichées en bas des devis', | ||||
'document_infos_invoice' => 'Informations affichées en bas des factures', | 'document_infos_invoice' => 'Informations affichées en bas des factures', | ||||
'document_infos_delivery_note' => 'Informations affichées en bas des bons de livraison', | 'document_infos_delivery_note' => 'Informations affichées en bas des bons de livraison', | ||||
'address' => 'Adresse' | |||||
'address' => 'Adresse', | |||||
'document_display_orders_invoice' => 'Afficher le détail des commandes dans les factures', | |||||
'document_display_orders_delivery_note' => 'Afficher le détail des commandes dans les bons de commande', | |||||
]; | ]; | ||||
} | } | ||||
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\Schema; | |||||
class m200225_153956_document_display_orders extends Migration | |||||
{ | |||||
public function safeUp() | |||||
{ | |||||
$this->addColumn('producer', 'document_display_orders_invoice', Schema::TYPE_BOOLEAN ) ; | |||||
$this->addColumn('producer', 'document_display_orders_delivery_note', Schema::TYPE_BOOLEAN ) ; | |||||
} | |||||
public function safeDown() | |||||
{ | |||||
$this->dropColumn('producer', 'document_display_orders_invoice') ; | |||||
$this->dropColumn('producer', 'document_display_orders_delivery_note') ; | |||||
} | |||||
} |