Пример #1
0
        protected void btnPrintPUN_Click(object sender, EventArgs e)
        {
            List <PickupNoticeModel> names = new List <PickupNoticeModel>();
            string punIds     = string.Empty;
            int    WeightInKg = 0;

            foreach (GridViewRow gvr in this.gvSearchPickupNotice.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    PickupNoticeModel g = new PickupNoticeModel();
                    if (!string.IsNullOrEmpty(punIds))
                    {
                        punIds += ",";
                    }
                    punIds += gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString();
                    g.ID    = new Guid(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString());
                    names.Add(g);
                    WeightInKg = WeightInKg + Convert.ToInt32(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Values["WeightInKg"]);
                }
            }


            List <PickupNoticeModel> pikListcheck = PickupNoticeModel.PrintPUNChecking(punIds);

            if (pikListcheck.Count > 0)
            {
                Session["ReportType"] = "DoNuthing";
                Messages.SetMessage("You may contact system administrator for assistance. From selected PUN list the following WHR# are already printed: " + pikListcheck.Select(s => s.WarehouseReceiptNo.ToString()).Aggregate((str, nex) => str + "," + nex), Messages.MessageType.Warning);
            }
            else
            {
                List <PickupNoticeModel> pikList = PickupNoticeModel.PreparePUNId(punIds);
                if (pikList.Count > 0)
                {
                    Session["ReportType"] = "PUN";
                    Session["PUNID"]      = pikList.Select(s => s.ID.ToString()).Aggregate((str, nex) => str + "," + nex);
                    ScriptManager.RegisterStartupScript(this,
                                                        this.GetType(),
                                                        "ShowReport",
                                                        "<script type=\"text/javascript\">" +
                                                        string.Format("javascript:window.open(\"ReportViewer.aspx\", \"_blank\",\"height=1000px,width=1000px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +

                                                        "</script>",
                                                        false);
                }
                else
                {
                    Messages.SetMessage("The system can’t print this Pun please contact Administrator ", Messages.MessageType.Warning);
                }
            }
            btnGINProcess.Style["visibility"] = "Visible";
            btnPrintPUN.Style["visibility"]   = "Visible";
            btnProcessPSA.Style["visibility"] = "Visible";
        }
Пример #2
0
        protected void btnPrintPUN_Click(object sender, EventArgs e)
        {
            PickupNoticeModel        objWHR = new PickupNoticeModel();
            List <PickupNoticeModel> names = new List <PickupNoticeModel>();
            string punIds = string.Empty, WHRNo = string.Empty;

            int WeightInKg = 0;

            foreach (GridViewRow gvr in this.gvSearchPickupNotice.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    PickupNoticeModel g = new PickupNoticeModel();
                    if (!string.IsNullOrEmpty(punIds))
                    {
                        punIds += ",";
                        WHRNo  += ",";
                    }
                    punIds += gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString();
                    WHRNo  += gvSearchPickupNotice.DataKeys[gvr.RowIndex].Values["WarehouseReceiptNo"];
                    g.ID    = new Guid(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString());
                    names.Add(g);
                    WeightInKg = WeightInKg + Convert.ToInt32(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Values["WeightInKg"]);
                }
            }

            List <PickupNoticeModel> pikList = PickupNoticeModel.PreparePUNId(punIds);

            Session["ReportType"] = "PUN";
            Session["PUNID"]      = pikList.Select(s => s.ID.ToString()).Aggregate((str, nex) => str + "," + nex);
            ScriptManager.RegisterStartupScript(this,
                                                this.GetType(),
                                                "ShowReport",
                                                "<script type=\"text/javascript\">" +
                                                string.Format("javascript:window.open(\"ReportViewer.aspx\", \"_blank\",\"height=1000px,width=1000px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +

                                                "</script>",
                                                false);
            btnPrintPUN.Style["visibility"] = "Visible";
            objWHR.MWarehouseReceiptNo      = WHRNo;
            objWHR.CreatedBy = UserBLL.GetCurrentUser();
            objWHR.Remark    = txtRemark.Text;
            objWHR.SaveWHR();
        }
