This issue is driving me crazy. I am using
EPSON TM-T88V printer
to print , earlier it was fine one night OS upgraded to WIN10 and it went all crazy. I have a POS for a retaurant, so if I print a bill for a paricular table for the first time it prints with blank page after the bill hence its too long. But again I print it prints perfectly. Called EPSON and had some issues with test page so they some how fixed it , as there support were limited to only test page so left there. When I tried on POS its same.
Heres my code for printing
private void BillReceipt_Load(object sender, EventArgs e)
{
try
{
string sqlqry = "Select tb.TableNo,Pax,WaiterName,ItemCode,ItemName,Quantity,Amount,tb.BillNo,OrderType,RoundOffAmount as RoundOff, Discount,Gratuity,dues,Date1,tb.Time,ModeOfPayment,CardNo,CardHolderName,BankName,TotalAmount,VAT,ServiceTax,AmountPaid,Comments as comment,CustomerName,offeramount,DeliveryTax,Phoneno,Address From tblOrder o,tblBilling tb Where tb.KOTNo=#kotno and tb.KOTNo=o.KOTNo and o.KOTcancel='False'and o.Quantity>'0'and KOTCancel='False'";
SqlCommand cmd = new SqlCommand(sqlqry, connectionclass.con);
cmd.Parameters.AddWithValue("#kotno", NewOrderBL.KOTNo);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet3 ds = new DataSet3();
adapter.Fill(ds, "Billing");
if (ds.Tables["Billing"].Rows.Count == 0)
{
MessageBox.Show("No Data Found", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
if (deliverybl.order == "Delivery")
{
PrintBillDelivery printbilldelivery = new PrintBillDelivery();
printbilldelivery.SetDataSource(ds);
crystalReportViewer1.ReportSource = printbilldelivery;
System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
printbilldelivery.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
printbilldelivery.PrintOptions.PrinterName = "EPSON TM-T88V Receipt";//for JAPNA PC
printbilldelivery.PrintToPrinter(1, false, 0, 0);
}
else
{
PrintBillReceipt2 printbillreceipt2 = new PrintBillReceipt2();
printbillreceipt2.SetDataSource(ds);
crystalReportViewer1.ReportSource = printbillreceipt2;
System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
printbillreceipt2.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
printbillreceipt2.PrintOptions.PrinterName = "EPSON TM-T88V Receipt";//for JAPNA PC
printbillreceipt2.PrintToPrinter(1, false, 0, 0);
}
//////////////////////////////////////////////////
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally { connectionclass.disconnect(); }
NewOrderBL.KOTNo = string.Empty;
onlinebl.crystalreport = "";
this.DialogResult = DialogResult.OK;
// this.Close();
}
If you need any other info do let me know.So please help. Thanks
I was able to solve the issue it was because of the WIN 10, once I was able to revert back to WIN 8 it worked as before.
Reason I think was crystal report version 13.x is not compatible with WIN 10(not sure though)
Related
public static void CalibrateLoop()
{
communicator comport = new communicator();
while ( Variables.calibrating )
{
Thread.Sleep(500);
if (comport.connect(9600, "VRCONNECTREQUEST", 1, 0, 0))
{
form2.label7.Text = "Connection Successful - Connected to " + comport.port;
}
else
{
Form2.Hide();
var form1 = new Form1();
form1.Closed += (s, args) => Form1.Close();
form1.Show();
}
//label2.Text = comport.message(2, 0, 0);
}
//Variables.minHand[0] = 20;
}
I made this real quick simple piece of code in communicator.cs, the issue is that it refuses to edit the "label7.text" and also the "form2.hide()" doesn't seem to work. The Label7 is located in form2.
Anyone can help me out with this issue? been struggeling to find an answer allover internet
Give proper Reference to that particular file or include a respective Namespace.
I have this application in C# on VS2012, in which I need to generate Crystal Report 13.0.x. This application has been running fine for last 2 years or so . Recently did some addons and after that its giving error
Load Report Fail
However strange thing is that , in a day around 100 times this Crystal report is generated and in between it gives out that error. After the whole application has to be exited and then it works fine too. Because of this I am not abel to replicate the error at me end.
Here my code:
public partial class ChangeOrderList : Form
{
ConnectionClass connectionclass = new ConnectionClass();
NewOrderBL NObl = new NewOrderBL();
DailySalesReportBL DSRbl = new DailySalesReportBL();
public ChangeOrderList()
{
InitializeComponent();
}
private void ChangeOrderList_Load(object sender, EventArgs e)
{
/////////////////////////To count Lunch Buffet///////////////////
DataTable dtlb = DSRbl.selectBuffet(DateTime.Today.Date.ToString(), DateTime.Today.Date.ToString());
string date = dtlb.Rows[0][0].ToString();
////////////////////////////////////////////////////////////////
try
{
string sqlqry = "Select KOTNo,TableNo,WaiterName,ItemCode,ItemName,Quantity,Status,Foodtype from tblOrderChange where KOTNo=#kotno and Quantity>'0.00' and (Category!='Appetizer' and Category!='Indian Breads' and Category!='Desserts' and Category!='Beverages' and Category!='Tandoori')";
SqlCommand cmd = new SqlCommand(sqlqry, connectionclass.con);
cmd.Parameters.AddWithValue("#kotno", NewOrderBL.KOTNo);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet1 ds = new DataSet1();
adapter.Fill(ds, "tblOrderChange");
if (ds.Tables["tblOrderChange"].Rows.Count == 0)
{
MessageBox.Show("No Data Found", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
if (deliverybl.order == "Delivery")
{
//PrintDelivery printorder = new PrintDelivery();
ChangeOrderdelivery printorder = new ChangeOrderdelivery();
printorder.SetDataSource(ds);
crystalReportViewer1.ReportSource = printorder;
System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
printorder.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
printorder.PrintOptions.PrinterName = "EPSON TM-U220 Receipt";
printorder.PrintToPrinter(1, false, 0, 0);
}
else
{
crystalReportViewer1.RefreshReport();
ParameterFields paramFields = new ParameterFields();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "LBqty";
paramDiscreteValue.Value = date;
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
PrintChangeOrderList printchangeorder = new PrintChangeOrderList();
printchangeorder.SetDataSource(ds);
printchangeorder.SetParameterValue("LBqty", date);
crystalReportViewer1.ReportSource = printchangeorder;
System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
printchangeorder.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
printchangeorder.PrintOptions.PrinterName = "EPSON TM-U220 Receipt";
printchangeorder.PrintToPrinter(1, false, 0, 0);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally { connectionclass.disconnect(); }
onlinebl.crystalreport = "";
this.DialogResult = DialogResult.OK;
}
private void btnExit_Click(object sender, EventArgs e)
{
onlinebl.crystalreport = "";
this.DialogResult = DialogResult.OK;
}
I have been banging my head for long . Every where I search it says about the path and I am not using the path anywhere so not able to understand where the fault is.
If you need any more info or the code please let me know. Thanks
Check your class:
<pre>
ChangeOrderdelivery printorder = new ChangeOrderdelivery();
printorder.SetDataSource(ds);
crystalReportViewer1.ReportSource = printorder;
this one has a report Path hidding i guess
ChangeOrderdelivery printorder = new ChangeOrderdelivery();
</pre>
I just deleted internet temp files and after that client has not yet complained about the error. So I am keeping an eye on it if it resolved the issue
Testing this to incorporate into Win 10 UWP app to scan 1D barcodes (format 39 & 128). I have updated latest through nuget 2.0.4.46. Referenced post at http://www.yortondotnet.com/2015/07/mobile-barcode-scanning-with-zxingnet.html regarding some options setting prior to scan() with no luck. The scanner (camera) opens but never recognizes a barcode scan successfully - or failure for that matter. It seems nothing is happening whatsoever. I have included straight, pertinent sample code with some options modifications for review. I have gotten Scandit API to work and was going to try Manateeworks but both are really costly and not an option. I am developing on Surface Pro 3 (Win 10) and that build will also be target machines when complete.
public sealed partial class MainPage : Page
{
UIElement customOverlayElement = null;
MobileBarcodeScanner scanner;
public MainPage()
{
this.InitializeComponent();
//Create a new instance of our scanner
scanner = new MobileBarcodeScanner(this.Dispatcher);
scanner.Dispatcher = this.Dispatcher;
}
private void buttonScanDefault_Click(object sender, RoutedEventArgs e)
{
//Tell our scanner to use the default overlay
scanner.UseCustomOverlay = false;
//We can customize the top and bottom text of our default overlay
scanner.TopText = "Hold camera up to barcode";
scanner.BottomText = "Camera will automatically scan barcode\r\n\r\nPress the 'Back' button to Cancel";
// GWS Set Options
var options = new MobileBarcodeScanningOptions();
options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
ZXing.BarcodeFormat.CODE_39, ZXing.BarcodeFormat.CODE_128
};
options.AutoRotate = false;
options.TryHarder = false;
options.TryInverted = false;
//Start scanning
scanner.Scan(options).ContinueWith(t =>
{
if (t.Result != null)
HandleScanResult(t.Result);
});
}
private void buttonScanContinuously_Click(object sender, RoutedEventArgs e)
{
//Tell our scanner to use the default overlay
scanner.UseCustomOverlay = false;
//We can customize the top and bottom text of our default overlay
scanner.TopText = "Hold camera up to barcode";
scanner.BottomText = "Camera will automatically scan barcode\r\n\r\nPress the 'Back' button to Cancel";
// GWS Set Options
var options = new MobileBarcodeScanningOptions();
options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
ZXing.BarcodeFormat.CODE_39, ZXing.BarcodeFormat.CODE_128
};
options.AutoRotate = false;
options.TryHarder = false;
options.TryInverted = false;
//Start scanning
scanner.ScanContinuously(options, async (result) =>
{
var msg = "Found Barcode: " + result.Text;
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
{
await MessageBox(msg);
});
});
}
async void HandleScanResult(ZXing.Result result)
{
string msg = "";
if (result != null && !string.IsNullOrEmpty(result.Text))
msg = "Found Barcode: " + result.Text;
else
msg = "Scanning Canceled!";
await MessageBox(msg);
}
}
Simon,
I have the exact same problem. I tested your code with the latest nuget 2.1.47, the problem still exists.
You need to download the latest from Github and add the following projects (or DLLs) to your project:
ZXing.Net (project: zxing.portable.csproj)
ZXing.Net.Mobile.Core
ZXing.Net.Mobile.WindowsUniversal
I have tested your code and it works fine. I hope this help.
Cheers,
Sam
I think that the problem in the hardware you are testing with. Surface Pro 3 (Win 10) does not have an auto focus camera. I've never succeed to scan with ZXing using my Surface Pro 3, while the same application is working fine with my other windows 10 device.
I have an multi threaded Application. One of the property of application is reporting.
User can take one year data day by day
I fetch the database, get the results to the List. Then use Excel (as com object).
Excel is opened and cell values are started to be added from the list.
While these processes are going suddenly I get this message:
Here is my code for excel reporting:
private void RNReportDensityStatistics(List<object[]> _PlateBasedDensityStaticticsList)
{
try
{
RNTakeReportButton.Enabled = false;
RNExcelApp = new RNExcel.Application();
RNExcelApp.Visible = false;
RNWorkBook = RNExcelApp.Workbooks.Add();
RNWorkSheet = (RNExcel.Worksheet)RNExcelApp.ActiveSheet;
RNExcelApp.DisplayAlerts = false;
RNProgressBar.Visible = true;
RNProgressBar.Minimum = 0;
RNProgressBar.Maximum = _PlateBasedDensityStaticticsList.Count;
RNProgressBar.Value = 0;
RNProgressBar.Step = 1;
RNExcelApp.Range["A2"].Value = GetGUIItemString(GUIItemIndex.RNReportDensityStatisticsAutoParkPlate);
RNExcelApp.Range["B2"].Value = GetGUIItemString(GUIItemIndex.RNReportDensityStatisticsAutoParkEntryTime);
RNExcelApp.Range["C2"].Value = GetGUIItemString(GUIItemIndex.RNReportDensityStatisticsAutoParkExitTime);
RNExcelApp.Range["D2"].Value = GetGUIItemString(GUIItemIndex.RNReportDensityStatisticsAutoParkCameraIP);
RNExcelApp.Range["E2"].Value = GetGUIItemString(GUIItemIndex.RNReportDensityStatisticsAutoParkSpaceNo);
RNWorkSheet.Columns[1].AutoFit();
RNWorkSheet.Columns[2].AutoFit();
RNWorkSheet.Columns[3].AutoFit();
RNWorkSheet.Columns[4].AutoFit();
RNWorkSheet.Columns[5].AutoFit();
var row = 2;
foreach (var DensityStatistics in _PlateBasedDensityStaticticsList)
{
row++;
RNWorkSheet.Cells[row, "A"] = DensityStatistics[4];
RNWorkSheet.Cells[row, "B"] = ConvertEpochToDateTime(Convert.ToUInt64(DensityStatistics[2]));
RNWorkSheet.Cells[row, "C"] = ConvertEpochToDateTime(Convert.ToUInt64(DensityStatistics[3]));
RNWorkSheet.Cells[row, "D"] = DensityStatistics[0];
RNWorkSheet.Cells[row, "E"] = DensityStatistics[1];
RNProgressBar.PerformStep();
}
RNWorkSheet.Columns[1].AutoFit();
RNWorkSheet.Columns[2].AutoFit();
RNWorkSheet.Columns[3].AutoFit();
RNWorkSheet.Columns[4].AutoFit();
RNWorkSheet.Columns[5].AutoFit();
string RNExcelReportPath = RNExcelReportPathStartingAdress
+ GetGUIItemString(GUIItemIndex.RNReportPathNameAsPlate)
+ RNPlateSearchTextBox.Text + " "
+ GetGUIItemString(GUIItemIndex.RNReportPathNameAsDensity)
+ ".xlsx";
RNWorkBook.SaveAs(RNExcelReportPath,
misValue,
RNExcelPassword,
misValue,
misValue,
misValue,
RNExcel.XlSaveAsAccessMode.xlExclusive,
misValue,
misValue,
misValue,
misValue,
misValue);
RNWorkBook.Close(true, misValue, misValue);
RNExcelApp.Application.Quit();
RNExcelApp.Quit();
RNReleaseObject(RNWorkSheet);
RNReleaseObject(RNWorkBook);
RNReleaseObject(RNExcelApp);
RNTakeReportButton.Enabled = true;
AddLog(LogIndex.RNReportDensityStatisticsSuc, RNExcelReportPath, string.Empty, string.Empty);
}
catch (Exception ex)
{
RNReleaseObject(RNWorkSheet);
RNReleaseObject(RNWorkBook);
RNReleaseObject(RNExcelApp);
AddException(ex.ToString());
RNTakeReportButton.Enabled = true;
AddLog(LogIndex.RNReportDensityStatisticsFail, string.Empty, string.Empty, string.Empty);
}
finally
{
RNReleaseObject(RNWorkSheet);
RNReleaseObject(RNWorkBook);
RNReleaseObject(RNExcelApp);
RNTakeReportButton.Enabled = true;
RNProgressBar.Value = _PlateBasedDensityStaticticsList.Count;
RNProgressBar.Update();
}
}
private void RNReleaseObject(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj);
if (System.Runtime.InteropServices.Marshal.AreComObjectsAvailableForCleanup())
{
System.Runtime.InteropServices.Marshal.CleanupUnusedObjectsInCurrentContext();
}
obj = null;
}
catch (Exception ex)
{
obj = null;
AddTrace("Unable to release the Object ");
AddException(ex.ToString());
}
finally
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
There is no need to use COM object for reporting. I solved my problem by not using com object to use excel for reporting.
There are different tools for reporting and using excel for it
Open XML SDK : http://www.microsoft.com/en-us/download/details.aspx?id=5124
Documentation http://msdn.microsoft.com/en-us/library/bb491088(v=office.14).aspx
If Open XML SDK syntax is hard for you then you can use: http://spreadsheetlight.com/
Documentation is very well and Vincent (http://spreadsheetlight.com/about/ ) is really helpful for your questions.
If your application does not require some kind of charts then you can use: http://closedxml.codeplex.com/
Both of spreadsheetlight and Closed XML are based on Open XML SDK and from my experience I do not any kind of disconnected contex problem.
If you need to protect your excel files you can use: http://dotnetzip.codeplex.com/
You have a password protected zipped xlsx file.
In consequence, you dont need to use COM object, interop services and Excel.Exe in your computer.
I wish the suggestions are helpful and thank you for all who developed SpreadSheetLight and Closed XML and Open XML
I have activated a WSP file which includes a website template. This works and I can see the solution int he solution gallery. When I try to create a website, based on that template, its not showing up. But it says "Status: Activated".
Then I tried to deactivate it and activate it again manually. Out of a sudden, there is a new template showing up, which takes the name of my template appended by a "2".
So whats happening here exactly? The code to activate my solution is:
System.IO.MemoryStream input = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(rootDirectory + "\\Templates\\Project.wsp"), true);
SPDocumentLibrary solutionGallery = (SPDocumentLibrary)web.Site.GetCatalog(SPListTemplateType.SolutionCatalog);
try
{
SPFile solutionFile = solutionGallery.RootFolder.Files.Add("Project.wsp", input);
SPUserSolution newUserSolution = web.Site.Solutions.Add(solutionFile.Item.ID);
}
catch { ... }
Ok, I found the answer myself and want to share it here. The solution is, not to provide the solution in the catalog, but also to enable the features! It works like this:
System.IO.MemoryStream input = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(rootDirectory + "\\Templates\\Project.wsp"), true);
SPDocumentLibrary solutionGallery = (SPDocumentLibrary)web.Site.GetCatalog(SPListTemplateType.SolutionCatalog);
try
{
SPFile solutionFile = solutionGallery.RootFolder.Files.Add("Project.wsp", input);
SPUserSolution newUserSolution = web.Site.Solutions.Add(solutionFile.Item.ID);
Guid solutionId = newUserSolution.SolutionId;
SPFeatureDefinitionCollection siteFeatures = web.Site.FeatureDefinitions;
var features = from SPFeatureDefinition f
in siteFeatures
where f.SolutionId.Equals(solutionId) && f.Scope == SPFeatureScope.Site
select f;
foreach (SPFeatureDefinition feature in features)
{
try
{
web.Site.Features.Add(feature.Id, false, SPFeatureDefinitionScope.Site);
}
catch { }
}
SPWebTemplateCollection webTemplates = web.Site.RootWeb.GetAvailableWebTemplates(1033);
SPWebTemplate webTemplate = (from SPWebTemplate t
in webTemplates
where t.Title == "Projekt"
select t).FirstOrDefault();
if (webTemplate != null)
{
try
{
web.Site.RootWeb.ApplyWebTemplate(webTemplate.Name);
}
catch { }
}
}
catch { ... }