You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
3.1KB

  1. <?php
  2. use common\helpers\MeanPayment;
  3. use common\helpers\Price;
  4. use common\logic\Document\Document\Module\DocumentModule;
  5. use common\logic\Document\Invoice\Module\InvoiceModule;
  6. use common\logic\Payment\Module\PaymentModule;
  7. use yii\helpers\Html;
  8. use yii\widgets\ActiveForm;
  9. $documentModule = DocumentModule::getInstance();
  10. $paymentManager = PaymentModule::getInstance();
  11. $invoiceModule = InvoiceModule::getInstance();
  12. if($documentModule->isStatusValid($model)): ?>
  13. <div>
  14. <div class="panel panel-default">
  15. <div class="panel-heading">
  16. Règlement
  17. </div>
  18. <div class="panel-body">
  19. <?php if($model->payments && count($model->payments) > 0): ?>
  20. <table class="table table-bordered">
  21. <thead>
  22. <tr>
  23. <th>Moyen de paiement</th>
  24. <th>Date transaction</th>
  25. <th>Montant</th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. <?php foreach($model->payments as $payment): ?>
  30. <tr>
  31. <td><?= $paymentManager->getStrMeanPayment($payment); ?></td>
  32. <td><?= $payment->date_transaction ? date('d/m/Y', strtotime($payment->date_transaction)) : '' ?></td>
  33. <td><?= Price::format($payment->amount); ?></td>
  34. </tr>
  35. <?php endforeach; ?>
  36. </tbody>
  37. </table>
  38. <?php endif; ?>
  39. <?php if( $invoiceModule->isDocumentInvoice($model) && ! $invoiceModule->isInvoicePaid($model)): ?>
  40. <div class="row">
  41. <?php $form = ActiveForm::begin(); ?>
  42. <div class="col-md-3">
  43. <?= $form->field($payment, 'mean_payment')->dropDownList(MeanPayment::getAll()); ?>
  44. </div>
  45. <div class="col-md-3">
  46. <?= $form->field($payment, 'date_transaction')->textInput([
  47. 'class' => 'datepicker form-control'
  48. ]); ?>
  49. </div>
  50. <div class="col-md-3">
  51. <?= $form->field($payment, 'amount', [
  52. 'template' => '{label}<div class="input-group">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>{hint}',
  53. ])->textInput(); ?>
  54. </div>
  55. <div class="col-md-3">
  56. <div class="form-group">
  57. <br>
  58. <?= Html::submitButton('Ajouter', ['class' => 'btn btn-primary']) ?>
  59. </div>
  60. </div>
  61. <?php ActiveForm::end(); ?>
  62. </div>
  63. <?php endif; ?>
  64. </div>
  65. </div>
  66. </div>
  67. <?php endif; ?>