protected static FR_L5CO_GPDfH_1052 Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_L5CO_GPDfH_1052();
            returnValue.Result = new L5CO_GPDfH_1052();
            //Put your code here

            List <Guid>             orderHeadersForTenant   = new List <Guid>();
            List <L5CO_GCOWAD_1330> listOfOrdersWithDetails = new List <L5CO_GCOWAD_1330>();
            var orderHeadersQuery = new ORM_ORD_CUO_CustomerOrder_Header.Query();
            orderHeadersQuery.Tenant_RefID = securityTicket.TenantID;
            var foundOrderHeaders = ORM_ORD_CUO_CustomerOrder_Header.Query.Search(Connection, Transaction, orderHeadersQuery);

            foreach (var orderHeader in foundOrderHeaders)
            {
                var orderWithDetails      = new L5CO_GCOWAD_1330();
                var orderWithDetailsQuery = new P_L5CO_GCOWAD_1330();
                orderWithDetailsQuery.OrderHeaderID = orderHeader.ORD_CUO_CustomerOrder_HeaderID;
                orderWithDetails = cls_Get_CustomerOrder_With_AllDetails.Invoke(Connection, Transaction, orderWithDetailsQuery, securityTicket).Result;

                listOfOrdersWithDetails.Add(orderWithDetails);
            }

            returnValue.Result.CustomerOrdersWithDetails = listOfOrdersWithDetails.ToArray();

            return(returnValue);

            #endregion UserCode
        }
Ejemplo n.º 2
0
        protected static FR_L5CO_RCO_2302_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5CO_RCO_2302[] Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5CO_RCO_2302_Array();
            List <L5CO_RCO_2302> rejectedOrders = new List <L5CO_RCO_2302>();
            foreach (var param in Parameter)
            {
                L5CO_RCO_2302 rejectedProcurementOrder = new L5CO_RCO_2302();
                var           orderedStatusID          = ORM_ORD_CUO_CustomerOrder_Status.Query.Search(Connection, Transaction,
                                                                                                       new ORM_ORD_CUO_CustomerOrder_Status.Query
                {
                    GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(ECustomerOrderStatus.Rejected),
                    Tenant_RefID             = securityTicket.TenantID,
                    IsDeleted = false
                }).SingleOrDefault().ORD_CUO_CustomerOrder_StatusID;

                var customerOrderQuery = new ORM_ORD_CUO_CustomerOrder_Header.Query();
                customerOrderQuery.ORD_CUO_CustomerOrder_HeaderID = param.CustomerOrderHeaderID;
                customerOrderQuery.Tenant_RefID = securityTicket.TenantID;
                var foundCustomerOrder = ORM_ORD_CUO_CustomerOrder_Header.Query.Search(Connection, Transaction, customerOrderQuery).SingleOrDefault();

                foundCustomerOrder.Current_CustomerOrderStatus_RefID = orderedStatusID;
                foundCustomerOrder.IsCustomerOrderFinalized          = true;
                foundCustomerOrder.Save(Connection, Transaction);
                ORM_USR_Account account = new ORM_USR_Account();
                account.Load(Connection, Transaction, securityTicket.AccountID);

                ORM_ORD_CUO_CustomerOrder_StatusHistory newStatusInHistory = new ORM_ORD_CUO_CustomerOrder_StatusHistory();
                newStatusInHistory.CustomerOrder_Header_RefID = foundCustomerOrder.ORD_CUO_CustomerOrder_HeaderID;
                newStatusInHistory.StatusHistoryComment       = param.Message;
                newStatusInHistory.Tenant_RefID = securityTicket.TenantID;
                newStatusInHistory.CustomerOrder_Status_RefID            = orderedStatusID;
                newStatusInHistory.PerformedBy_BusinessParticipant_RefID = account.BusinessParticipant_RefID;

                //saving new status in history and customer order header
                newStatusInHistory.Save(Connection, Transaction);
                rejectedProcurementOrder.ProcurementOrderITL = foundCustomerOrder.ProcurementOrderITL;
                rejectedProcurementOrder.ProcuringTenatID    = foundCustomerOrder.OrderingCustomer_BusinessParticipant_RefID.ToString();
                rejectedProcurementOrder.Message             = param.Message;
                rejectedOrders.Add(rejectedProcurementOrder);
            }
            returnValue.Result = rejectedOrders.ToArray();
            //Put your code here
            return(returnValue);

            #endregion UserCode
        }
