Ejemplo n.º 1
0
        private void AddReceivingsToSumary(DateTime?fromDate, DateTime?toDate, int currentItem)
        {
            double total = 0;
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceivMainID.ReceivDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceivMainID.ReceivDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }

            theCriteria.Add(new BinaryOperator("ReceivDetItemID", currentItem, BinaryOperatorType.Equal));
            total = Convert.ToDouble(Session.DefaultSession.Evaluate(typeof(ReceivingDetail), CriteriaOperator.Parse("Sum(intUnits)"), CriteriaOperator.And(theCriteria)));

            theCriteria.Clear();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }
            theCriteria.Add(new BinaryOperator("ReturnDetItemID", currentItem, BinaryOperatorType.Equal));
            total += Convert.ToDouble(Session.DefaultSession.Evaluate(typeof(ReceivedReturns), CriteriaOperator.Parse("Sum(ReturnDetQty)"), CriteriaOperator.And(theCriteria)));

            transactionSummary.Received = total;
        }