コード例 #1
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            System.IO.MemoryStream m_stream = new System.IO.MemoryStream();
            rptStackBalance        rpt      = new rptStackBalance();



            GRN_BL objSGRN = new GRN_BL();

            rpt.DataSource = objSGRN.GetGRNStackBalanceReport(UserBLL.GetCurrentWarehouse(), new Guid(drpShed.SelectedValue), new Guid(drpInventoryCoordinatorLoad.SelectedValue), new Guid(drpStackNo.SelectedValue.ToString()));
            rpt.PageSettings.Margins.Top = 0;
            rpt.PageSettings.Orientation = DataDynamics.ActiveReports.Document.PageOrientation.Landscape;

            rpt.Run();
            if (this.xlsExport1 == null)
            {
                this.xlsExport1 = new DataDynamics.ActiveReports.Export.Xls.XlsExport();
            }
            // this.xlsExport1.MinColumnWidth = (float)(0.5);
            this.xlsExport1.Export(rpt.Document, m_stream);
            m_stream.Position    = 0;
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("content-disposition", "inline; filename=MyExport.xls");
            Response.BinaryWrite(m_stream.ToArray());
            Response.End();
        }
コード例 #2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            ActiveReport rpt = null;

            rpt = new Report.rptStackBalance();
            GRN_BL    objSGRN = new GRN_BL();
            DataTable dt      = new DataTable();

            dt = objSGRN.GetGRNStackBalanceReport(UserBLL.GetCurrentWarehouse(), new Guid(drpShed.SelectedValue), new Guid(drpInventoryCoordinatorLoad.SelectedValue), new Guid(drpStackNo.SelectedValue.ToString()));
            if (dt.Rows.Count > 0)
            {
                rpt.DataSource = dt;
                rpt.PageSettings.Margins.Top = 0;
                rpt.PageSettings.Orientation = DataDynamics.ActiveReports.Document.PageOrientation.Landscape;
                // rpt.PageSettings.Orientation=DataDynamics.ActiveReports.Document.Align

                WebViewer1.Report = rpt;
            }
            //Session["ReportType"] = "StackBalance";
            //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);
        }
コード例 #3
0
        private void BindSearchGrid()
        {
            GRN_BL objGrn = new GRN_BL();

            if (cmbSearchCriteria.SelectedValue == "0" || string.IsNullOrEmpty(txtValue.Text))
            {
                lblSearchResultStatus.ForeColor = System.Drawing.Color.Orange;
                lblSearchResultStatus.Text      = "Please select searching criteria or searching key!";
                return;
            }
            DataTable dt = objGrn.SearchRecords(cmbSearchCriteria.SelectedValue, txtValue.Text);

            if (dt.Rows.Count == 0)
            {
                dt.Rows.Clear();
                grdSearchResultList.DataSource = dt;
                grdSearchResultList.DataBind();
                lblSearchResultStatus.ForeColor = System.Drawing.Color.Orange;
                lblSearchResultStatus.Text      = "No record found with specified searching criteria!";
                return;
            }
            lblSearchResultStatus.ForeColor = System.Drawing.Color.Green;
            int count = dt.Rows.Count;

            lblSearchResultStatus.Text     = (count == 1 ? count + " record found" : count + " records found");
            grdSearchResultList.DataSource = dt;
            grdSearchResultList.DataBind();
        }
コード例 #4
0
        private void detail_Format(object sender, EventArgs e)
        {
            //count++;
            rptGradingNew rpt    = new rptGradingNew();
            GRN_BL        objGRN = new GRN_BL();
            DataTable     dt     = objGRN.GetGradingsWithSameGRNReport(lblGRN_No.Text);

            rows              = dt.Rows.Count;
            rpt.DataSource    = dt;
            subReport1.Report = rpt;
        }
コード例 #5
0
        public void UpdateReceipt()
        {
            string GRNNo    = txtGRNNo.Text;
            Guid   LICName2 = new Guid(ddLIC.SelectedValue.ToString());
            //Guid Shed = new Guid();
            string Shed               = DDLShed.SelectedItem.ToString();
            GRN_BL objGrnNew          = new GRN_BL();
            GRNBLL objGrnOld          = objGrnNew.GetWarehouseReciptByGRNNumber(GRNNo);
            WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);

            objWR.EditWHRtoWarehouse(GRNNo, Shed);
        }
コード例 #6
0
        private void groupFooter2_Format(object sender, EventArgs e)
        {
            GRN_BL    objSGRN = new GRN_BL();
            DataTable dt      = objSGRN.GetTotalGRNStackById(new Guid(label8.Text));

            if (dt.Rows.Count > 0)
            {
                txtTotalGRNWeight.Text = dt.Rows[0]["NetWeight"].ToString();
                txtTotalGRNBag.Text    = dt.Rows[0]["NoOfBug"].ToString();
                GrnTotal      = Convert.ToDouble(txtTotalGRNWeight.Text);
                GRNBalanceBag = Convert.ToDouble(txtTotalGRNBag.Text);
            }
        }
