Example #1
0
        private void printInvoice()
        {
            if ((gridData.SelectedRows.Count > 0 && !(gridData.SelectedRows[0].Cells[0].Value + "").Equals("")))
            {
                List <reportInvoice> list = new List <reportInvoice>();

                string invCode = gridData.SelectedRows[0].Cells["InvoiceCode"].Value + "";

                DataTable dt = Data.Datatable("EXECUTE listInvoiceDetail2 @InvoiceCode = '" + invCode + "';");

                foreach (DataRow row in dt.Rows)
                {
                    reportInvoice inv = new reportInvoice();
                    inv.InvoiceCode  = row["InvoiceCode"] + "";
                    inv.EmpName      = row["Name"] + "";
                    inv.Date         = row["Date"] + "";
                    inv.ServiceCode  = row["ServiceCode"] + "";
                    inv.ServiceName  = row["ServiceName"] + "";
                    inv.ServiceQty   = int.Parse(row["ServiceQty"] + "");
                    inv.ServicePrice = double.Parse(row["ServicePrice"] + "");
                    inv.ServiceType  = row["ServiceType"] + "";
                    list.Add(inv);
                }

                Reports.RevenueInvoiceDetail report = new Reports.RevenueInvoiceDetail();
                report.SetDataSource(list);

                new frmReport(report).ShowDialog();
            }
            else
            {
                MessageBox.Show("Please select one to print!");
            }
        }
Example #2
0
        private void addCurrentInvoiceToPrint(string code)
        {
            DataSet   ds = Helper.getDataSet("SELECT * FROM viewInvoice3 WHERE Code = '" + code + "';");
            DataTable dt = ds.Tables[0];

            listReport = new List <reportInvoice>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                reportInvoice dataList = new reportInvoice();

                dataList.InvoiceCode  = dt.Rows[i]["Code"].ToString();
                dataList.ProCode      = dt.Rows[i]["ProCode"].ToString();
                dataList.ProName      = dt.Rows[i]["ProductName"].ToString();
                dataList.Quantity     = Convert.ToInt32(dt.Rows[i]["Quantity"].ToString());
                dataList.Price        = Convert.ToDouble(dt.Rows[i]["Price"].ToString());
                dataList.Amount       = Convert.ToDouble(dt.Rows[i]["Amount"].ToString());
                dataList.Sellby       = dt.Rows[i]["EmployeeName"].ToString();
                dataList.CustomerName = dt.Rows[i]["CustomerName"].ToString();
                dataList.Phone        = dt.Rows[i]["Phone"].ToString();
                dataList.Address      = dt.Rows[i]["Address"].ToString();
                dataList.Date         = dt.Rows[i]["Date"].ToString();

                listReport.Add(dataList);
            }
        }
Example #3
0
        private void printInvoiceType()
        {
            if (gridData.SelectedRows.Count > 0 && !(gridData.SelectedRows[0].Cells[0].Value + "").Equals(""))
            {
                List <reportInvoice> list = new List <reportInvoice>();

                DataGridViewRow row = null;

                for (int i = 0; i < gridData.RowCount - 1; i++)
                {
                    row = gridData.Rows[i];
                    reportInvoice inv = new reportInvoice();

                    inv.ServiceType  = row.Cells["ServiceType"].Value + "";
                    inv.ServiceQty   = int.Parse(row.Cells["ServiceQty"].Value + "");
                    inv.ServicePrice = double.Parse(row.Cells["ServicePrice"].Value + "");
                    inv.ServiceName  = row.Cells["ServiceName"].Value + "";
                    inv.InvoiceCode  = row.Cells["InvoiceCode"].Value + "";

                    list.Add(inv);
                }

                Reports.RevenueInvoiceDetailType report = new Reports.RevenueInvoiceDetailType();
                report.SetDataSource(list);

                new frmReport(report).ShowDialog();
            }
            else
            {
                MessageBox.Show("No invoice to print!");
            }
        }