Esempio n. 1
0
 public Model.SalesOrderItem GetSOItem(int soId)
 {
     Model.SalesOrderItem item = (from soItem in _repository.GetQuery <Model.SalesOrderItem>().Include("Item")
                                  where soItem.SalesOrder.ID == soId && soItem.Active_Ind == true
                                  select soItem).FirstOrDefault();
     return(item);
 }
Esempio n. 2
0
        public IEnumerable <ViewModel.InvoiceItem> GetInvoiceItems(IEnumerable <Model.Container> containers)
        {
            List <ViewModel.InvoiceItem> busEnumeration = new List <ViewModel.InvoiceItem>();

            if (containers.Count() == 0)
            {
                return(busEnumeration);
            }
            Model.SalesOrderItem soItem = GetSOItem(containers.FirstOrDefault().Booking.Sales_Order_No.ID);
            if (soItem != null && soItem.Item != null)
            {
                foreach (var container in containers)
                {
                    ViewModel.InvoiceItem busEntity = new VModel.InvoiceItem();

                    busEntity.Container_No          = container.Container_No;
                    busEntity.Item_Name             = soItem.Item.Short_Name;
                    busEntity.Seal_No               = container.Seal1_No;
                    busEntity.Net_Weight            = container.Net_Weight;
                    busEntity.Price                 = soItem != null ? soItem.Price : 0;
                    busEntity.UOM_SO                = soItem != null && !string.IsNullOrWhiteSpace(soItem.Item_UOM) ? soItem.Item_UOM : "LBS";
                    busEntity.SO_Item_UOM_NetWeight = GetSOItemUOMWeight(container, busEntity.UOM_SO);
                    busEntity.Total                 = decimal.Round(busEntity.Price * busEntity.SO_Item_UOM_NetWeight, 2, MidpointRounding.AwayFromZero);
                    busEnumeration.Add(busEntity);
                }
            }
            return(busEnumeration);
        }
Esempio n. 3
0
        public Model.SalesOrderItem GetScaleSOItem(int soId, Model.ScaleDetails scaleDetails)
        {
            if (scaleDetails == null || scaleDetails.Apply_To_Item == null)
            {
                return(new Model.SalesOrderItem());
            }

            Model.SalesOrderItem item = (from soItem in _repository.GetQuery <Model.SalesOrderItem>()
                                         where soItem.SalesOrder.ID == soId &&
                                         soItem.Item.ID == scaleDetails.Apply_To_Item.ID
                                         select soItem).FirstOrDefault();
            return(item);
        }
Esempio n. 4
0
        private decimal GetConvertedSOUOMNetWeight(VModel.Scale scale, int soID)
        {
            IEnumerable <Model.ScaleDetails> scaleDetails = _repository.Find <Model.ScaleDetails>(o => o.Scale.ID == scale.ID, new string[] { "Scale", "Item_Received", "Apply_To_Item" });
            decimal UOMNetWeight = 0;

            foreach (var item in scaleDetails)
            {
                Model.SalesOrderItem soScaleItem = GetScaleSOItem(soID, item);
                string uom = soScaleItem != null && !string.IsNullOrWhiteSpace(soScaleItem.Item_UOM) ? soScaleItem.Item_UOM : "LBS";
                UOMNetWeight += GetConvertedUOMWeight(item.NetWeight, uom);
            }
            return(UOMNetWeight);
        }
Esempio n. 5
0
        public IEnumerable <ViewModel.InvoiceLocalSales> GetInvoiceItems(IEnumerable <Model.ScaleDetails> scaleDetails)
        {
            List <ViewModel.InvoiceLocalSales> busEnumeration = new List <ViewModel.InvoiceLocalSales>();

            foreach (var item in scaleDetails)
            {
                Model.SalesOrderItem soScaleItem = GetScaleSOItem(item.Scale.Sales_Order.ID, item);

                ViewModel.InvoiceLocalSales busEntity = new VModel.InvoiceLocalSales();
                busEntity.Ticket_No             = item.Scale.ID;
                busEntity.Item_Name             = item.Apply_To_Item.Short_Name;
                busEntity.Net_Weight            = item.NetWeight;
                busEntity.Price                 = soScaleItem != null ? soScaleItem.Price : 0;
                busEntity.UOM_SO                = soScaleItem != null && !string.IsNullOrWhiteSpace(soScaleItem.Item_UOM) ? soScaleItem.Item_UOM : "LBS";
                busEntity.SO_Item_UOM_NetWeight = GetSOItemUOMWeight(item, busEntity.UOM_SO);
                busEntity.Total                 = decimal.Round(busEntity.Price * busEntity.SO_Item_UOM_NetWeight, 2, MidpointRounding.AwayFromZero);
                busEnumeration.Add(busEntity);
            }
            return(busEnumeration);
        }
Esempio n. 6
0
        public IEnumerable <ViewModel.InvoiceItem> GetInvoiceItems(IEnumerable <Model.ScaleDetails> scaleDetails)
        {
            List <ViewModel.InvoiceItem> busEnumeration = new List <ViewModel.InvoiceItem>();

            foreach (var scaleDetail in scaleDetails)
            {
                ViewModel.InvoiceItem busEntity = new VModel.InvoiceItem();

                Model.SalesOrderItem soScaleItem = GetScaleSOItem(scaleDetail.Scale.Container_No.Booking.Sales_Order_No.ID, scaleDetail);

                busEntity.Container_No          = scaleDetail.Scale.Container_No.Container_No;
                busEntity.Item_Name             = scaleDetail.Apply_To_Item.Short_Name;
                busEntity.Seal_No               = scaleDetail.Scale.Seal_No;
                busEntity.Net_Weight            = scaleDetail.NetWeight;
                busEntity.Price                 = soScaleItem != null ? soScaleItem.Price : 0;
                busEntity.UOM_SO                = soScaleItem != null && !string.IsNullOrWhiteSpace(soScaleItem.Item_UOM) ? soScaleItem.Item_UOM : "LBS";
                busEntity.SO_Item_UOM_NetWeight = GetSOItemUOMWeight(scaleDetail, busEntity.UOM_SO);
                busEntity.Total                 = decimal.Round(busEntity.Price * busEntity.SO_Item_UOM_NetWeight, 2, MidpointRounding.AwayFromZero);
                busEnumeration.Add(busEntity);
            }
            return(busEnumeration);
        }