コード例 #7
0
        protected void GRNApprovalEdit()
        {
            string dateEntered;
            string timeEntered;
            Guid   GRNNo;
            string GRN_No;
            int    response;

            Messages1.ClearMessage();
            int countError = 0;

            dateEntered = ((TextBox)grvGRNApproval.Rows[0].FindControl("txtDateTimeLICSigned")).Text;
            timeEntered = ((TextBox)grvGRNApproval.Rows[0].FindControl("txtTimeLICSigned")).Text;
            GRNNo       = new Guid(grvGRNApproval.DataKeys[0].Value.ToString());
            GRN_No      = ((Label)grvGRNApproval.Rows[0].FindControl("lblGRNNo")).Text;
            response    = int.Parse(((DropDownList)grvGRNApproval.Rows[0].FindControl("drpLICStatus")).SelectedValue);

            if (dateEntered == "" || timeEntered == "")
            {
                Messages1.SetMessage("Enter values to GRN No: <b>" + GRN_No + "</b><br/>", WarehouseApplication.Messages.MessageType.Warning);
                countError++;
            }

            if (countError == 0)
            {
                try
                {
                    GRNApprovalModel.UpdateGRNSupervisorApproval(GRNNo, UserBLL.CurrentUser.UserId, response, (DateTime.Parse(dateEntered + " " + timeEntered)), DateTime.Now);

                    // if Superevisor Accept it create WarehouseReciept....
                    if (response == 1)
                    {
                        GRN_BL objGrnNew          = new GRN_BL();
                        GRNBLL objGrnOld          = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No);
                        WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);
                        objWR.Save();
                    }

                    BindGRNApprovalGridviewForEdit();
                    Messages1.SetMessage("Updated successfully.", Messages.MessageType.Success);
                }
                catch (Exception ex)
                {
                    Messages1.SetMessage(ex.Message, Messages.MessageType.Error);
                }
            }
            else
            {
                btnApprove.Style["visibility"] = "visible";
            }
        }
コード例 #8
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            System.IO.MemoryStream m_stream = new System.IO.MemoryStream();
            GRN_BL objGrn                 = new GRN_BL();
            rptWBServiceProvider rpt      = new rptWBServiceProvider();
            Guid      warehouseId         = new Guid(cboWarehouse.SelectedValue);
            int       wbServiceProviderId = cboWBServiceProvider.SelectedIndex == 0 ? -2 : int.Parse(cboWBServiceProvider.SelectedValue);
            DateTime  startDate           = string.IsNullOrEmpty(txtStartDate.Text) ? DateTime.Parse("1/1/2010") : DateTime.Parse(txtStartDate.Text);
            DateTime  endDate             = string.IsNullOrEmpty(txtEndDate.Text) ? DateTime.Now : DateTime.Parse(txtEndDate.Text);
            int       serviceType         = int.Parse(cboServiceType.SelectedValue);
            DataTable dt = objGrn.GetWBServiceProviderReport(warehouseId, wbServiceProviderId, startDate, endDate, serviceType);
            decimal   sumNumberOfBags, sumNetWeight;

            int rowsCount = dt.Rows.Count;

            string NoOfRegords = "";

            if (rowsCount == 0)
            {
                Messages1.SetMessage("No record found with specified criteria.", WarehouseApplication.Messages.MessageType.Warning);
                WebViewer1.ClearCachedReport();
                return;
            }
            else
            {
                sumNumberOfBags = decimal.Parse(dt.Compute("Sum(NumberOfBags)", "").ToString());
                sumNetWeight    = decimal.Parse(dt.Compute("Sum(NetWeight)", "").ToString());
                NoOfRegords     = rowsCount == 1 ? "1 record found." : rowsCount + " records found.";
                Messages1.SetMessage(NoOfRegords, WarehouseApplication.Messages.MessageType.Success);
                rpt.SumNumberOfBags = sumNumberOfBags;
                rpt.SumNetWeight    = sumNetWeight;
            }
            rpt.Warehouse         = cboWarehouse.SelectedItem.Text;
            rpt.WBServiceProvider = cboWBServiceProvider.SelectedIndex == 0 ? "All" : cboWBServiceProvider.SelectedItem.Text;
            rpt.DateFrom          = string.IsNullOrEmpty(txtStartDate.Text) ? "No Limit" : txtStartDate.Text;
            rpt.DateTo            = string.IsNullOrEmpty(txtEndDate.Text) ? "Present Date" : txtEndDate.Text;
            rpt.DataSource        = dt;

            rpt.Run();
            if (this.xlsExport1 == null)
            {
                this.xlsExport1 = new DataDynamics.ActiveReports.Export.Xls.XlsExport();
            }
            // this.xlsExport1.MinColumnWidth = (float)(0.5);
            this.xlsExport1.Export(rpt.Document, m_stream);
            m_stream.Position    = 0;
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("content-disposition", "inline; filename=MyExport.xls");
            Response.BinaryWrite(m_stream.ToArray());
            Response.End();
        }