Ejemplo n.º 3
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3CO_RO_1101 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here
            var orderedStatusID = ORM_ORD_CUO_CustomerOrder_Status.Query.Search(Connection, Transaction,
                                                                                new ORM_ORD_CUO_CustomerOrder_Status.Query
            {
                GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(ECustomerOrderStatus.Rejected),
                Tenant_RefID             = securityTicket.TenantID,
                IsDeleted = false
            }).SingleOrDefault().ORD_CUO_CustomerOrder_StatusID;

            var customerOrderQuery = new ORM_ORD_CUO_CustomerOrder_Header.Query();
            customerOrderQuery.ORD_CUO_CustomerOrder_HeaderID = Parameter.CustomerOrderHeaderID;
            customerOrderQuery.Tenant_RefID = securityTicket.TenantID;
            var foundCustomerOrder = ORM_ORD_CUO_CustomerOrder_Header.Query.Search(Connection, Transaction, customerOrderQuery).SingleOrDefault();

            foundCustomerOrder.Current_CustomerOrderStatus_RefID = orderedStatusID;
            foundCustomerOrder.IsCustomerOrderFinalized          = true;

            ORM_USR_Account account = new ORM_USR_Account();
            account.Load(Connection, Transaction, securityTicket.AccountID);

            ORM_ORD_CUO_CustomerOrder_StatusHistory newStatusInHistory = new ORM_ORD_CUO_CustomerOrder_StatusHistory();
            newStatusInHistory.CustomerOrder_Header_RefID = foundCustomerOrder.ORD_CUO_CustomerOrder_HeaderID;
            newStatusInHistory.StatusHistoryComment       = Parameter.Message;
            newStatusInHistory.Tenant_RefID = securityTicket.TenantID;
            newStatusInHistory.CustomerOrder_Status_RefID            = orderedStatusID;
            newStatusInHistory.PerformedBy_BusinessParticipant_RefID = account.BusinessParticipant_RefID;

            //saving new status in history and customer order header
            newStatusInHistory.Save(Connection, Transaction);
            returnValue.Result = new FR_Guid(foundCustomerOrder.Save(Connection, Transaction), foundCustomerOrder.ORD_CUO_CustomerOrder_HeaderID).Result;

            return(returnValue);

            #endregion UserCode
        }
