示例#1
0
        protected void BtnSaveSOA_Click(object sender, EventArgs e)
        {
            if (BtnSaveSOA.Text == "S A V E")
            {
                HLSSOA.Save_HLSSOA(txtSOANumber.Text, Convert.ToDateTime(txtDate.Text), Convert.ToInt32(txtYear.Text), Convert.ToInt32(txtWeekNum.Text), txtCustCode.Text, txtRemarks.Text, txtPreparedBy.Text, txtPreparedByPost.Text, txtCheckedBy.Text, txtCheckedByPost.Text, txtApprovedBy.Text, txtApprovedByPost.Text, HLSWaybillList, txtAttention.Text, txtAttentionNum.Text);

                Response.Redirect("hlsSOA.aspx");
            }
        }
        protected void BtnSaveSOA_Click(object sender, EventArgs e)
        {
            if (BtnSaveSOA.Text == "S A V E")
            {
                HLSSOA.Save_HLSSOA(txtSOANumber.Text, Convert.ToDateTime(txtDate.Text), Convert.ToInt32(txtYear.Text), Convert.ToInt32(txtWeekNum.Text), txtCustCode.Text, txtRemarks.Text, txtPreparedBy.Text, txtPreparedByPost.Text, txtCheckedBy.Text, txtCheckedByPost.Text, txtApprovedBy.Text, txtApprovedByPost.Text, HLSWaybillList, txtAttention.Text, txtAttentionNum.Text);

                if (HLSSOA.Saving_Error == "")
                {
                    Session["HLS_Trans"]        = "View";
                    Session["HLS_Add_Year"]     = txtYear.Text;
                    Session["HLS_Add_WeekNum"]  = txtWeekNum.Text;
                    Session["HLS_Add_CustCode"] = txtCustCode.Text;
                    Session["HLS_Add_SOANum"]   = txtSOANumber.Text;
                    Response.Redirect("hlsSOA_Add.aspx");
                }

                //Session["HLS_Add_Year"] = HLSSOAList.GetRowValues(HLSSOAList.FocusedRowIndex, "Year").ToString();
                //Session["HLS_Add_WeekNum"] = HLSSOAList.GetRowValues(HLSSOAList.FocusedRowIndex, "WeekNum").ToString();
                //Session["HLS_Add_CustCode"] = HLSSOAList.GetRowValues(HLSSOAList.FocusedRowIndex, "CustCode").ToString();
                //Session["HLS_Add_SOANum"] = HLSSOAList.GetRowValues(HLSSOAList.FocusedRowIndex, "SOANum").ToString();
                //Response.Redirect("hlsSOA_Add.aspx");
                //Response.RedirectLocation = "hlsSOA_Add.aspx";

                //Response.Redirect("hlsSOA.aspx");
            }
            if (BtnSaveSOA.Text == "Print S O A")
            {
                //ModalPopupExtenderLoading.Hide();

                HLSSOA.Print_HLS_SOA(Convert.ToInt32(Session["CreatorKey"]), HLSWaybill, txtSOANumber.Text, txtDate.Text, txtCustomer.Text, txtCustomerAdd.Text, txtAttention.Text, txtAttentionNum.Text, txtRemarks.Text, txtPreparedBy.Text, txtPreparedByPost.Text, txtCheckedBy.Text, txtCheckedByPost.Text, txtApprovedBy.Text, txtApprovedByPost.Text);

                Session["SOA_PrintKey"]   = HLSSOA.hlsSOAPrintKey.ToString();
                Session["DocumentViewer"] = "HLS_SOA";

                //View_HLS_SOA(HLSSOA.hlsSOAPrintKey);

                //SqlConnection cn = new SqlConnection(GlobalClass.SQLConnString());

                //cn.Open();
                //string query = "SELECT * FROM tbl_HLS_StatementOfAccountReport WHERE (PK = " + HLSSOA.hlsSOAPrintKey + ")";
                //SqlDataAdapter sqlAd = new SqlDataAdapter(query, cn);
                //cn.Close();

                //datasets.DataSetSOA hlsSOA = new datasets.DataSetSOA();
                //sqlAd.Fill(hlsSOA, "tbl_HLS_StatementOfAccountReport");

                //ReportDocument myRpt = new ReportDocument();
                //myRpt.Load(Server.MapPath("~/crystalrep/crystalRep_SOA.rpt"));
                //myRpt.SetDataSource(hlsSOA);
                ////myRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "hlsSOA");

                //PrintDialog dialog1 = new PrintDialog();
                //dialog1.AllowSomePages = true;
                //dialog1.AllowPrintToFile = false;

                //if (dialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                //{
                //    int copies = dialog1.PrinterSettings.Copies;
                //    int fromPage = dialog1.PrinterSettings.FromPage;
                //    int toPage = dialog1.PrinterSettings.ToPage;
                //    bool collate = dialog1.PrinterSettings.Collate;

                //    myRpt.PrintOptions.PrinterName = dialog1.PrinterSettings.PrinterName;
                //    myRpt.PrintToPrinter(copies, collate, fromPage, toPage);
                //}

                //myRpt.Dispose();
                //dialog1.Dispose();


                //myRpt.PrintToPrinter(1, false, 0, 1);

                Response.Redirect("hlsSOA_Print.aspx");
                //Response.Redirect("hlsSOA_PrintCrys.aspx");
            }
        }