| | | 1 | | @using OzonOrdersWeb.Areas.OneCFresh.ViewModels |
| | | 2 | | @model object |
| | | 3 | | @{ |
| | 0 | 4 | | var isReceipt = Model is ReceiptDetailViewModel; |
| | 0 | 5 | | var receipt = Model as ReceiptDetailViewModel; |
| | 0 | 6 | | var transfer = Model as TransferDetailViewModel; |
| | 0 | 7 | | var error = receipt?.Error ?? transfer?.Error; |
| | 0 | 8 | | var number = receipt?.Number ?? transfer?.Number ?? ""; |
| | 0 | 9 | | var date = receipt?.Date ?? transfer?.Date ?? ""; |
| | 0 | 10 | | var posted = receipt?.Posted ?? transfer?.Posted ?? false; |
| | 0 | 11 | | var deleted = receipt?.DeletionMark ?? transfer?.DeletionMark ?? false; |
| | 0 | 12 | | var comment = receipt?.Comment ?? transfer?.Comment ?? ""; |
| | 0 | 13 | | var lines = receipt?.Lines ?? transfer?.Lines ?? new List<DocumentLineItem>(); |
| | | 14 | | |
| | | 15 | | string FormatDate(string d) |
| | | 16 | | { |
| | 0 | 17 | | if (!DateTime.TryParse(d, out var dt)) return d; |
| | 0 | 18 | | return dt.ToString("dd.MM.yyyy HH:mm"); |
| | | 19 | | } |
| | | 20 | | |
| | 0 | 21 | | string FormatDecimal(decimal v) => v.ToString("N2", System.Globalization.CultureInfo.GetCultureInfo("ru-RU")); |
| | | 22 | | } |
| | | 23 | | |
| | 0 | 24 | | @if (error != null) |
| | | 25 | | { |
| | 0 | 26 | | <div class="alert alert-danger py-2 small">@error</div> |
| | | 27 | | } |
| | | 28 | | else |
| | | 29 | | { |
| | | 30 | | <div class="modal-header"> |
| | | 31 | | <h5 class="modal-title"> |
| | 0 | 32 | | @if (isReceipt) |
| | | 33 | | { |
| | | 34 | | <i class="bi bi-box-arrow-in-down me-2 text-success"></i> |
| | 0 | 35 | | <text>Приходная накладная №@number</text> |
| | | 36 | | } |
| | | 37 | | else |
| | | 38 | | { |
| | | 39 | | <i class="bi bi-arrows-move me-2 text-success"></i> |
| | 0 | 40 | | <text>Перемещение запасов №@number</text> |
| | | 41 | | } |
| | | 42 | | </h5> |
| | | 43 | | <button type="button" class="btn-close" data-bs-dismiss="modal"></button> |
| | | 44 | | </div> |
| | | 45 | | <div class="modal-body"> |
| | | 46 | | <div class="row g-2 mb-3 small"> |
| | | 47 | | <div class="col-sm-4"> |
| | | 48 | | <span class="text-muted">Дата:</span> |
| | 0 | 49 | | <strong class="ms-1">@FormatDate(date)</strong> |
| | | 50 | | </div> |
| | | 51 | | <div class="col-sm-4"> |
| | | 52 | | <span class="text-muted">Статус:</span> |
| | 0 | 53 | | @if (deleted) |
| | | 54 | | { |
| | | 55 | | <span class="badge badge-deleted ms-1"><i class="bi bi-trash me-1"></i>Удалён</span> |
| | | 56 | | } |
| | 0 | 57 | | else if (posted) |
| | | 58 | | { |
| | | 59 | | <span class="badge badge-posted ms-1"><i class="bi bi-check2-circle me-1"></i>Проведён</span> |
| | | 60 | | } |
| | | 61 | | else |
| | | 62 | | { |
| | | 63 | | <span class="badge badge-draft ms-1"><i class="bi bi-pencil me-1"></i>Черновик</span> |
| | | 64 | | } |
| | | 65 | | </div> |
| | 0 | 66 | | @if (isReceipt && receipt != null) |
| | | 67 | | { |
| | | 68 | | <div class="col-sm-4"> |
| | | 69 | | <span class="text-muted">Контрагент:</span> |
| | 0 | 70 | | <strong class="ms-1">@receipt.CounterpartyName</strong> |
| | | 71 | | </div> |
| | | 72 | | <div class="col-sm-4"> |
| | | 73 | | <span class="text-muted">Склад:</span> |
| | 0 | 74 | | <strong class="ms-1">@receipt.WarehouseName</strong> |
| | | 75 | | </div> |
| | 0 | 76 | | @if (!string.IsNullOrEmpty(receipt.IncomingDocNumber)) |
| | | 77 | | { |
| | | 78 | | <div class="col-sm-4"> |
| | | 79 | | <span class="text-muted">Вх. документ:</span> |
| | 0 | 80 | | <strong class="ms-1">@receipt.IncomingDocNumber</strong> |
| | | 81 | | </div> |
| | | 82 | | } |
| | 0 | 83 | | @if (!string.IsNullOrEmpty(receipt.IncomingDocDate)) |
| | | 84 | | { |
| | | 85 | | <div class="col-sm-4"> |
| | | 86 | | <span class="text-muted">Дата вх. документа:</span> |
| | 0 | 87 | | <strong class="ms-1">@FormatDate(receipt.IncomingDocDate)</strong> |
| | | 88 | | </div> |
| | | 89 | | } |
| | | 90 | | } |
| | 0 | 91 | | @if (!isReceipt && transfer != null) |
| | | 92 | | { |
| | | 93 | | <div class="col-sm-4"> |
| | | 94 | | <span class="text-muted">Откуда:</span> |
| | | 95 | | <span class="badge bg-light text-dark border ms-1"> |
| | 0 | 96 | | <i class="bi bi-box-arrow-up me-1 text-danger"></i>@transfer.WarehouseSenderName |
| | | 97 | | </span> |
| | | 98 | | </div> |
| | | 99 | | <div class="col-sm-4"> |
| | | 100 | | <span class="text-muted">Куда:</span> |
| | | 101 | | <span class="badge bg-light text-dark border ms-1"> |
| | 0 | 102 | | <i class="bi bi-box-arrow-in-down me-1 text-success"></i>@transfer.WarehouseRecipientName |
| | | 103 | | </span> |
| | | 104 | | </div> |
| | | 105 | | } |
| | 0 | 106 | | @if (!string.IsNullOrEmpty(comment)) |
| | | 107 | | { |
| | | 108 | | <div class="col-12"> |
| | | 109 | | <span class="text-muted">Комментарий:</span> |
| | 0 | 110 | | <span class="ms-1">@comment</span> |
| | | 111 | | </div> |
| | | 112 | | } |
| | | 113 | | </div> |
| | | 114 | | |
| | 0 | 115 | | @if (lines.Count > 0) |
| | | 116 | | { |
| | | 117 | | <div class="table-responsive"> |
| | | 118 | | <table class="table table-sm table-hover onec-table border mb-0"> |
| | | 119 | | <thead class="table-light"> |
| | | 120 | | <tr> |
| | | 121 | | <th>#</th> |
| | | 122 | | <th>Артикул</th> |
| | | 123 | | <th>Номенклатура</th> |
| | | 124 | | <th class="text-end">Кол-во</th> |
| | | 125 | | <th class="text-end">Цена</th> |
| | | 126 | | <th class="text-end">Сумма</th> |
| | | 127 | | </tr> |
| | | 128 | | </thead> |
| | | 129 | | <tbody> |
| | 0 | 130 | | @for (int i = 0; i < lines.Count; i++) |
| | | 131 | | { |
| | 0 | 132 | | var line = lines[i]; |
| | | 133 | | <tr> |
| | 0 | 134 | | <td class="text-muted">@(i + 1)</td> |
| | 0 | 135 | | <td class="font-monospace">@line.Article</td> |
| | 0 | 136 | | <td>@line.NomenclatureName</td> |
| | 0 | 137 | | <td class="text-end">@FormatDecimal(line.Quantity)</td> |
| | 0 | 138 | | <td class="text-end">@FormatDecimal(line.Price)</td> |
| | 0 | 139 | | <td class="text-end fw-semibold">@FormatDecimal(line.Amount)</td> |
| | | 140 | | </tr> |
| | | 141 | | } |
| | | 142 | | </tbody> |
| | | 143 | | <tfoot> |
| | | 144 | | <tr class="table-light"> |
| | | 145 | | <td colspan="5" class="text-end fw-semibold small">Итого:</td> |
| | 0 | 146 | | <td class="text-end fw-bold">@FormatDecimal(lines.Sum(l => l.Amount))</td> |
| | | 147 | | </tr> |
| | | 148 | | </tfoot> |
| | | 149 | | </table> |
| | | 150 | | </div> |
| | | 151 | | } |
| | | 152 | | else |
| | | 153 | | { |
| | | 154 | | <p class="text-muted small text-center py-2">Табличная часть пуста</p> |
| | | 155 | | } |
| | | 156 | | </div> |
| | | 157 | | <div class="modal-footer"> |
| | | 158 | | <button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Закрыть</button> |
| | | 159 | | </div> |
| | | 160 | | } |