Ejemplo n.º 4
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6TR_SOHaS1434 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            //* Array TreatmentID and ArticleID are the sam lenght; Treatment with position i has article with the position i

            var           count         = 0;
            List <Orders> orderList     = new List <Orders>();
            int           ordinalNumber = 0;
            Guid          headerID      = Guid.Empty;

            for (int g = 0; g < Parameter.HEC_Patient_TreatmentID.Length; g++)
            {
                #region Save Order

                var status_query = new ORM_ORD_CUO_CustomerOrder_Status.Query();
                status_query.IsDeleted                = false;
                status_query.Tenant_RefID             = securityTicket.TenantID;
                status_query.GlobalPropertyMatchingID = STLD_ORD_CUO_CustomerOrder_Status.Ordered.ToString();
                var notOrderedstatus = ORM_ORD_CUO_CustomerOrder_Status.Query.Search(Connection, Transaction, status_query).First();


                // za ispraviti sto pre
                #region
                var prod_param = new P_L6PD_GPaCOSfT_1120();
                prod_param.TreatmentID = Parameter.HEC_Patient_TreatmentID[g];
                var products = cls_Get_Products_and_CustomerOrderStatuses_for_TreatmentID.Invoke(Connection, Transaction, prod_param, securityTicket).Result;


                var notOrdered_Products = products.Where(i => i.CMN_PRO_ProductID == Guid.Empty);
                #endregion

                if (notOrdered_Products.Count() == 0)
                {
                    return(returnValue);
                }

                #region Save Header and Status

                var header_query = new ORM_ORD_CUO_CustomerOrder_Header.Query();
                header_query.IsDeleted    = false;
                header_query.Tenant_RefID = securityTicket.TenantID;
                var headers = ORM_ORD_CUO_CustomerOrder_Header.Query.Search(Connection, Transaction, header_query);



                if (headers != null)
                {
                    count = headers.Count();
                }

                String ordernumber = String.Empty;
                var    orderFound  = orderList.Where(c => c.TreatmentID == Parameter.HEC_Patient_TreatmentID[g]).FirstOrDefault();

                if (orderFound == null)
                {
                    ordernumber = "000000000000" + (count + 1).ToString();
                    ordernumber = ordernumber.Substring(ordernumber.Length - 12);



                    var header = new ORM_ORD_CUO_CustomerOrder_Header();
                    headerID = Guid.NewGuid();
                    header.ORD_CUO_CustomerOrder_HeaderID    = headerID;
                    header.Current_CustomerOrderStatus_RefID = notOrderedstatus.ORD_CUO_CustomerOrder_StatusID;
                    header.CustomerOrder_Number = ordernumber;
                    header.CustomerOrder_Date   = DateTime.Now;
                    header.Creation_Timestamp   = DateTime.Now;
                    header.Tenant_RefID         = securityTicket.TenantID;
                    header.Save(Connection, Transaction);

                    var history = new ORM_ORD_CUO_CustomerOrder_StatusHistory();
                    history.ORD_CUO_CustomerOrder_StatusHistoryID = Guid.NewGuid();
                    history.CustomerOrder_Header_RefID            = header.ORD_CUO_CustomerOrder_HeaderID;
                    history.CustomerOrder_Status_RefID            = notOrderedstatus.ORD_CUO_CustomerOrder_StatusID;
                    history.StatusHistoryComment = "";
                    history.Creation_Timestamp   = DateTime.Now;
                    history.Tenant_RefID         = securityTicket.TenantID;
                    history.Save(Connection, Transaction);


                    Orders ord = new Orders();
                    ord.TreatmentID   = Parameter.HEC_Patient_TreatmentID[g];
                    ord.Ordernumber   = ordernumber;
                    ord.OrdinalNumber = 0;
                    ord.headerID      = headerID;
                    orderList.Add(ord);
                    ordinalNumber = 0;
                }
                else
                {
                    ordernumber   = orderFound.Ordernumber;
                    ordinalNumber = orderFound.OrdinalNumber + 1;
                    headerID      = orderFound.headerID;
                }
                #endregion



                var product = notOrdered_Products.Where(t => t.CMN_PRO_ProductID == Parameter.AtricleID[g]).FirstOrDefault();


                var position = new ORM_ORD_CUO_CustomerOrder_Position();
                position.ORD_CUO_CustomerOrder_PositionID = Guid.NewGuid();
                position.CustomerOrder_Header_RefID       = headerID;
                position.Position_OrdinalNumber           = ordinalNumber;
                position.Position_Quantity                = product.Quantity;
                position.Position_ValuePerUnit            = 1;
                position.Position_ValueTotal              = (decimal)product.Quantity;
                position.CMN_PRO_Product_Variant_RefID    = Guid.Empty;
                position.CMN_PRO_Product_RefID            = product.CMN_PRO_ProductID;
                position.CMN_PRO_Product_Release_RefID    = Guid.Empty;
                position.Position_RequestedDateOfDelivery = product.ExpectedDateOfDelivery;
                position.Creation_Timestamp               = DateTime.Now;
                position.Tenant_RefID = securityTicket.TenantID;
                position.Save(Connection, Transaction);


                var item = new ORM_HEC_Patient_Treatment_RequiredProduct();
                item.Load(Connection, Transaction, product.HEC_Patient_Treatment_RequiredProductID);
                item.BoundTo_CustomerOrderPosition_RefID = position.ORD_CUO_CustomerOrder_PositionID;
                item.Save(Connection, Transaction);



                #endregion
            }

            return(returnValue);

            #endregion UserCode
        }
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6TR_SPTaO_1014 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            #region Save Treatment

            var param = new P_L6TR_SPT_1533();
            param.Aticles   = Parameter.Aticles;
            param.Diagnosis = Parameter.Diagnosis;
            param.Treatment = Parameter.Treatment;
            param.Followups = Parameter.Followups;
            var TreatmentID = cls_Save_Patient_Treatment.Invoke(Connection, Transaction, param, securityTicket).Result;

            returnValue.Result = TreatmentID;
            #endregion

            #region Save Order

            var status_query = new ORM_ORD_CUO_CustomerOrder_Status.Query();
            status_query.IsDeleted                = false;
            status_query.Tenant_RefID             = securityTicket.TenantID;
            status_query.GlobalPropertyMatchingID = STLD_ORD_CUO_CustomerOrder_Status.Ordered.ToString();
            var notOrderedstatus = ORM_ORD_CUO_CustomerOrder_Status.Query.Search(Connection, Transaction, status_query).First();

            var prod_param = new P_L6PD_GPaCOSfT_1120();
            prod_param.TreatmentID = TreatmentID;
            var products = cls_Get_Products_and_CustomerOrderStatuses_for_TreatmentID.Invoke(Connection, Transaction, prod_param, securityTicket).Result;

            var notOrdered_Products = products.Where(i => i.ORD_CUO_CustomerOrder_PositionID == Guid.Empty);

            if (notOrdered_Products.Count() == 0)
            {
                return(returnValue);
            }

            #region Save Header and Status

            var header_query = new ORM_ORD_CUO_CustomerOrder_Header.Query();
            header_query.IsDeleted    = false;
            header_query.Tenant_RefID = securityTicket.TenantID;
            var headers = ORM_ORD_CUO_CustomerOrder_Header.Query.Search(Connection, Transaction, header_query);

            var count = 0;
            if (headers != null)
            {
                count = headers.Count();
            }

            String ordernumber = "000000000000" + (count + 1).ToString();
            ordernumber = ordernumber.Substring(ordernumber.Length - 12);

            var header = new ORM_ORD_CUO_CustomerOrder_Header();
            header.ORD_CUO_CustomerOrder_HeaderID    = Guid.NewGuid();
            header.Current_CustomerOrderStatus_RefID = notOrderedstatus.ORD_CUO_CustomerOrder_StatusID;
            header.CustomerOrder_Number = ordernumber;
            header.CustomerOrder_Date   = DateTime.Now;
            header.Creation_Timestamp   = DateTime.Now;
            header.Tenant_RefID         = securityTicket.TenantID;
            header.Save(Connection, Transaction);

            var history = new ORM_ORD_CUO_CustomerOrder_StatusHistory();
            history.ORD_CUO_CustomerOrder_StatusHistoryID = Guid.NewGuid();
            history.CustomerOrder_Header_RefID            = header.ORD_CUO_CustomerOrder_HeaderID;
            history.CustomerOrder_Status_RefID            = notOrderedstatus.ORD_CUO_CustomerOrder_StatusID;
            history.StatusHistoryComment = "";
            history.Creation_Timestamp   = DateTime.Now;
            history.Tenant_RefID         = securityTicket.TenantID;
            history.Save(Connection, Transaction);

            #endregion

            int cnt = 0;
            foreach (var product in notOrdered_Products)
            {
                cnt++;

                var position = new ORM_ORD_CUO_CustomerOrder_Position();
                position.ORD_CUO_CustomerOrder_PositionID = Guid.NewGuid();
                position.CustomerOrder_Header_RefID       = header.ORD_CUO_CustomerOrder_HeaderID;
                position.Position_OrdinalNumber           = cnt;
                position.Position_Quantity                = product.Quantity;
                position.Position_ValuePerUnit            = 1;
                position.Position_ValueTotal              = (decimal)product.Quantity;
                position.CMN_PRO_Product_Variant_RefID    = Guid.Empty;
                position.CMN_PRO_Product_RefID            = product.CMN_PRO_ProductID;
                position.CMN_PRO_Product_Release_RefID    = Guid.Empty;
                position.Position_RequestedDateOfDelivery = product.ExpectedDateOfDelivery;
                position.Creation_Timestamp               = DateTime.Now;
                position.Tenant_RefID = securityTicket.TenantID;
                position.Save(Connection, Transaction);


                var item = new ORM_HEC_Patient_Treatment_RequiredProduct();
                item.Load(Connection, Transaction, product.HEC_Patient_Treatment_RequiredProductID);
                item.BoundTo_CustomerOrderPosition_RefID = position.ORD_CUO_CustomerOrder_PositionID;
                item.Save(Connection, Transaction);
            }

            #endregion

            return(returnValue);

            #endregion UserCode
        }