Пример #3
0
        private void detail_Format(object sender, EventArgs e)
        {
            rptSubPUNWRReport rp = new rptSubPUNWRReport();
            DataTable         dt = new DataTable();

            dt = PickupNoticeModel.PrintSubReportPUN(new Guid(textBox4.Text));
            if (dt.Rows.Count > 0)
            {
                flag = false;
                txtRemainingWeight.Visible  = true;
                txtRemainingWeight1.Visible = false;
            }
            else
            {
                txtRemainingWeight.Visible  = false;
                txtRemainingWeight1.Visible = true;
                txtRemainingWeight1.Text    = txtWeightInKg1.Text;
            }
            rp.DataSource = dt;
            subWarehouseReceiptList.Report = rp;
        }
Пример #4
0
        private void Process()
        {
            string punIds     = string.Empty;
            int    WeightInKg = 0;
            int    MaxLimit   = 0;
            int    count      = 0;

            foreach (GridViewRow gvr in this.gvSearchPickupNotice.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    System.Web.UI.WebControls.Label lblUnApprovedGINCount = ((System.Web.UI.WebControls.Label)gvr.FindControl("lblUnApprovedGINCount"));
                    int UnApprovedGINCount = 0;
                    if (Session["ProcessType"].ToString() == "PSA" && int.TryParse(lblUnApprovedGINCount.Text, out UnApprovedGINCount) && UnApprovedGINCount > 0)
                    {
                        Messages.SetMessage("The selected PUN in row " + (gvr.RowIndex + 1).ToString() + " has unapproved " + UnApprovedGINCount + " GIN under it. Please approve that first!"
                                            , WarehouseApplication.Messages.MessageType.Warning);
                        return;
                    }

                    if (!string.IsNullOrEmpty(punIds))
                    {
                        punIds += ",";
                    }
                    punIds          += gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString();
                    Session["PUNID"] = punIds;
                    count            = count + 1;
                    WeightInKg       = WeightInKg + Convert.ToInt32(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Values["WeightInKg"]);
                    MaxLimit         = Convert.ToInt32(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Values["MaxLimit"]);
                }
            }

            //if (WeightInKg > MaxLimit)
            //{
            //    Messages.SetMessage("The selected PUN list exceeded the maximum capacity by : " + (Convert.ToInt32(CommodityMaximumRangeEnum.MaximumRange) - WeightInKg) + " You can only process maximum of " + Convert.ToInt32(CommodityMaximumRangeEnum.MaximumRange) + " for one truck/GIN.", Messages.MessageType.Warning);
            //}
            //else
            //{
            GINModel ob = new GINModel();
            List <PickupNoticeModel> pikListcheck = PickupNoticeModel.PrintPUNChecking(punIds);

            if (pikListcheck.Count != count)
            {
                Messages.SetMessage("From selected PUN list some of them are not printed.You can’t process GIN before PUN is printed. ", Messages.MessageType.Warning);
            }
            else
            {
                ob.ID = Guid.NewGuid();
                ob.PrepareGIN(punIds);
                Guid   gradeID;
                string shedName;
                gradeID  = ob.PickupNoticesList[0].CommodityGradeID;
                shedName = ob.PickupNoticesList[0].ShedName;
                ob.PickupNoticesList[0].ShedName = shedName;
                int ProductionYear = ob.PickupNoticesList[0].ProductionYear;
                ob.PickupNoticesList[0].ProductionYear = ProductionYear;
                bool hasError = false;
                foreach (PickupNoticeModel pm in ob.PickupNoticesList)
                {
                    if (pm.ProductionYear != ProductionYear ||
                        pm.CommodityGradeID != gradeID ||
                        pm.ShedName != shedName)
                    {
                        hasError = true;
                        Messages.SetMessage("ERROR: Please check warehouse receipts are of the same grade, shed and production year!");
                        break;
                    }
                }
                if (hasError)
                {
                    return;
                }
                ob.PUNPrintDateTime = pikListcheck[0].PUNPrintDateTime;
                ob.PUNPrintedBy     = pikListcheck[0].PUNPrintedBy;
                ob.GINNumber        = ob.GetNewGINNumber()[0];
                ob.AutoNumber       = int.Parse(ob.GetNewGINNumber()[1]);
                //  ob.TransactionId = WFTransaction.GetTransaction(new Guid(ConfigurationSettings.AppSettings["GINNew"])).ToString();
                ob.WarehouseID      = UserBLL.GetCurrentWarehouse();
                ob.CommodityGradeID = gradeID;
                ob.ProductionYear   = ProductionYear;
                Session["GINMODEL"] = ob;
                Session["EditMode"] = false;
                if (Session["ProcessType"].ToString() == "GIN")
                {
                    Response.Redirect("GIN.aspx");
                }
                else if (Session["ProcessType"].ToString() == "PSA")
                {
                    Response.Redirect("GINPSA.aspx");
                }
                //}
            }
            btnGINProcess.Style["visibility"] = "Visible";
            btnPrintPUN.Style["visibility"]   = "Visible";
            btnProcessPSA.Style["visibility"] = "Visible";
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // DataTable dt = new DataTable();
            ActiveReport rpt = null;

            if (Session["ReportType"].ToString() == "PreArrival")
            {
                BLL.PreArrival objPreArrival = new BLL.PreArrival();
                DataTable      dt            = objPreArrival.PopulatePreArrival(new Guid(Session["CommodityRequestId"].ToString()));
                rpt                           = new rptTrackingReport();
                rpt.DataSource                = dt;
                WebViewer1.Report             = rpt;
                Session["CommodityRequestId"] = null;
                WebViewer1.Width              = 600;
                WebViewer1.Height             = 400;
            }
            if (Session["ReportType"].ToString() == "GRN")
            {
                rpt = new rptGRNnew();
                GRN_BL    objGrnBl = new GRN_BL();
                DataTable dt       = objGrnBl.GetGRNReport(new Guid(Session["GRNId_GRN"].ToString()));
                rpt.DataSource    = dt;
                WebViewer1.Report = rpt;
            }
            if (Session["ReportType"].ToString() != "DoNuthing")
            {
                if (Session["ReportType"].ToString() == "PUN")
                {
                    rpt            = new rptPUNReport();
                    rpt.DataSource = GINBussiness.PickupNoticeModel.PrintPUN(Session["PUNID"].ToString());
                }
                else if (Session["ReportType"].ToString() == "GIN")
                {
                    rpt = new rptGINReport();
                    Session["GINID"] = ((GINModel)Session["GINMODEL"]).ID;
                    rpt.DataSource   = GINBussiness.PickupNoticeModel.PrintGIN(Convert.ToBoolean(Session["EditModePrint"]), new Guid(Session["GINID"].ToString()));
                }
                else if (Session["ReportType"].ToString() == "PSA")
                {
//----------Updated START ------ NOV 27 2013

                    // if it is redirected from search page
                    string statusx = "Unapproved PSA";
                    if (Request.QueryString["GINID"] == null)
                    {
                        rpt = new rptPSAReport(statusx);
                        Session["GINPSAID"] = ((GINModel)Session["GINMODEL"]).ID;
                        rpt.DataSource      = GINBussiness.PickupNoticeModel.PrintPSA(new Guid(Session["GINPSAID"].ToString()));
                    }
                    else
                    {
                        statusx = (Convert.ToInt16(Request.QueryString["ST"]) % 11 == 0) ? "Approved" : "Unapproved PSA";
                        rpt     = new rptPSAReport(statusx);
                        if (statusx.Equals("Approved"))
                        {
                            rpt.DataSource = GINBussiness.PickupNoticeModel.PrintPSA_Approved(new Guid(Request.QueryString["GINID"]));
                        }
                        else
                        {
                            rpt.DataSource = GINBussiness.PickupNoticeModel.PrintPSA(new Guid(Request.QueryString["GINID"]));
                        }
                    }
//----------Updated End ------ NOV 27 2013
                }
                else if (Session["ReportType"].ToString() == "ExpierdList")
                {
                    rpt = new rptPickupNoticeExpiredList();
                    DataTable dt = new DataTable();
                    dt = PickupNoticeModel.SearchExpieredList(UserBLL.GetCurrentWarehouse(), Convert.ToDateTime(Session["ExpirationDateFrom"]), Convert.ToDateTime(Session["ExpirationDateTo"]));
                    if (dt.Rows.Count > 0)
                    {
                        rpt.DataSource = dt;
                    }
                    else
                    {
                        return;
                    }
                }
                else if (Session["ReportType"].ToString() == "ExpierdListAdmin")
                {
                    rpt = new rptPickupNoticeExpiredList();
                    DataTable dt = new DataTable();
                    dt = PickupNoticeModel.SearchExpieredListAdmin(Convert.ToDateTime(Session["ExpirationDateFrom"]), Convert.ToDateTime(Session["ExpirationDateTo"]));
                    if (dt.Rows.Count > 0)
                    {
                        rpt.DataSource = dt;
                    }
                    else
                    {
                        return;
                    }
                }
                else if (Session["ReportType"].ToString() == "GINApproval")
                {
                    rpt                          = new rptGINApproval();
                    rpt.DataSource               = GINBussiness.GINModel.PrintGINApprovalReport(UserBLL.GetCurrentWarehouse(), new Guid(Session["SelectedLIC"].ToString()));
                    WebViewer1.Report            = rpt;
                    rpt.PageSettings.Margins.Top = 0;
                }
                else if (Session["ReportType"].ToString() == "SampleTicket")
                {
                    //rpt = new rptSampleTicketCoffeeNew();
                    //rpt.DataSource = SamplingBussiness.SamplingModel.GetSampleTicketReport(new Guid(Session["SampleId"].ToString()));

                    rpt            = new rptSampleTicketCoffeeNew();
                    rpt.DataSource = SamplingBussiness.SamplingModel.GetSampleTicketReport(new Guid(Session["SampleId"].ToString()));
                }
                else if (Session["ReportType"].ToString() == "GradingResult")
                {
                    rpt = new rptResultReport();

                    rpt.DataSource = GradingModel.GradingResultreport(Session["GradingCode"].ToString());
                }
                else if (Session["ReportType"].ToString() == "GradingResultNoDeposit")
                {
                    rpt = new rptInspectionTestResult();

                    rpt.DataSource = GradingModel.GetInspectionTestResult(Session["GradingCode"].ToString(), UserBLL.GetCurrentWarehouse());
                }
                else if (Session["ReportType"].ToString() == "GradingCode")
                {
                    rpt = new rptGenerate();
                    DataTable dt = new DataTable();
                    dt = GradingModel.printCode(new Guid(Session["GenerateCode"].ToString()), new Guid(Session["VoucherCommodityTypeID"].ToString()), new Guid(Session["CommodityID"].ToString()));

                    rpt.DataSource = dt;
                }
                else if (Session["ReportType"].ToString() == "GradingResultForSegrigation")
                {
                    rpt            = new Report.rptSegrigationGradingReport();
                    rpt.DataSource = GradingModel.GradingResultreportForSegrigation(Session["GradingCode"].ToString());
                }
                if (Session["ReportType"].ToString() != "GINApproval")
                {
                    rpt.PageSettings.Margins.Top   = 0;
                    rpt.PageSettings.Margins.Left  = 0.4f;
                    rpt.PageSettings.Margins.Right = 0.4f;
                    WebViewer1.Report = rpt;

                    //rpt.Run(false);
                    //Response.ContentType = "application/pdf";
                    //Response.AddHeader("content-disposition", "inline; filename=MyPDF.PDF");

                    //// Create the PDF export object
                    //PdfExport pdf = new PdfExport();
                    //// Create a new memory stream that will hold the pdf output
                    //System.IO.MemoryStream memStream = new System.IO.MemoryStream();
                    //// Export the report to PDF:
                    //pdf.Export(rpt.Document, memStream);
                    //// Write the PDF stream out
                    //Response.BinaryWrite(memStream.ToArray());
                    //// Send all buffered content to the client
                    //Response.End();
                }
            }
        }