コード例 #9
0
        private void LoadStacksByShadeId(Guid ShadeId)
        {
            //Load Stacks
            DataTable dt;
            GRN_BL    objGRN_BL = new GRN_BL();

            cboStackNo.Items.Clear();
            cboStackNo.Items.Add(new ListItem("Select Stack No.", ""));
            //dt = objGRN_BL.GetAllAvailableStacks(ShadeId, new Guid("6b5852b4-15a2-41ac-aad6-89f1c2955bc1"), int.Parse(Session["ProductionYear"].ToString()));
            dt = objGRN_BL.GetAllAvailableStacks(ShadeId, new Guid(ViewState["CommodityGradeId"].ToString()), int.Parse(ViewState["ProductionYear"].ToString()));
            cboStackNo.DataSource     = dt;
            cboStackNo.DataValueField = "Id";
            cboStackNo.DataTextField  = "Number";
            cboStackNo.DataBind();
        }
コード例 #10
0
        private void detail_Format(object sender, EventArgs e)
        {
            rptGRNnew.count++;
            rptGradingFactorsResultReport rpt = new rptGradingFactorsResultReport();
            GRN_BL    objGRN = new GRN_BL();
            DataTable dt     = objGRN.GetGradingResultFactorReport(lblGradingCode.Text);

            rpt.DataSource    = dt;
            subReport1.Report = rpt;
            if (rptGRNnew.count == rptGRNnew.rows)
            {
                pageBreak1.Enabled = false;
                rptGRNnew.count    = 0;
            }
        }
コード例 #11
0
        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            try
            {
                Messages1.ClearMessage();
                GRN_BL objGrn                 = new GRN_BL();
                rptWBServiceProvider rpt      = new rptWBServiceProvider();
                Guid      warehouseId         = new Guid(cboWarehouse.SelectedValue);
                int       wbServiceProviderId = cboWBServiceProvider.SelectedIndex == 0 ? -2 : int.Parse(cboWBServiceProvider.SelectedValue);
                DateTime  startDate           = string.IsNullOrEmpty(txtStartDate.Text) ? DateTime.Parse("1/1/2010") : DateTime.Parse(txtStartDate.Text);
                DateTime  endDate             = string.IsNullOrEmpty(txtEndDate.Text) ? DateTime.Now : DateTime.Parse(txtEndDate.Text);
                int       serviceType         = int.Parse(cboServiceType.SelectedValue);
                DataTable dt = objGrn.GetWBServiceProviderReport(warehouseId, wbServiceProviderId, startDate, endDate, serviceType);
                decimal   sumNumberOfBags, sumNetWeight;

                int rowsCount = dt.Rows.Count;

                string NoOfRegords = "";
                if (rowsCount == 0)
                {
                    Messages1.SetMessage("No record found with specified criteria.", WarehouseApplication.Messages.MessageType.Warning);
                    WebViewer1.ClearCachedReport();
                    return;
                }
                else
                {
                    sumNumberOfBags = decimal.Parse(dt.Compute("Sum(NumberOfBags)", "").ToString());
                    sumNetWeight    = decimal.Parse(dt.Compute("Sum(NetWeight)", "").ToString());
                    NoOfRegords     = rowsCount == 1 ? "1 record found." : rowsCount + " records found.";
                    Messages1.SetMessage(NoOfRegords, WarehouseApplication.Messages.MessageType.Success);
                    rpt.SumNumberOfBags = sumNumberOfBags;
                    rpt.SumNetWeight    = sumNetWeight;
                }
                rpt.Warehouse         = cboWarehouse.SelectedItem.Text;
                rpt.WBServiceProvider = cboWBServiceProvider.SelectedIndex == 0 ? "All" : cboWBServiceProvider.SelectedItem.Text;
                rpt.DateFrom          = string.IsNullOrEmpty(txtStartDate.Text) ? "No Limit" : txtStartDate.Text;
                rpt.DateTo            = string.IsNullOrEmpty(txtEndDate.Text) ? "Present Date" : txtEndDate.Text;
                rpt.DataSource        = dt;

                WebViewer1.Report = rpt;
            }
            catch (Exception ex)
            {
                Messages1.SetMessage(ex.Message, WarehouseApplication.Messages.MessageType.Error);
            }
        }