Ejemplo n.º 6
0
        protected static FR_L5PP_GSHwCOfPfT_1348_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5PP_GSHwCOfPfT_1348 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5PP_GSHwCOfPfT_1348_Array();

            //Put your code here
            List <L5PP_GSHwCOfPfT_1348> retVal = new List <L5PP_GSHwCOfPfT_1348>();
            returnValue.Result = retVal.ToArray();

            #region Retrieve Headers

            // get all headers
            P_L2SH_GSHfT_1527 shipmentHeadersParam = new P_L2SH_GSHfT_1527();
            shipmentHeadersParam.IsShipped                = false;
            shipmentHeadersParam.ShipmentNumber           = Parameter.ShipmentNumber;
            shipmentHeadersParam.ShipmentCreationDateFrom = Parameter.ShipmentCreationDateFrom;
            shipmentHeadersParam.ShipmentCreationDateTo   = Parameter.ShipmentCreationDateTo;
            var headersResult = cls_Get_ShippmentHeaders_for_TenantID.Invoke(Connection, Transaction, shipmentHeadersParam, securityTicket).Result;

            if (headersResult == null)
            {
                return(returnValue);
            }

            // filter headers
            List <L2SH_GSHfT_1527> headers     = new List <L2SH_GSHfT_1527>();
            List <L2SH_GSHfT_1527> tempHeaders = new List <L2SH_GSHfT_1527>();
            if (Parameter.HasPositionsPartiallyToPick)
            {
                // filtered by passed parameter option
                tempHeaders = headersResult.Where(i => i.IsPartiallyReadyForPicking && !i.IsManuallyCleared_ForPicking).ToList();
                // add not inserted shipment headers
                headers.AddRange(tempHeaders.Where(i => !headers.Any(j => j.LOG_SHP_Shipment_HeaderID == i.LOG_SHP_Shipment_HeaderID)).ToList());
            }

            if (Parameter.IsReadyForPicking)
            {
                // filtered by passed parameter option
                tempHeaders = headersResult.Where(i => i.IsReadyForPicking && !i.IsManuallyCleared_ForPicking).ToList();
                // add not inserted shipment headers
                headers.AddRange(tempHeaders.Where(i => !headers.Any(j => j.LOG_SHP_Shipment_HeaderID == i.LOG_SHP_Shipment_HeaderID)).ToList());
            }

            if (Parameter.IsInPickingProcess)
            {
                // filtered by passed parameter option
                tempHeaders = headersResult.Where(i => i.HasPickingStarted || i.HasPickingFinished || i.IsManuallyCleared_ForPicking).ToList();
                // add not inserted shipment headers
                headers.AddRange(tempHeaders.Where(i => !headers.Any(j => j.LOG_SHP_Shipment_HeaderID == i.LOG_SHP_Shipment_HeaderID)).ToList());
            }

            if (Parameter.NoPositionsFullyToPick)
            {
                // filtered by passed parameter option
                tempHeaders = headersResult.Where(i =>
                                                  !(i.IsPartiallyReadyForPicking && !i.IsManuallyCleared_ForPicking) &&
                                                  !(i.IsReadyForPicking && !i.IsManuallyCleared_ForPicking) &&
                                                  !(i.HasPickingStarted || i.HasPickingFinished || i.IsManuallyCleared_ForPicking)
                                                  ).ToList();
                // add not inserted shipment headers
                headers.AddRange(tempHeaders.Where(i => !headers.Any(j => j.LOG_SHP_Shipment_HeaderID == i.LOG_SHP_Shipment_HeaderID)).ToList());
            }

            #endregion

            L5PP_GSHwCOfPfT_1348 retValItem;
            foreach (var header in headers)
            {
                #region Getting data

                #region Shipment positions
                // get one shipment position for shipment header
                ORM_LOG_SHP_Shipment_Position.Query shipmentPositionsQuery = new ORM_LOG_SHP_Shipment_Position.Query();
                shipmentPositionsQuery.LOG_SHP_Shipment_Header_RefID = header.LOG_SHP_Shipment_HeaderID;
                shipmentPositionsQuery.Tenant_RefID = securityTicket.TenantID;
                shipmentPositionsQuery.IsDeleted    = false;
                List <ORM_LOG_SHP_Shipment_Position> shipmentPositions = ORM_LOG_SHP_Shipment_Position.Query.Search(Connection, Transaction, shipmentPositionsQuery);

                if (shipmentPositions == null || shipmentPositions.Count == 0)
                {
                    continue;
                }
                #endregion

                #region Customer order position for shipment position
                // get one customer order position for shipment position
                ORM_ORD_CUO_CustomerOrder_Position_2_ShipmentPosition customerOrder2ShipmentPosition = null;
                foreach (var shipmentPosition in shipmentPositions)
                {
                    ORM_ORD_CUO_CustomerOrder_Position_2_ShipmentPosition.Query customerOrder2ShipmentPositionQuery = new ORM_ORD_CUO_CustomerOrder_Position_2_ShipmentPosition.Query();
                    customerOrder2ShipmentPositionQuery.LOG_SHP_Shipment_Position_RefID = shipmentPosition.LOG_SHP_Shipment_PositionID;
                    customerOrder2ShipmentPositionQuery.Tenant_RefID = securityTicket.TenantID;
                    customerOrder2ShipmentPositionQuery.IsDeleted    = false;
                    customerOrder2ShipmentPosition =
                        ORM_ORD_CUO_CustomerOrder_Position_2_ShipmentPosition.Query
                        .Search(Connection, Transaction, customerOrder2ShipmentPositionQuery).FirstOrDefault();

                    if (customerOrder2ShipmentPosition != null)
                    {
                        break;
                    }
                }

                if (customerOrder2ShipmentPosition == null)
                {
                    continue;
                }
                #endregion

                #region Customer order position
                ORM_ORD_CUO_CustomerOrder_Position orm_CustomerOrderPosition = new ORM_ORD_CUO_CustomerOrder_Position();
                var distributionOrderPosition = orm_CustomerOrderPosition.Load(Connection, Transaction, customerOrder2ShipmentPosition.ORD_CUO_CustomerOrder_Position_RefID);
                if (distributionOrderPosition.Status != FR_Status.Success || orm_CustomerOrderPosition.ORD_CUO_CustomerOrder_PositionID == Guid.Empty)
                {
                    continue;
                }
                #endregion

                #region Customer order header
                // get customer order header for customer order position
                ORM_ORD_CUO_CustomerOrder_Header.Query customerOrderHeaderQuery = new ORM_ORD_CUO_CustomerOrder_Header.Query();
                customerOrderHeaderQuery.ORD_CUO_CustomerOrder_HeaderID = orm_CustomerOrderPosition.CustomerOrder_Header_RefID;
                customerOrderHeaderQuery.Tenant_RefID = securityTicket.TenantID;
                customerOrderHeaderQuery.IsDeleted    = false;
                if (!String.IsNullOrEmpty(Parameter.CustomerOrderNumber))
                {
                    customerOrderHeaderQuery.CustomerOrder_Number = Parameter.CustomerOrderNumber;
                }

                ORM_ORD_CUO_CustomerOrder_Header customerOrderHeader = ORM_ORD_CUO_CustomerOrder_Header.Query.Search(Connection, Transaction, customerOrderHeaderQuery).FirstOrDefault();
                if (customerOrderHeader == null)
                {
                    continue;
                }

                // apply filter for customer order header
                if (Parameter.OrderDateFrom != null)
                {
                    if (customerOrderHeader.CustomerOrder_Date < Parameter.OrderDateFrom)
                    {
                        continue;
                    }
                }

                if (Parameter.OrderDateTo != null)
                {
                    if (customerOrderHeader.CustomerOrder_Date > Parameter.OrderDateTo)
                    {
                        continue;
                    }
                }
                #endregion

                #region Customer
                ORM_CMN_BPT_BusinessParticipant.Query bussinerParticipantQuery = new ORM_CMN_BPT_BusinessParticipant.Query();
                bussinerParticipantQuery.CMN_BPT_BusinessParticipantID = customerOrderHeader.OrderingCustomer_BusinessParticipant_RefID;
                bussinerParticipantQuery.Tenant_RefID = securityTicket.TenantID;
                bussinerParticipantQuery.IsDeleted    = false;

                ORM_CMN_BPT_BusinessParticipant bussinerParticipant = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, bussinerParticipantQuery).FirstOrDefault();

                if (bussinerParticipant == null)
                {
                    continue;
                }

                if (!String.IsNullOrEmpty(Parameter.Customer))
                {
                    if (!bussinerParticipant.DisplayName.ToUpper().Contains(Parameter.Customer.ToUpper()))
                    {
                        continue;
                    }
                }
                #endregion

                #endregion

                retValItem = new L5PP_GSHwCOfPfT_1348();
                retValItem.LOG_SHP_Shipment_HeaderID = header.LOG_SHP_Shipment_HeaderID;
                retValItem.ShipmentHeader_Number     = header.ShipmentHeader_Number;
                retValItem.IsShipped                    = header.IsShipped;
                retValItem.IsBilled                     = header.IsBilled;
                retValItem.IsReadyForPicking            = header.IsReadyForPicking;
                retValItem.IsPartiallyReadyForPicking   = header.IsPartiallyReadyForPicking;
                retValItem.HasPickingStarted            = header.HasPickingStarted;
                retValItem.HasPickingFinished           = header.HasPickingFinished;
                retValItem.IsManuallyCleared_ForPicking = header.IsManuallyCleared_ForPicking;
                retValItem.ShipmentCreationDate         = header.Creation_Timestamp;

                retValItem.ORD_CUO_CustomerOrder_HeaderID = customerOrderHeader.ORD_CUO_CustomerOrder_HeaderID;
                retValItem.CustomerOrderNumber            = customerOrderHeader.CustomerOrder_Number;
                retValItem.CustomerOrderDate = customerOrderHeader.CustomerOrder_Date;

                retValItem.Customer = bussinerParticipant.DisplayName;

                retVal.Add(retValItem);
            }

            retVal = retVal.Skip(Parameter.From).Take(Parameter.Size).ToList();

            returnValue.Result = retVal.ToArray();

            return(returnValue);

            #endregion UserCode
        }