Click here to Skip to main content
16,020,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
why Barcode Printer print only one label.
OS : Windows 10

my code :
i use this function to get all the items data in the invoice and its quantity, then i collect together into a List
private void printAllItems()
        {
            list.Clear();
            if (InvoiceIDinput.EditValue == null || InvoiceIDinput.EditValue.ToString() == "") return;
            int invoiceID = Convert.ToInt32(InvoiceIDinput.EditValue);
            if (invoiceID == 0) return;


            mrsalesdbEntities db01 = ConnectionTools.OpenConn();
            var ditems = db01.purchases_item.Where(u => u.pmain_ID == invoiceID).ToList();

            foreach (var item in ditems)
            {
                int itemID = item.stitems_ID.Value;

                var items = db01.view_items_barcode.Where(u => u.stitems_ID == itemID).Select(s => new CLSBarcode
                {
                    company_name = BasicVars.CompanyName,
                    mobile1 = BasicVars.BrMobile1,
                    mobile2 = BasicVars.BrMobile2,
                    mobile3 = BasicVars.BrMobile3,
                    adrress = BasicVars.BrAdrress,
                    country = BasicVars.BrCountry,
                    city = BasicVars.BrCity,
                    Email = BasicVars.Email,
                    stitems_ID = s.stitems_ID,
                    stitems_Status = s.stitems_Status,
                    stitems_Name = s.stitems_Name,
                    stitems_Code = s.stitems_Code,
                    catID = s.stcate_ID,
                    cat_name = s.stcate_Name,
                    unitID = s.stitemsu_ID,
                    salesprice = DbFunctions.Truncate(s.stitemsu_SalesPrice, BasicVars.CurrencyPart),
                    salespriceST = DbFunctions.Truncate(s.stitemsu_SalesPrice, BasicVars.CurrencyPart).ToString(),
                    salesdiscount = DbFunctions.Truncate(s.stitemsu_SalesDiscount, BasicVars.CurrencyPart)
                }).FirstOrDefault();

                for (int i = 0; i < item.unitQntity ; i++)
                {
                    list.Add(items);
                }
            }


            foreach (var l in list)
            {
                l.salespriceST = l.salesprice + " " + CurrencyInfo.currencyShortcut();
            }

        }


here i set the report source (list)
private void simpleButton1_Click(object sender, EventArgs e)
        {
            printAllItems();

            MrSReports.R_Stores.printCodeOneCol report = new MrSReports.R_Stores.printCodeOneCol();
            string fileName = FoldersPaths.BarcodeLayoutPath;
            if (File.Exists(fileName))
            {
                report.LoadLayout(fileName);
            }
            
            report.DataSource = list;
            Functions.PrintMultiCopiesOFBarcode(report, "ITEMS");

        }


this function to check the permissions and print the doc (xtrareport)
public static void PrintMultiCopiesOFBarcode(XtraReport report , string AccessRule, int AccessLevel = 4)
        {
            ConnectionTools.ReadConnPara();
            if (Functions.CheckPermissions(AccessLevel, AccessRule) == 0)
            {
                Msg.Show(strings.ACCESS_DENIED, strings.YOU_DO_NOT_HAVE_PERMISSIONS_TO_EXECUTE_THIS_OPERATION, 0);
            }
            else
            {
               
                try
                {
                    report.CreateDocument(true);
                   
                    report.Print();
                }
                catch { Msg.Show(strings.ERROR, strings.CAN_NOT_PRINT_REPORT_CHECK_THE_CONNECTION_OR_PRINTER_SETTING, 0); };
            }
        }


What I have tried:

i test my software on another printer and it work fine.
i'm sure the issue with the printer settings.
i changed the size of the label and it print the size fine but it print just one label.
also i changed Printing Preferences :
Type : Die-Cut labels
Width: 50mm , height: 25mm
but still print just one label.
Posted
Updated 23-Jul-20 6:15am
v3
Comments
OriginalGriff 23-Jul-20 12:00pm    
With no idea what your code is doing, we cannot help you.
Perhaps the relevant code fragments would help?

Use the "Improve question" widget to edit your question and provide better information.
Richard MacCutchan 23-Jul-20 12:00pm    
Maybe a secret bug in your secret code. Seriously, you have posted enough questions here to know that we cannot guess what your code is doing.
Golden Basim 23-Jul-20 12:09pm    
h guess that the issue not related to the code , because i tested the code on other printer and it work. .. ok i will improve the qst. thanks

1 solution

Quote:
Why barcode printer print only one label?

If you don't tell otherwise, a printer prints 1 label at the time.
It may depend on the printer and its language.
Size of label doesn't matter.
What matters is the printer brand and language used, the commands sent to printer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900