Beispiel #1
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            String customerID   = labCustomerIDValue.Text.Trim();
            String nameCustomer = labCustomerNameValue.Text;
            String address      = labAddressValue.Text;

            //
            DataTable  reportData = new DataTable();
            DataColumn newColumn  = new DataColumn();

            newColumn.ColumnName = "ID";
            newColumn.DataType   = System.Type.GetType("System.String");
            reportData.Columns.Add(newColumn);

            DataColumn newColumn1 = new DataColumn();

            newColumn1.ColumnName = "Name";
            newColumn1.DataType   = System.Type.GetType("System.String");
            reportData.Columns.Add(newColumn1);

            DataColumn newColumn2 = new DataColumn();

            newColumn2.ColumnName = "Quantity";
            newColumn2.DataType   = System.Type.GetType("System.String");
            reportData.Columns.Add(newColumn2);

            DataColumn newColumn3 = new DataColumn();

            newColumn3.ColumnName = "Price";
            newColumn3.DataType   = System.Type.GetType("System.String");
            reportData.Columns.Add(newColumn3);

            DataColumn newColumn4 = new DataColumn();

            newColumn4.ColumnName = "Monetized";
            newColumn4.DataType   = System.Type.GetType("System.String");
            reportData.Columns.Add(newColumn4);
            int QTY = 0;

            foreach (DataRow _row in orderDetailTable.Rows)
            {
                DataRow _rowValue = reportData.NewRow();
                _rowValue["ID"]        = _row.ItemArray[1];
                _rowValue["Name"]      = _row.ItemArray[2];
                _rowValue["Quantity"]  = _row.ItemArray[9];
                _rowValue["Price"]     = _row.ItemArray[7];
                _rowValue["Monetized"] = _row.ItemArray[10];
                QTY += int.Parse(_row.ItemArray[9].ToString());
                reportData.Rows.Add(_rowValue);
            }
            //
            frmViewBill billReportView = new frmViewBill(reportData, nameCustomer, address, QTY.ToString(),
                                                         spintotalEstimate.Text, orderID);

            billReportView.ShowDialog();
            billReportView.ShowInTaskbar = false;
        }
Beispiel #2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            //try
            //{
            String    customerID = customerBUS.GetCustomerByOrderDetailId(lblOrderValue.Text.Trim());
            DataTable customer   = customerBUS.GetCustomerById(customerID);

            if (customer.Rows.Count > 0)
            {
                String nameCustomer = customer.Rows[0].ItemArray[2].ToString();
                String address      = customer.Rows[0].ItemArray[5].ToString();
                String orderID      = orderDetailBUS.GetOrderIDByOrderDetailID(lblOrderValue.Text.Trim());
                //
                DataTable  reportData = new DataTable();
                DataColumn newColumn  = new DataColumn();
                newColumn.ColumnName = "ID";
                newColumn.DataType   = System.Type.GetType("System.String");
                reportData.Columns.Add(newColumn);

                DataColumn newColumn1 = new DataColumn();
                newColumn1.ColumnName = "Name";
                newColumn1.DataType   = System.Type.GetType("System.String");
                reportData.Columns.Add(newColumn1);

                DataColumn newColumn2 = new DataColumn();
                newColumn2.ColumnName = "Quantity";
                newColumn2.DataType   = System.Type.GetType("System.String");
                reportData.Columns.Add(newColumn2);

                DataColumn newColumn3 = new DataColumn();
                newColumn3.ColumnName = "Price";
                newColumn3.DataType   = System.Type.GetType("System.String");
                reportData.Columns.Add(newColumn3);

                DataColumn newColumn4 = new DataColumn();
                newColumn4.ColumnName = "Monetized";
                newColumn4.DataType   = System.Type.GetType("System.String");
                reportData.Columns.Add(newColumn4);

                serviceDetailDataTable = serviceDetailBUS.GetAllServiceDetailByOrderID(lblOrderValue.Text.Trim());
                DataColumn[] keys = new DataColumn[1];
                keys[0] = serviceDetailDataTable.Columns["ServicesID"];
                serviceDetailDataTable.PrimaryKey = keys;
                gvServiceDetail.DataSource        = serviceDetailDataTable;

                foreach (DataRow _row in serviceDetailDataTable.Rows)
                {
                    DataRow _rowValue = reportData.NewRow();
                    _rowValue["ID"]        = _row.ItemArray[3];
                    _rowValue["Name"]      = _row.ItemArray[8];
                    _rowValue["Quantity"]  = _row.ItemArray[4];
                    _rowValue["Price"]     = _row.ItemArray[10];
                    _rowValue["Monetized"] = _row.ItemArray[5];
                    reportData.Rows.Add(_rowValue);
                }
                //
                frmViewBill billReportView = new frmViewBill(reportData, nameCustomer, address, grdvServiceDetail.Columns["Quantity"].SummaryItem.SummaryValue.ToString(),
                                                             txtTotalMoney.Text, orderID);
                billReportView.ShowDialog();
                billReportView.ShowInTaskbar = false;
            }
            //}
            //catch (System.Exception)
            //{

            //}
        }