Beispiel #1
0
 public static void Print(ReportClass reportClass,string printerName)
 {
     Service.ServiceGet serviceGet = new ServiceGet();
     Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, printerName);
     if (!(printer == null || printer.Details == "NONE" || printer.Disable == true))
     {
         reportClass.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
         reportClass.PrintOptions.PrinterName = printer.Details;
         reportClass.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0));
         reportClass.PrintToPrinter(1,false,0,0);
     }
 }
Beispiel #2
0
 public static void Print(ReportClass reportClass,string printerName)
 {
     Service.ServiceGet serviceGet = new ServiceGet();
     Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, printerName);
     if (!(printer == null || printer.Details == "NONE" || printer.Disable == true))
     {
         if (StaticClass.mode == "AUT")
         {
             reportClass.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
         }
         else if (StaticClass.mode == "SQL")
         {
             //reportClass.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName,
                                                               // StaticClass.userName, StaticClass.password);
             reportClass.SetDatabaseLogon(StaticClass.userName, StaticClass.password, StaticClass.serverName,
                                          StaticClass.databaseName,true);
             reportClass.DataSourceConnections[0].IntegratedSecurity = false;
         }
         else
         {
             return;
         }
         
         
         if(printerName == "Hóa đơn")
         {
             reportClass.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0));
         }
         
         try
         {
             reportClass.PrintOptions.PrinterName = printer.Details;
             reportClass.PrintToPrinter(1, false, 0, 0);
         }
         catch (Exception)
         {
             Alert.Show("Lỗi máy in", Color.Red);
         }
         
     }
 }
Beispiel #3
0
 private void button51_Click(object sender, EventArgs e)
 {
     if (!Employee.CheckGrant(StaticClass.storeId, StaticClass.cashierId, Employee.CFA_Open_Cash_Drawer))
     {
         return;
     }
     //rptOpenDrawer rptOpenDrawer = new rptOpenDrawer();
     //Utilities.Utils.Print(rptOpenDrawer,Printer.PrinterHoadon);
     Service.ServiceGet serviceGet = new ServiceGet();
     Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, Printer.PrinterHoadon);
     if (!(printer == null || printer.Details == "NONE" || printer.Disable == true))
     {
         Service.CashdrawerService.OpenCashDrawer1(printer.Details);
     }
 }