Ejemplo n.º 1
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());
                }
            }
            UpdateInvoiceTotals();

            if (myCash1.listInvoiceItem.Rows.Count != 0)
            {
                CrystalReport5            xxx = new CrystalReport5();
                ParameterFieldDefinitions crParameterFieldDefinitions;
                ParameterFieldDefinition  crParameterFieldDefinition;
                ParameterValues           crParameterValues = new ParameterValues();

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


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

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

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

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


                xxx.PrintToPrinter(1, true, 1, 1);
            }
            this.Dispose();
            formLayout.FrmLayout_Load(null, null);
        }
        public ActionResult GenerateReport5()
        {
            DB50Entities db = new DB50Entities();

            var            c = db.Report5();
            CrystalReport5 r = new CrystalReport5();

            r.Load();

            Stream s = r.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            return(File(s, "application/pdf"));
        }
Ejemplo n.º 3
0
        public void CreateReport(string id)
        {
            string KH      = (String)id;
            string KH_ID   = KH.Substring(2);
            var    results = (from sup1 in data.Inf_Customers
                              join sup2 in data.Inf_Repair on sup1.Customer_Id equals sup2.Customer_Id
                              join sup3 in data.Detail_Inf_Repair on sup2.Repair_Id equals sup3.Repair_Id
                              where sup1.Customer_Id == "KH" + KH_ID
                              select new { sup1.Customer_Name, sup1.Customer_Phone, sup2.Detail_Inf_Repair.Repair_Money, sup2.Laptop_Name, sup2.Repair_Id });
            CrystalReport5 rp = new CrystalReport5();

            rp.SetDataSource(results);
            crystalReportViewer1.ReportSource = rp;
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            CrystalReport5 xxx = new CrystalReport5();

            xxx.DataSourceConnections[0].SetConnection("THANH\\SQLEXPRESS", "Po", true);
            MessageBox.Show(xxx.DataSourceConnections[0].DatabaseName);
            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition  crParameterFieldDefinition;
            ParameterValues           crParameterValues = new ParameterValues();

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


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

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

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

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


            xxx.PrintToPrinter(1, true, 1, 1);
            crystalReportViewer1.ReportSource = xxx;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Download PDF of loan's installments
        /// </summary>
        /// <returns></returns>
        public ActionResult ExportLoanInstallments()
        {
            List <Installement> allCustomer = new List <Installement>();

            allCustomer = db.Installements.ToList();


            CrystalReport5 rd = new CrystalReport5();

            rd.Load(Path.Combine(Server.MapPath("~/CrystalReports"), "ReportCustomer.rpt"));

            rd.SetDataSource(allCustomer);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();


            Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            stream.Seek(0, SeekOrigin.Begin);
            return(File(stream, "application/pdf", "ViewInstallment.pdf"));
        }
Ejemplo n.º 6
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);
        }