Exemplo n.º 1
0
        private void btnReport_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dtShop = shop.SelectAllShop();
                if (dtShop.Rows.Count != 1)
                {
                    MessageBox.Show("Error ! Please provide the shop information to continue", "Shop Information Required", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    frmShop frm = new frmShop();
                    frm.ShowDialog();
                }
                else
                {

                    ReportsForm rptForm = new ReportsForm();
                    ReportControl frm = null;
                    Form ccr = null;
                    string button = ((ToolStripButton)sender).Name;
                    switch (button)
                    {
                        //REPORTS SECTION
                        case "btnCurrentCashReport":
                            ccr = new CurrentCashReport();
                            break;
                        case "btnBuyerLedger":
                            frm = new SalesPurchaseReportControl(false, Report.Invoice);
                            break;
                        case "btnProductWiseReport":
                            frm = new SalesPurchaseReportControl(false, Report.Invoice);
                            break;
                        case "btnPurchaseReport":
                            frm = new SalesPurchaseReportControl(true, Report.Invoice);
                            break;
                        case "btnSalesReport":
                            frm = new SalesPurchaseReportControl(false, Report.Invoice);
                            break;
                        case "btnCustomerTransaction":
                            frm = new TransactionReportControl(true);
                            break;
                        case "btnCompanyTransaction":
                            frm = new TransactionReportControl(false);
                            break;
                        case "btnProfitReport":
                            frm = new ProfitLossReportControl();
                            break;
                        case "btnDailySalesReport":
                            frm = new DailySalesPurchaseReport();
                            break;
                        case "btnBuyerLedgerReport":
                            frm = new SalesPurchaseReportControl(false, Report.Invoice);
                            break;
                        case "btnItemTransaction":
                            frm = new ProductTransactionReportControl();
                            break;

                        default:
                            break;
                    }
                    if (ccr != null)
                    {
                        ccr.ShowDialog();
                    }
                    else if (frm != null)
                    {
                        frm.Dock = DockStyle.Fill;
                        rptForm.panelReportControl.Controls.Add(frm);
                        this.Visible = false;
                        rptForm.ShowDialog();
                        if (!this.IsDisposed)
                            this.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.LogException(Modules.WelcomeForm, "btnReport", ex, "Welcome Form Exception");

            }
        }
Exemplo n.º 2
0
        private void WelcomeForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control)
            {
                ReportsForm rptForm = new ReportsForm();
                ReportControl frm = null;
                Form ccr = null;

                if ((e.KeyCode ^ Keys.D0) == 0)
                {
                    frm = new SalesPurchaseReportControl(false, Report.CustomerSalesReport);
                }
                else if ((e.KeyCode ^ Keys.D1) == 0)
                {
                    frm = new SalesPurchaseReportControl(true, Report.CompanyPurchaseReport);
                }
                else if ((e.KeyCode ^ Keys.D2) == 0)
                {
                    frm = new DailySalesPurchaseReport();
                }
                else if ((e.KeyCode ^ Keys.D3) == 0)
                {
                    frm = new SalesPurchaseReportControl(false, Report.BuyerLedger);
                }
                else if ((e.KeyCode ^ Keys.D4) == 0)
                {
                    frm = new TransactionReportControl(true);
                }
                else if ((e.KeyCode ^ Keys.D5) == 0)
                {
                    frm = new TransactionReportControl(false);
                }
                else if ((e.KeyCode ^ Keys.D6) == 0)
                {
                    frm = new ProfitLossReportControl();
                }
                else if ((e.KeyCode ^ Keys.D7) == 0)
                {
                    ccr = new CurrentCashReport();
                }
                else if ((e.KeyCode ^ Keys.D8) == 0)
                {
                    frm = new ProductTransactionReportControl();
                }

                if (ccr != null)
                {
                    this.Visible = false;
                    ccr.ShowDialog();
                    if (!this.IsDisposed)
                        this.Visible = true;
                }
                else if (frm != null)
                {
                    frm.Dock = DockStyle.Fill;
                    rptForm.panelReportControl.Controls.Add(frm);
                    this.Visible = false;
                    rptForm.ShowDialog();
                    if (!this.IsDisposed)
                        this.Visible = true;

                }
            }
            else
            {
                string button = string.Empty;
                switch (e.KeyData)
                {
                    case Keys.F1:
                        button = "btnPOS";
                        break;
                    case Keys.F2:
                        button = "btnInvoice";
                        break;
                    case Keys.F3:
                        button = "btnStock";
                        break;
                    case Keys.F4:
                        button = "btnItem";
                        break;
                    case Keys.F5:
                        button = "btnCustomer";
                        break;
                    case Keys.F6:
                        button = "btnCompany";
                        break;
                    case Keys.F7:
                        button = "btnOrder";
                        break;
                    case Keys.F8:
                        button = "btnShop";//button = "btnSystemLog";
                        break;
                    default:
                        break;
                }
                if (!string.IsNullOrEmpty(button))
                    ShowDialog(button);
            }
        }