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.