Пример #1
0
        DocumentReportContainer MapDispatchNote(DispatchNote dispatchNote)
        {
            DocumentReportContainer docData = new DocumentReportContainer();
            MainOrder mainOrder = _mainOrderRepository.GetById(dispatchNote.OrderId);
            DocumentHeader docHeader = new DocumentHeader()
            {
                DatePrinted = DateTime.Now,
                DateRequired = dispatchNote.StartDate,
                DocumentIssuerUserName = dispatchNote.DocumentIssuerUser.Username,
                DocumentIssuerCCName = dispatchNote.DocumentIssuerCostCentre.Name,
                DocumentReference = dispatchNote.DocumentReference,
                RouteName = ((Outlet)mainOrder.IssuedOnBehalfOf).Route.Name,
                SalesmanName = dispatchNote.DocumentRecipientCostCentre.Name,
                StatusStr = dispatchNote.Status.ToString(),
                TotalNet = dispatchNote.TotalNet,
            };
            docHeader.DocumentIssuerDetails = "Generated by: " + docHeader.DocumentIssuerUserName + " ; Cost centre: " +
                                             docHeader.DocumentIssuerCCName + "; Date: " +
                                             docHeader.DatePrinted.ToShortDateString();
            docData.DocumentHeader = docHeader;
            int i = 0;
            //foreach (var item in dispatchNote.LineItems)
            //{

            //    DocumentLineItem li = new DocumentLineItem
            //                              {
            //                                  DiscountType =
            //                                      (item.DiscountType == DiscountType.None
            //                                           ? StringUtils.BreakUpperCB(
            //                                               item.Product.GetType().ToString().Split('.').Last())
            //                                           : StringUtils.BreakUpperCB(item.DiscountType.ToString())),
            //                                  LineItemTypeStr = item.LineItemType.ToString(),
            //                                  ProductName = item.Product.Description,
            //                                  Qty = item.Qty,
            //                                  RowNumber = i + 1,
            //                                  TotalNet = item.LineItemTotal,
            //                                  TotalVat = item.LineItemVatTotal,
            //                                  UnitDiscount = item.ProductDiscount,
            //                                  UnitPrice = item.Value,
            //                                  UnitVat = item.LineItemVatValue,
            //                                  GrossAmount = item.LineItemTotal + item.LineItemVatTotal,
            //                              };
            //    docData.LineItems.Add(li);
            //    i++;
            //}

            foreach (var item in mainOrder.DispatchedLineItems)
            {
                OrderReportLineItem li = new DocumentLineItem()
                {
                    ApprovedQuantity = item.ApprovedQuantity,
                    BackOrderQuantity = item.BackOrderQuantity,

                    DiscountType =
                        (item.DiscountType == DiscountType.None
                             ? StringUtils.BreakUpperCB(
                                 item.Product.GetType().ToString().Split('.').Last())
                             : StringUtils.BreakUpperCB(item.DiscountType.ToString())),

                    DispachedQuantity = item.DispatchedQuantity,
                    GrossAmount = item.LineItemTotal,
                    LineItemTypeStr = item.LineItemType.ToString(),
                    LostSaleQuantity = item.LostSaleQuantity,
                    ProductName = item.Product.Description,
                    Qty = item.Qty,
                    RowNumber = i + 1,
                    TotalNet = item.TotalNetPrice,
                    TotalVat = item.LineItemVatTotal,
                    UnitDiscount = item.ProductDiscount,
                    UnitPrice = item.Value,
                    UnitVat = item.LineItemVatValue,
                };
                docData.LineItems.Add(li);
                i++;
            }
            return docData;
        }
Пример #2
0
        DocumentReportContainer MapOrder(MainOrder mainorder)
        {
            DocumentReportContainer docData = new DocumentReportContainer();

            DocumentHeader docHeader = new DocumentHeader()
            {
                AmountPaid = mainorder.PaidAmount,
                Comment = mainorder.Note,
                DatePrinted = DateTime.Now,
                DateRequired = mainorder.DateRequired,
                DocumentIssuerUserName = mainorder.DocumentIssuerUser.Username,
                DocumentIssuerCCName = mainorder.DocumentIssuerCostCentre.Name,
                DocumentReference = mainorder.DocumentReference,
                IssuedOnBehalfOfName = mainorder.IssuedOnBehalfOf.Name,
                OrderTypeStr = mainorder.OrderType.ToString(),
                OutstandingAmount = mainorder.OutstandingAmount,
                ParentId = mainorder.ParentId,
                RouteName = ((Outlet)mainorder.IssuedOnBehalfOf).Route.Name,
                SaleDiscount = mainorder.SaleDiscount,
                SalesmanName = mainorder.DocumentRecipientCostCentre.Name,
                ShipToAddress = mainorder.ShipToAddress,
                StatusStr = mainorder.Status.ToString(),
                TotalGross = mainorder.TotalGross,
                TotalNet = mainorder.TotalNet,
                TotalProductDiscount = mainorder.TotalDiscount,
                TotalSaleDiscount = mainorder.TotalDiscount,
                TotalVat = mainorder.TotalVat,
            };
            docHeader.DocumentIssuerDetails = "Generated by: " + docHeader.DocumentIssuerUserName + " ; Cost centre: " +
                                             docHeader.DocumentIssuerCCName + "; Date: " +
                                             docHeader.DatePrinted.ToShortDateString();
            docData.DocumentHeader = docHeader;
            int i = 0;
            foreach (var item in mainorder.ItemSummary)
            {
                OrderReportLineItem li = new DocumentLineItem()
                {
                    ApprovedQuantity = item.ApprovedQuantity,
                    BackOrderQuantity = item.BackOrderQuantity,
                    DiscountType = StringUtils.BreakUpperCB(item.Product.GetType().ToString().Split('.').Last()),
                    GrossAmount = item.TotalGross,
                    LineItemTypeStr = item.LineItemType.ToString(),
                    LostSaleQuantity = item.LostSaleQuantity,
                    ProductName = item.Product.Description,
                    Qty = item.Qty,
                    RowNumber = i + 1,
                    TotalNet = item.TotalNet,
                    TotalVat = item.TotalVat,
                    UnitDiscount = item.ProductDiscount,
                    UnitPrice = item.Value,
                    UnitVat = item.VatValue,
                };
                docData.LineItems.Add(li);
                i++;
            }

            return docData;
        }