コード例 #12
0
        protected void cboWarehouse_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (int position = cboWBServiceProvider.Items.Count; position > 1; position--)
            {
                cboWBServiceProvider.Items.RemoveAt(position - 1);
            }
            if (cboWarehouse.SelectedIndex == 0)
            {
                return;
            }
            GRN_BL objGRN = new GRN_BL();

            cboWBServiceProvider.DataSource     = objGRN.GetAllWBServiceProviders(new Guid(cboWarehouse.SelectedValue));
            cboWBServiceProvider.DataTextField  = "ServiceProviderName";
            cboWBServiceProvider.DataValueField = "Id";
            cboWBServiceProvider.DataBind();
        }
コード例 #13
0
        protected void txtTruckWeight_TextChanged(object sender, EventArgs e)
        {
            GRN_BL objGrn = new GRN_BL();
            double decimalNetWeight;
            int    noofbag = 0;
            double tare    = 0;

            if (txtNumberOfBags.Text != "" && txtGrossTruckWeight.Text != "")
            {
                double Moistcont       = objGrn.getmoisturecontentbytrNo(ViewState["GradingCode"].ToString());
                double moiscontodeduct = 0;
                if (Moistcont > 11.5)
                {
                    moiscontodeduct = (Moistcont - 11.5) * 1.3;
                }

                double grossTruckWeightdec = Convert.ToDouble(txtGrossTruckWeight.Text);
                double truckweightdouble   = Convert.ToDouble(txtTruckWeight.Text);
                tare = Convert.ToDouble(hdnTare.Value);
                try
                {
                    noofbag          = Convert.ToInt16(txtNumberOfBags.Text);
                    decimalNetWeight = ((grossTruckWeightdec - truckweightdouble) - (noofbag * tare));
                    if (Moistcont > 11.5)
                    {
                        decimalNetWeight = decimalNetWeight - ((moiscontodeduct / 100) * decimalNetWeight);
                    }
                    lblNetWeight.Text = (Math.Round(decimalNetWeight * Math.Pow(10, 2)) / Math.Pow(10, 2)).ToString();
                    //HalfBagWeght = Math.Round(Convert.ToDecimal((noofbag * tare) / 2), 4);
                    //NetWeightWithHalfbagWeight = Math.Round(Convert.ToDecimal(lblNetWeight.Text) + HalfBagWeght,4);

                    //ViewState["HalfBagWeght"] = Math.Round(Convert.ToDecimal((noofbag * tare) / 2), 4);
                    //ViewState["NetWeightWithHalfbagWeight"] = Math.Round(Convert.ToDecimal(lblNetWeight.Text) + HalfBagWeght, 4);

                    //to bebadded
                    //objGrn.NetWeight = Convert.ToDecimal(Math.Round(decimalNetWeight * Math.Pow(10, 2)) / Math.Pow(10, 2));
                }


                catch (Exception ex)
                {
                }
            }
        }
コード例 #14
0
 /// <summary>
 /// Populate existing unloading information, if the page is opened for update
 /// </summary>
 private void PopulateInformation()
 {
     try
     {
         GRN_BL    objGrn = new GRN_BL();
         DataTable dt     = objGrn.PopulateGrnById(new Guid(Session["GRNID_Search"].ToString()));
         txtDepositTicketNumber.Text = dt.Rows[0]["UnloadingTicketNumber"].ToString();
         txtNumberOfBags.Text        = dt.Rows[0]["TotalNumberOfBags"].ToString();
         txtRebagging.Text           = dt.Rows[0]["RebagingQuantity"].ToString();
         txtDateDeposited.Text       = DateTime.Parse(dt.Rows[0]["DateDeposited"].ToString()).ToShortDateString();
         txtTimeDeposited.Text       = DateTime.Parse(dt.Rows[0]["DateDeposited"].ToString()).ToShortTimeString();
         cboShed.SelectedValue       = dt.Rows[0]["ShedID"].ToString();
         if (cboShed.SelectedIndex != 0 && Request.QueryString["CommandName"].ToString() == "Update")
         {
             LoadLICByShed(new Guid(cboShed.SelectedValue.ToString()));
             LoadStacksByShadeId(new Guid(cboShed.SelectedValue.ToString()));
         }
         cboInventoryController.SelectedValue = dt.Rows[0]["LeadInventoryControllerID"].ToString();
         cboStackNo.SelectedValue             = dt.Rows[0]["StackID"].ToString();
         cboLabourerGroup.SelectedValue       = dt.Rows[0]["LabourerGroup"].ToString();
         chkScaleTicketSigned.Checked         = bool.Parse(dt.Rows[0]["ScaleTicketSigned"].ToString());
         txtScaleTicket.Text                = dt.Rows[0]["ScaleTicketNumber"].ToString();
         txtDateWeighed.Text                = DateTime.Parse(dt.Rows[0]["DateTimeWeighed"].ToString()).ToShortDateString();
         txtTimeWeighed.Text                = DateTime.Parse(dt.Rows[0]["DateTimeWeighed"].ToString()).ToShortTimeString();
         txtGrossTruckWeight.Text           = dt.Rows[0]["GrossWeight"].ToString();
         txtTruckWeight.Text                = dt.Rows[0]["TruckWeight"].ToString();
         cboTruckType.SelectedValue         = dt.Rows[0]["TruckTypeId"].ToString();
         cboWeigher.SelectedValue           = dt.Rows[0]["WeigherID"].ToString();
         cboWBServiceProvider.SelectedValue = dt.Rows[0]["WBServiceProviderID"].ToString();
         txtRemark.Text = dt.Rows[0]["Remark"].ToString();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message.ToString());
     }
 }
