Exemplo n.º 1
0
        private void PrintPreview(bool IsPrint)
        {
            string strDateFrom = bllUtility.FormatDate(dtpFrom);
            string strDateTo   = bllUtility.FormatDate(dtpTo);
            string sql         = "";
            string ReportType  = "";

            if (rptDetails.Checked == true)
            {
                ReportType = "Details";
            }
            else
            {
                ReportType = "Summary";
            }

            Hashtable ht = new Hashtable();


            ht.Add("paramCompany", bllUtility.LoggedInSystemInformation.CompanyName);
            ht.Add("paramComAddress", bllUtility.LoggedInSystemInformation.CompanyAddress);
            ht.Add("paramComContact", bllUtility.LoggedInSystemInformation.CompanyContactNo);
            ht.Add("paramRptTitle", "Sales Statement");
            ht.Add("paramDateFrom", strDateFrom);
            ht.Add("paramDateTo", strDateTo);

            sql = "[dbo].[USP_RptProductSalesStatement]  '" + strDateFrom.Trim() + "','" + strDateTo.Trim() + "','" + ReportType + "'";

            if (rptDetails.Checked == true)
            {
                rptSalesStatement irptSalesStatement = new rptSalesStatement();
                iReportUtility.PrintPreview(irptSalesStatement, sql, ht, IsPrint);
            }
            else
            {
                rptSalesStatementSummary irptSalesStatementSummary = new rptSalesStatementSummary();
                iReportUtility.PrintPreview(irptSalesStatementSummary, sql, ht, IsPrint);
            }
        }
Exemplo n.º 2
0
        private void PrintPreview(bool IsPrint)
        {
            string customer_id    = "";
            string product_id     = "";
            string isPivot        = "0";
            string param_customer = "Customer : All";
            string strDateFrom    = bllUtility.FormatDate(dtpFrom);
            string strDateTo      = bllUtility.FormatDate(dtpTo);
            string sql            = "";
            string ReportType     = "";

            if (rptDetails.Checked == true)
            {
                ReportType = "Details";
            }
            else if (rptSummary.Checked == true)
            {
                ReportType = "Summary";
            }
            if (chk_pivot.Checked == true)
            {
                isPivot = "1";
            }

            //if (rptDetails.Checked == true)
            //{
            if (rptDetails.Checked == true && chk_all_product.Checked == false)
            {
                if (cmb_product.EditValue == null || cmb_product.EditValue.ToString() == "")
                {
                    MessageBox.Show("Please select product code.");
                    return;
                }
                product_id = cmb_product.EditValue.ToString();
            }
            if (chk_all_customer.Checked == false)
            {
                if (cmb_customer.EditValue == null || cmb_customer.EditValue.ToString() == "")
                {
                    MessageBox.Show("Please select Customer.");
                    return;
                }
                customer_id    = cmb_customer.EditValue.ToString();
                param_customer = "Customer : " + cmb_customer.Text;
            }
            //}

            sql = "[dbo].[USP_RptProductSalesStatement]  '" + strDateFrom.Trim() + "','" + strDateTo.Trim() + "','" + ReportType + "','" + customer_id + "','" + product_id + "','" + isPivot + "'";

            if (chk_pivot.Checked == true)
            {
                DataTable dt = bllUtility.GetDataBySP(sql);
                grd_details_report.Visible = false;
                grd_summary_report.Visible = false;
                if (rptSummary.Checked)
                {
                    //summary
                    grd_summary_report.DataSource = dt;
                    grd_summary_report.Dock       = DockStyle.Fill;
                    grd_summary_report.Visible    = true;
                }
                else
                {
                    //details
                    grd_details_report.DataSource = dt;
                    grd_details_report.Dock       = DockStyle.Fill;
                    grd_details_report.Visible    = true;
                }

                grp_report.Visible = true;
            }
            else
            {
                Hashtable ht = new Hashtable();

                ht.Add("paramCompany", bllUtility.LoggedInSystemInformation.CompanyName);
                ht.Add("paramComAddress", bllUtility.LoggedInSystemInformation.CompanyAddress);
                ht.Add("paramComContact", bllUtility.LoggedInSystemInformation.CompanyContactNo);
                ht.Add("paramRptTitle", "Sales Statement");
                ht.Add("paramDateFrom", strDateFrom);
                ht.Add("paramDateTo", strDateTo);


                Cursor = Cursors.WaitCursor;
                if (rptDetails.Checked == true)
                {
                    ht.Add("manufacturer", param_customer);
                    rptSalesStatement irptSalesStatement = new rptSalesStatement();
                    iReportUtility.PrintPreview(irptSalesStatement, sql, ht, IsPrint);
                }
                else
                {
                    rptSalesStatementSummary irptSalesStatementSummary = new rptSalesStatementSummary();
                    iReportUtility.PrintPreview(irptSalesStatementSummary, sql, ht, IsPrint);
                }
                Cursor = Cursors.Default;
            }
        }