Пример #1
0
        private void printThanhToan(string invoiceNumber, string tableNumber)
        {
            Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, "Hóa đơn");

            if (!(printer == null || printer.Details == "NONE" || printer.Disable == true))
            {
                Re_ThanhToan xxx = new Re_ThanhToan();

                string[] pa    = { "@Store_ID", "@Invoice_Number", "table" };
                object[] value = { StaticClass.storeId, invoiceNumber, tableNumber };
                serviceGet.FillDataReport(xxx, pa, value, true);
                //xxx.PrintOptions.PrinterName = printer.Details;

                xxx.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0));

                Utilities.Utils.Print(xxx, Printer.PrinterHoadon);
                //try
                //{
                //    xxx.PrintToPrinter(1, false, 0, 0);
                //}
                //catch (Exception)
                //{
                //    Alert.Show("Lỗi máy in", Color.Red);
                //}
                //Service.CashdrawerService.OpenCashDrawer1(printer.Details);
                xxx.Dispose();
            }
        }
Пример #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))
            {
                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);
            }
        }
Пример #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);
            }
        }
Пример #4
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);
                }
            }
        }
Пример #5
0
        private void button51_Click(object sender, EventArgs e)
        {
            getGui.DeleteInvoiceItemized(StaticClass.storeId, this.invoiceNum);
            if (myCash1.listInvoiceItem.Rows.Count == 0)
            {
                myCash1.invoiceTotal.Rows[0][15] = "V";

                getGui.CloseTable(StaticClass.storeId, invoiceNum);
            }
            else
            {
                myCash1.invoiceTotal.Rows[0][57] = Convert.ToInt32(myCash1.invoiceTotal.Rows[0][57]) + 1;
                foreach (DataRow c in myCash1.listInvoiceItem.Rows)
                {
                    getGui.UpdateInvoiceItemized(StaticClass.storeId, invoiceNum, c[2].ToString(), c[3].ToString(), c[12].ToString(), c[1].ToString(), c[6].ToString(), c[7].ToString(), c[8].ToString(), c[5].ToString(), c[19].ToString());
                }
            }
            UpdateInvoiceTotals();
            SendToKitchen();
            if (myCash1.listInvoiceItem.Rows.Count != 0)
            {
                Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, "Hóa đơn");
                if (!(printer == null || printer.Details == "NONE" || printer.Disable == true))
                {
                    CrystalReport5 xxx = new CrystalReport5();

                    xxx.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
                    ParameterFieldDefinitions crParameterFieldDefinitions;
                    ParameterValues           crParameterValues = new ParameterValues();

                    ParameterFieldDefinitions crParameterFieldDefinitions1;
                    ParameterValues           crParameterValues1        = new ParameterValues();
                    ParameterDiscreteValue    crParameterDiscreteValue  = new ParameterDiscreteValue();
                    ParameterDiscreteValue    crParameterDiscreteValue1 = new ParameterDiscreteValue();


                    crParameterDiscreteValue.Value = StaticClass.storeId;
                    crParameterFieldDefinitions    = xxx.DataDefinition.ParameterFields;
                    ParameterFieldDefinition crParameterFieldDefinition = crParameterFieldDefinitions["@Store_ID"];
                    crParameterValues = crParameterFieldDefinition.CurrentValues;

                    crParameterValues.Clear();
                    crParameterValues.Add(crParameterDiscreteValue);
                    crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

                    crParameterDiscreteValue1.Value = invoiceNum;
                    crParameterFieldDefinitions1    = xxx.DataDefinition.ParameterFields;
                    ParameterFieldDefinition crParameterFieldDefinition1 = crParameterFieldDefinitions1["@Invoice_Number"];
                    crParameterValues1 = crParameterFieldDefinition1.CurrentValues;

                    crParameterValues1.Clear();
                    crParameterValues1.Add(crParameterDiscreteValue1);
                    crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1);

                    xxx.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
                    xxx.PrintOptions.PrinterName = printer.Details;
                    xxx.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0));
                    xxx.PrintToPrinter(1, false, 0, 0);
                }
            }
            this.Dispose();
            formLayout.FrmLayout_Load(null, null);
        }