コード例 #15
0
        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            try
            {
                GRN_BL          objGrn    = new GRN_BL();
                rptStockBalance rpt       = new rptStockBalance();
                Guid            warehouse = new Guid(cboWarehouse.SelectedValue);
                Guid            shed      = new Guid(cboShed.SelectedValue);
                Guid            LIC       = new Guid(cboLIC.SelectedValue);
                DateTime        startDate = string.IsNullOrEmpty(txtStartDate.Text) ? DateTime.Parse("1/1/2010") : DateTime.Parse(txtStartDate.Text);
                DateTime        endDate   = string.IsNullOrEmpty(txtEndDate.Text) ? DateTime.Now : DateTime.Parse(txtEndDate.Text);
                TimeSpan        span      = endDate.Subtract(startDate);
                if (span.Days > 31)
                {
                    Messages1.SetMessage("Date interval should not exceed one Month", WarehouseApplication.Messages.MessageType.Warning);
                    return;
                }
                DataTable dt = objGrn.GetStockBalanceReport(warehouse, shed, LIC, startDate, endDate);


                DataTable dtb = objGrn.GetStockBalanceReportGIN(warehouse, shed, LIC, startDate, endDate);

                if (dt.Rows.Count == 0 && dtb.Rows.Count == 0)
                {
                    Messages1.SetMessage("No record found with specified criteria.", WarehouseApplication.Messages.MessageType.Warning);
                    WebViewer1.ClearCachedReport();
                    return;
                }
                string record = ((dt.Rows.Count + dtb.Rows.Count) == 1) ? "record found with specified criteria." : "records found with specified criteria.";

                if (dt.Rows.Count != 0 && dtb.Rows.Count != 0)
                {
                    Messages1.SetMessage(dt.Rows.Count + " Unloading and " + dtb.Rows.Count + " Loading " + record, WarehouseApplication.Messages.MessageType.Success);
                }

                else if (dt.Rows.Count != 0 && dtb.Rows.Count == 0)
                {
                    Messages1.SetMessage(dt.Rows.Count + " Unloading " + record, WarehouseApplication.Messages.MessageType.Success);
                }
                else
                {
                    Messages1.SetMessage(dtb.Rows.Count + " Loading " + record, WarehouseApplication.Messages.MessageType.Success);
                }
                rpt.dtbl                 = dtb;
                rpt.SumNumberOfBags      = dt.Compute("Sum(GRNNumberOfBags)", "");
                rpt.SumNumberOfRebagging = dt.Compute("Sum(RebagingQuantity)", "");
                rpt.SumNumberOfNetWeight = dt.Compute("Sum(NetWeight)", "");

                rpt.BagSum              = dtb.Compute("Sum(NoOfBags)", "");
                rpt.RebaggingSum        = dtb.Compute("Sum(NoOfRebags)", "");
                rpt.NetWeightSum        = dtb.Compute("Sum(NetWeight)", "");
                rpt.AdjustmentBagSum    = dtb.Compute("Sum(BagAdjustment)", "");
                rpt.AdjustmentWeightSum = dtb.Compute("Sum(WeightAdjustment)", "");

                rpt.Warehouse     = cboWarehouse.SelectedItem.Text;
                rpt.Shed          = cboShed.SelectedItem.Text;
                rpt.LIC           = cboLIC.SelectedItem.Text;
                rpt.DateFrom      = string.IsNullOrEmpty(txtStartDate.Text) ? "No Limit" : txtStartDate.Text;
                rpt.DateTo        = string.IsNullOrEmpty(txtEndDate.Text) ? "No Limit" : txtEndDate.Text;
                rpt.DataSource    = dt;
                WebViewer1.Report = rpt;
            }
            catch
            {
                Messages1.SetMessage("Unable to get data, please try again.", WarehouseApplication.Messages.MessageType.Error);
            }
        }
コード例 #16
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();
                }
            }
        }
