Заказчик
Отзывы фрилансеров:
+ 0
- 0
Зарегистрирован на сайте 9 лет и 2 месяца
Бюджет:
по договоренности
Необходимо сделать шаблон чека для программы IIKO
Необходимо подогнать стандартный шаблон под требующийся под билет (в приложении)
так выглядит стандартный шаблон:
@using System
@using System.Linq
@using Resto.Front.PrintTemplates.Cheques.Razor
@using Resto.Front.PrintTemplates.Cheques.Razor.TemplateModels
@inherits TemplateBase
@{
var chequeTask = Model.ChequeTask;
var order = Model.Order;
var sum = chequeTask.Sales.Sum(sale = sale.GetCost() sale.DiscountSum + sale.IncreaseSum).RoundMoney();
}
@if (!Model.ChequeInfo.IsForReport)
{
@Model.CommonInfo.CafeSetup.BillHeader
}
@Raw(string.Join(Environment.NewLine, Model.Extensions.BeforeCheque))
@if (!Model.ChequeInfo.IsForReport)
{
}
@(chequeTask.IsStorno ? Resources.StornoCheque : chequeTask.IsBuy ? Resources.OrderBuyReceipt : Resources.OrderPaymentReceipt)
@Sales(chequeTask)
@if (chequeTask.ResultSum != sum)
{
}
@foreach (var discountItem in chequeTask.Discounts.Concat(chequeTask.Increases))
{
@DiscountIncrease(discountItem)
}
@if (chequeTask.PrintNds)
{
@Vats(chequeTask)
}
@Payments(chequeTask)
@if (!Model.ChequeInfo.IsForReport)
{
@string.Format(Resources.AllSumsInFormat, Model.CommonInfo.CafeSetup.CurrencyName)
@Model.CommonInfo.CafeSetup.BillFooter
}
@if (!chequeTask.IsStorno)
{
@Resources.Signature
}
@Raw(string.Join(Environment.NewLine, Model.Extensions.AfterCheque))
@helper Sales(IChequeTask chequeTask)
{
if (chequeTask.Sales.IsEmpty())
{
@Resources.ZeroChequeBody
}
else if (Model.IsFullCheque)
{
@if (!Model.ChequeInfo.IsForReport)
{
@Resources.NameTitle
@Resources.ProductSum
}
@foreach (var sale in chequeTask.Sales)
{
@sale.Name
@FormatMoney(sale.GetCost())
}
}
}
@helper DiscountIncrease(IChequeTaskDiscountItem discountItem)
{
@discountItem.Name
@FormatPercent(discountItem.Percent)
@FormatMoney(discountItem.Sum)
if (!string.IsNullOrWhiteSpace(discountItem.CardNumber))
{
@:@string.Format(Resources.CardPattern, discountItem.CardNumber)
}
}
@helper Vats(IChequeTask chequeTask)
{
var vats = chequeTask.Sales
.GroupBy(sale = sale.NdsPercent)
.Where(group = group.Key 0m)
.Select(group = Tuple.Create(group.Key, group.Sum(sale = (sale.ResultSum sale.ResultSum / (1m + @group.Key / 100m)).RoundMoney())))
.ToList();
var vatSum = vats.Sum(tuple = tuple.Item2);
if (vatSum != 0)
{
foreach (var percentAndSum in vats)
{
}
if (vats.Count 1)
{
}
}
}
@helper Payments(IChequeTask chequeTask)
{
foreach (var prepayItem in chequeTask.Prepayments)
{
}
if (chequeTask.CashPayment != 0m || (chequeTask.CardPayments.IsEmpty() && chequeTask.AdditionalPayments.IsEmpty()))
{
@Payment(Resources.Cash, chequeTask.CashPayment)
}
foreach (var cardPaymentItem in chequeTask.CardPayments)
{
@Payment(string.Format(Resources.CardPattern, cardPaymentItem.PaymentTypeName), cardPaymentItem.Sum, cardPaymentItem.Comment)
}
foreach (var additionalPaymentItem in chequeTask.AdditionalPayments)
{
@Payment(additionalPaymentItem.PaymentTypeName, additionalPaymentItem.Sum, additionalPaymentItem.Comment)
}
var orderPaymentsSumWithoutPrepay = chequeTask.CashPayment + chequeTask.CardPayments.Sum(p = p.Sum) + chequeTask.AdditionalPayments.Sum(p = p.Sum);
var orderPaymentsSumWithPrepay = orderPaymentsSumWithoutPrepay + SetSign(chequeTask.Prepayments.Sum(p = p.Sum));
var changeSum = Math.Max(orderPaymentsSumWithPrepay chequeTask.ResultSum, 0m);
var hasMultiplePayments = ((chequeTask.CashPayment != 0m ? 1 : 0) +
chequeTask.CardPayments.Count() +
chequeTask.AdditionalPayments.Count() +
chequeTask.Prepayments.Count()) 1;
if (hasMultiplePayments)
{
}
if (changeSum 0m)
{
}
}
@helper Payment(string name, decimal sum, string comment = null)
{
if (!string.IsNullOrWhiteSpace(comment))
{
@comment
}
}
@functions
{
private decimal SetSign(decimal sum)
{
return Model.ChequeTask.IsStorno ? -sum : sum;
}
}
Разделы:
Опубликован:
06.08.2015 | 22:43 [последние изменения: 06.08.2015 | 22:45]