Exemple #1
0
        private void printLpn()
        {
            int    digits    = CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString().Length;
            XPView lpnXPview = null;
            CriteriaOperatorCollection critaria = new CriteriaOperatorCollection();

            lpnXPview          = new XPView(Session.DefaultSession, typeof(LocationInventoryByLot));
            lpnXPview.Criteria = CriteriaOperator.And(new BinaryOperator("LPNNumber", (object)Utilities.ChangeType <int?>(lpnLookUpEdit.EditValue), BinaryOperatorType.Equal), new BinaryOperator("QuantityOnHand", 0, BinaryOperatorType.Greater));

            lpnXPview.Properties.AddRange(new ViewProperty[]
            {
                new ViewProperty("Item", SortDirection.None, "[LocationInventoryItem.ItemCode]", false, true),
                new ViewProperty("ItemDesc", SortDirection.None, "[LocationInventoryItem.ItemDescription]", false, true),
                new ViewProperty("Allergens", SortDirection.None, "[LocationInventoryItem.Allergens]", false, true),
                new ViewProperty("Qty", SortDirection.None, "[QuantityOnHand]", false, true),
                new ViewProperty("Expr", SortDirection.None, "[ExpirationDate]", false, true),
                new ViewProperty("Lot", SortDirection.None, "[LocationInventoryLot]", false, true),
                new ViewProperty("LPN", SortDirection.Ascending, "[LPNNumber]", false, true)
            });

            LPNLabelsXtraReport labels = new LPNLabelsXtraReport();

            labels.DataSource = lpnXPview;
            labels.lpnGroupHeader.GroupFields.Add(new GroupField("LPN", XRColumnSortOrder.Ascending));
            labels.itemCodeXrLabel.DataBindings.Add("Text", lpnXPview, "Item");
            labels.itemDescXrLabel.DataBindings.Add("Text", lpnXPview, "ItemDesc");
            labels.AllergensXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "Iif(Len(Trim([Allergens]))>0,'Allergens: ' + [Allergens],'Allergens: None')"));
            labels.exprXrLabel.DataBindings.Add("Text", lpnXPview, "Expr", "{0:MM/dd/yyyy}");
            labels.qtyXrLabel.DataBindings.Add("Text", lpnXPview, "Qty");
            labels.lotXrLabel.DataBindings.Add("Text", lpnXPview, "Lot");
            labels.LPNXrBarCode.DataBindings.Add("Text", lpnXPview, "LPN", "SPG{0:D" + digits + "}");
            labels.SumQtyXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "sumSum([Qty])"));
            labels.ReprintXrLabel.Visible = !m_newLpn;
            labels.CreateDocument();
            labels.ShowPreviewDialog();
        }
Exemple #2
0
        private void PrintLpnSimpleButton_Click(object sender, EventArgs e)
        {
            int    digits    = CustomersBLL.GetCustomer(7, m_LocationSession).LastLPNNumber.ToString().Length;
            XPView lpnXPview = null;
            CriteriaOperatorCollection critaria = new CriteriaOperatorCollection();

            lpnXPview = new XPView(m_LocationSession, typeof(LocationInventoryByLot));


            if (inventoryByLotGridView.GroupCount > 0)
            {
                int i = -1;
                while (inventoryByLotGridView.IsValidRowHandle(i))
                {
                    if (inventoryByLotGridView.GetChildRowHandle(i, 0) > -1)
                    {
//INSTANT C# NOTE: The ending condition of VB 'For' loops is tested only on entry to the loop. Instant C# has created a temporary variable in order to use the initial value of inventoryByLotGridView.GetChildRowCount(i) + inventoryByLotGridView.GetChildRowHandle(i, 0) for every iteration:
                        int tempVar = inventoryByLotGridView.GetChildRowCount(i) + inventoryByLotGridView.GetChildRowHandle(i, 0);
                        for (int ci = inventoryByLotGridView.GetChildRowHandle(i, 0); ci < tempVar; ci++)
                        {
                            if (inventoryByLotGridView.IsRowVisible(ci) == RowVisibleState.Visible)
                            {
                                int?   lpn = Utilities.ChangeType <int?>(inventoryByLotGridView.GetRowCellValue(ci, colLPNNumber));
                                string lot = inventoryByLotGridView.GetRowCellValue(ci, colLot).ToString();
                                if (lpn.HasValue && lot.Length > 0)
                                {
                                    critaria.Add(new GroupOperator(GroupOperatorType.And, new BinaryOperator("LPNNumber", lpn.Value, BinaryOperatorType.Equal), new BinaryOperator("LocationInventoryLot", lot, BinaryOperatorType.Equal)));
                                }
                            }
                        }
                    }
                    i -= 1;
                }
            }
            else
            {
                for (int ci = 0; ci < inventoryByLotGridView.RowCount; ci++)
                {
                    if (inventoryByLotGridView.IsRowVisible(ci) == RowVisibleState.Visible)
                    {
                        int?   lpn = Utilities.ChangeType <int?>(inventoryByLotGridView.GetRowCellValue(ci, colLPNNumber));
                        string lot = inventoryByLotGridView.GetRowCellValue(ci, colLot).ToString();
                        if (lpn.HasValue && lot.Length > 0)
                        {
                            critaria.Add(new GroupOperator(GroupOperatorType.And, new BinaryOperator("LPNNumber", lpn.Value, BinaryOperatorType.Equal), new BinaryOperator("LocationInventoryLot", lot, BinaryOperatorType.Equal)));
                        }
                    }
                }
            }

            lpnXPview.Criteria = CriteriaOperator.Or(critaria);

            lpnXPview.Properties.AddRange(new ViewProperty[]
            {
                new ViewProperty("Item", SortDirection.None, "[LocationInventoryItem.ItemCode]", false, true),
                new ViewProperty("ItemDesc", SortDirection.None, "[LocationInventoryItem.ItemDescription]", false, true),
                new ViewProperty("Allergens", SortDirection.None, "[LocationInventoryItem.Allergens]", false, true),
                new ViewProperty("Qty", SortDirection.None, "[QuantityOnHand]", false, true),
                new ViewProperty("Expr", SortDirection.None, "[ExpirationDate]", false, true),
                new ViewProperty("Lot", SortDirection.None, "[LocationInventoryLot]", false, true),
                new ViewProperty("LPN", SortDirection.Ascending, "[LPNNumber]", false, true)
            });

            LPNLabelsXtraReport labels = new LPNLabelsXtraReport();

            labels.DataSource = lpnXPview;
            labels.lpnGroupHeader.GroupFields.Add(new GroupField("LPN", XRColumnSortOrder.Ascending));
            labels.itemCodeXrLabel.DataBindings.Add("Text", lpnXPview, "Item");
            labels.itemDescXrLabel.DataBindings.Add("Text", lpnXPview, "ItemDesc");
            labels.AllergensXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "Iif(Len(Trim([Allergens]))>0,'Allergens: ' + [Allergens],'Allergens: None')"));
            labels.exprXrLabel.DataBindings.Add("Text", lpnXPview, "Expr", "{0:MM/dd/yyyy}");
            labels.qtyXrLabel.DataBindings.Add("Text", lpnXPview, "Qty");
            labels.lotXrLabel.DataBindings.Add("Text", lpnXPview, "Lot");
            labels.LPNXrBarCode.DataBindings.Add("Text", lpnXPview, "LPN", "SPG{0:D" + digits + "}");
            labels.SumQtyXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "sumSum([Qty])"));
            labels.ReprintXrLabel.Visible = true;
            labels.CreateDocument();
            labels.ShowPreviewDialog();
        }