コード例 #17
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            GRN_BL dp = new GRN_BL();

            _dt     = dp.SearchDailyDepositList(txtDateFrom.Text, txtTo.Text);
            _newtbl = new DataTable();
            _newtbl.Columns.Add(new DataColumn("Warehouse", typeof(string)));

            _newtbl.Columns.Add(new DataColumn("DateTimeReceived", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("VoucherNumber", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("DepositorName", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Woreda", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Zone", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Region", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("ArrivalNoOfBags", typeof(int)));


            _newtbl.Columns.Add(new DataColumn("Dateofsample", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("dateofcoding", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("dateofdecoding", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("gradeissueddate", typeof(DateTime)));
            _newtbl.Columns.Add(new DataColumn("ClientAcceptanceDate", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Symbol", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Commodity", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("ArrivalWeight", typeof(float)));


            _newtbl.Columns.Add(new DataColumn("GRNNetWeight", typeof(float)));
            _newtbl.Columns.Add(new DataColumn("TruckPlateNumber", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("TrailerPlateNumber", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("ConsignmentType", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("GRNNoOfBags", typeof(int)));
            _newtbl.Columns.Add(new DataColumn("GRN_Number", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("DateDeposited", typeof(DateTime)));
            _newtbl.Columns.Add(new DataColumn("status", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("traceable", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("TruckType", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("LICName", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Shade", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Rebagging", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("ProductionYear", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Remark", typeof(string)));

            if (_dt.Rows.Count > 0)
            {
                for (int i = 0; i < _dt.Rows.Count; i++)
                {
                    DataRow row = _newtbl.NewRow();
                    row["Warehouse"]       = _dt.Rows[i]["Warehouse"];
                    row["VoucherNumber"]   = _dt.Rows[i]["VoucherNumber"];
                    row["DepositorName"]   = _dt.Rows[i]["DepositorName"];
                    row["Woreda"]          = _dt.Rows[i]["Woreda"];
                    row["Zone"]            = _dt.Rows[i]["Zone"];
                    row["Region"]          = _dt.Rows[i]["Region"];
                    row["ArrivalNoOfBags"] = _dt.Rows[i]["ArrivalNoBugs"];
                    row["Dateofsample"]    = _dt.Rows[i]["DateOfSample"];


                    row["dateofcoding"]         = _dt.Rows[i]["DateOFCoding"];
                    row["DateTimeReceived"]     = _dt.Rows[i]["ArrivaDate"];
                    row["dateofdecoding"]       = _dt.Rows[i]["VoucherNumber"];
                    row["gradeissueddate"]      = _dt.Rows[i]["GradeIssuedDate"];
                    row["ClientAcceptanceDate"] = _dt.Rows[i]["ClientAcceptanceDate"];
                    row["Symbol"]        = _dt.Rows[i]["Symbol"];
                    row["Commodity"]     = _dt.Rows[i]["Commodity"];
                    row["ArrivalWeight"] = _dt.Rows[i]["Quantity"];

                    row["GRNNetWeight"]       = _dt.Rows[i]["GRnNetWeight"];
                    row["TruckPlateNumber"]   = _dt.Rows[i]["CarPlateNumber"];
                    row["TrailerPlateNumber"] = _dt.Rows[i]["TrailerPlateNumber"];
                    row["ConsignmentType"]    = _dt.Rows[i]["Consignment type"];
                    row["GRNNoOfBags"]        = _dt.Rows[i]["TotalNumberOfBags"];
                    row["GRN_Number"]         = _dt.Rows[i]["GRN_Number"];
                    row["DateDeposited"]      = _dt.Rows[i]["DateDeposited"];
                    row["status"]             = _dt.Rows[i]["GRNStatus"];
                    row["traceable"]          = _dt.Rows[i]["IsTraceable"];
                    row["TruckType"]          = _dt.Rows[i]["TruckType"];
                    row["LICName"]            = _dt.Rows[i]["LICName"];
                    row["Shade"]          = _dt.Rows[i]["Shade"];
                    row["Rebagging"]      = _dt.Rows[i]["Rebagging"];
                    row["ProductionYear"] = _dt.Rows[i]["ProductionYear"];
                    row["Remark"]         = _dt.Rows[i]["StatusRemark"];

                    _newtbl.Rows.Add(row);
                }
                PrepareExcel(_newtbl);
            }
        }
コード例 #18
0
        protected void GRNApprovalBySupervisor()
        {
            string dateEntered;
            string timeEntered;
            string GRNNo;
            string GRN_No;
            int    response;

            Messages1.ClearMessage();
            int countError = 0;

            string GRNApprovalXML = "<GRNApproval>";

            foreach (GridViewRow gvr in this.grvGRNApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    // check if date and time is not empty
                    dateEntered = ((TextBox)grvGRNApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned")).Text;
                    timeEntered = ((TextBox)grvGRNApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned")).Text;
                    GRNNo       = grvGRNApproval.DataKeys[gvr.RowIndex].Value.ToString();
                    GRN_No      = ((Label)grvGRNApproval.Rows[gvr.RowIndex].FindControl("lblGRNNo")).Text;
                    response    = int.Parse(((DropDownList)grvGRNApproval.Rows[0].FindControl("drpLICStatus")).SelectedValue);

                    // if Superevisor Accept it create WarehouseReciept....
                    if (response == 1)
                    {
                        GRN_BL objGrnNew          = new GRN_BL();
                        GRNBLL objGrnOld          = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No);
                        WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);
                        objWR.Save();
                    }

                    if (dateEntered == "" || timeEntered == "")
                    {
                        Messages1.SetMessage("Enter values to GRN No: <b>" + GRN_No + "</b><br/>", WarehouseApplication.Messages.MessageType.Warning);
                        countError++;
                    }
                    if (countError == 0)
                    {
                        GRNApprovalXML +=
                            "<GRNApprovalItem> <ID>" + GRNNo + "</ID>" +
                            "<WarehouseSupervisorApprovedBy>" + UserBLL.CurrentUser.UserId + "</WarehouseSupervisorApprovedBy>" +
                            "<WarehouseSupervisorApprovedDateTime>" + dateEntered + " " + timeEntered + "</WarehouseSupervisorApprovedDateTime>" +
                            "<WarehouseSupervisorApprovedTimeStamp>" + DateTime.Now + "</WarehouseSupervisorApprovedTimeStamp>" +
                            "<WarehouseSupervisorStatus>" + response + "</WarehouseSupervisorStatus>" +
                            "<Status>" + 3 + "</Status>" +
                            "<StackID>" + ((Label)grvGRNApproval.Rows[gvr.RowIndex].FindControl("lblStackID")).Text + "</StackID>" +
                            "</GRNApprovalItem>";
                    }
                }
            }
            if (countError == 0)
            {
                try
                {
                    GRNApprovalXML += "</GRNApproval>";
                    GRNApprovalModel.ApproveGRNBySupervisor(GRNApprovalXML);
                    BindGRNApprovalGridview();
                    Messages1.SetMessage("Approved successfully.", Messages.MessageType.Success);
                    BindLIC(status);
                }
                catch (Exception ex)
                {
                    Messages1.SetMessage(ex.Message, Messages.MessageType.Error);
                }
            }
            else
            {
                btnApprove.Style["visibility"] = "visible";
            }
        }
コード例 #19
0
        /// <summary>
        /// Sets all user inputs to BLL instance object
        /// </summary>
        /// <param name="objGrnSetter">An instance of BLL created and send to this method,
        /// NB the instance is not created inside this method</param>
        private void InitializeInstance(GRN_BL objGrnSetter)
        {
            try
            {
                if (ViewState["CommandName"].ToString() == "Update" && Session["GRNID_Search"] != null)
                {
                    objGrnSetter.ID = new Guid(Session["GRNID_Search"].ToString());
                }
                else if (ViewState["CommandName"].ToString() == "Insert")
                {
                    objGrnSetter.ID = Guid.NewGuid();
                }
                else
                {
                    objGrnSetter = null;
                    return;
                }
                Session["GRNId_GRN"] = objGrnSetter.ID;

                objGrnSetter.TrackingNumber        = ViewState["TrackingNumber"].ToString();
                objGrnSetter.DateDeposited         = DateTime.Parse(txtDateDeposited.Text + " " + txtTimeDeposited.Text);
                objGrnSetter.UnloadingTicketNumber = txtDepositTicketNumber.Text;
                objGrnSetter.TotalNumberOfBags     = int.Parse(txtNumberOfBags.Text);
                //objGrnSetter.Quantity = 0;//Not actual value
                objGrnSetter.UserID = UserBLL.GetCurrentUser();
                if (!(string.IsNullOrEmpty(txtRebagging.Text.Trim())))
                {
                    objGrnSetter.RebagingQuantity = int.Parse(txtRebagging.Text);
                }
                else
                {
                    objGrnSetter.RebagingQuantity = 0;
                }


                //StackTransaction related fields
                objGrnSetter.StackTransactionID = Guid.NewGuid();

                objGrnSetter.ShedID  = new Guid(cboShed.SelectedValue);
                objGrnSetter.StackID = new Guid(cboStackNo.SelectedValue);
                objGrnSetter.LeadInventoryController = new Guid(cboInventoryController.SelectedValue);
                objGrnSetter.WeigherID           = new Guid(cboWeigher.SelectedValue);
                objGrnSetter.WBServiceProviderID = int.Parse(cboWBServiceProvider.SelectedValue);
                objGrnSetter.LabourerGroup       = int.Parse(cboLabourerGroup.SelectedValue);
                objGrnSetter.DateTimeWeighed     = DateTime.Parse(txtDateWeighed.Text + " " + txtTimeWeighed.Text);
                objGrnSetter.ScaleTicketNumber   = txtScaleTicket.Text;
                objGrnSetter.GrossWeight         = float.Parse(txtGrossTruckWeight.Text);
                objGrnSetter.TruckWeight         = float.Parse(txtTruckWeight.Text);
                objGrnSetter.NetWeight           = float.Parse(lblNetWeight.Text);

                objGrnSetter.BagTypeID           = BagTypeId;
                objGrnSetter.NoOfBags            = int.Parse(txtNumberOfBags.Text);
                objGrnSetter.Tare                = float.Parse(hdnTare.Value);
                objGrnSetter.Remark              = txtRemark.Text;
                objGrnSetter.ArrivalId           = new Guid(Session["ArrivalId_GRN"].ToString());
                objGrnSetter.IsScaleTicketSigned = chkScaleTicketSigned.Checked;
                objGrnSetter.Tolerance           = float.Parse(ConfigurationSettings.AppSettings["WeightTolerance"].ToString());
                objGrnSetter.TruckTypeID         = int.Parse(cboTruckType.SelectedValue.ToString());
                //objGrnSetter.CommodityGradeId = new Guid(Session["CommodityGradeId_GRN"].ToString());

                objGrnSetter.HalfBagWeight = Math.Round(Convert.ToDecimal((objGrnSetter.NoOfBags * objGrnSetter.Tare) / 2), 4);
                objGrnSetter.NetWeightWithHalfBagWeight = Math.Round(Convert.ToDecimal(objGrnSetter.NetWeight) + objGrnSetter.HalfBagWeight, 4);
            }
            catch (Exception ex)
            {
                throw new Exception("Error on initializing object!");
            }
        }
コード例 #20
0
        protected void grvGRNApproval_SelectedIndexChanged(object sender, EventArgs e)
        {
            Guid     ID, StackID;
            DateTime LICApprovedDate;
            string   dateEntered, timeEntered, GRN_No, message;
            int      response;

            ID              = new Guid(grvGRNApproval.SelectedDataKey.Value.ToString());
            StackID         = new Guid(((Label)grvGRNApproval.SelectedRow.FindControl("lblStackID")).Text);
            dateEntered     = ((TextBox)grvGRNApproval.SelectedRow.FindControl("txtDateTimeLICSigned")).Text;
            timeEntered     = ((TextBox)grvGRNApproval.SelectedRow.FindControl("txtTimeLICSigned")).Text;
            GRN_No          = ((Label)grvGRNApproval.SelectedRow.FindControl("lblGRNNo")).Text;
            response        = int.Parse(((DropDownList)grvGRNApproval.SelectedRow.FindControl("drpLICStatus")).SelectedValue);
            LICApprovedDate = DateTime.Parse(((Label)grvGRNApproval.SelectedRow.FindControl("lblGRNCreatedDate")).Text);

            if (isValidDateTime(dateEntered, timeEntered, LICApprovedDate))
            {
                try
                {
                    if (((bool)ViewState["edit"]))
                    {
                        GRNApprovalModel.UpdateGRNSupervisorApproval(ID, UserBLL.CurrentUser.UserId, response, DateTime.Parse(dateEntered + " " + timeEntered), DateTime.Now);
                        BindGRNApprovalGridviewForEdit();
                        message = "Updated successfully.";
                    }
                    else
                    {
                        if (response == 1) //if Superevisor Accept it create WarehouseReciept....
                        {
                            GRN_BL objGrnNew = new GRN_BL();
                            GRNBLL objGrnOld = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No);

                            // Create the TransactionScope to execute the commands
                            TransactionOptions option = new TransactionOptions();
                            option.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
                            option.Timeout        = new TimeSpan(0, 0, 60);

                            using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, option))
                            {
                                GRNApprovalModel.ApproveGRNBySupervisor(ID, StackID, UserBLL.CurrentUser.UserId, response, DateTime.Parse(dateEntered + " " + timeEntered), DateTime.Now);
                                BindGRNApprovalGridview();

                                //create WarehouseReciept
                                WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);
                                objWR.Save2();

                                // The Complete method commits the transaction
                                transaction.Complete();
                            }
                        }

                        else
                        {
                            GRNApprovalModel.ApproveGRNBySupervisor(ID, StackID, UserBLL.CurrentUser.UserId, response, DateTime.Parse(dateEntered + " " + timeEntered), DateTime.Now);
                            BindGRNApprovalGridview();
                        }

                        message = "Approved successfully";
                        Messages1.SetMessage(message, Messages.MessageType.Success);
                    }
                }

                catch (Exception ex)
                {
                    Messages1.SetMessage("Unable to save record. Please try again.", WarehouseApplication.Messages.MessageType.Error);
                }
            }
        }